@@ -127,23 +127,24 @@ int ViewportTexture::get_width() const {
127
127
_err_print_viewport_not_set ();
128
128
return 0 ;
129
129
}
130
- return vp-> size .width ;
130
+ return get_size () .width ;
131
131
}
132
132
133
133
int ViewportTexture::get_height () const {
134
134
if (!vp) {
135
135
_err_print_viewport_not_set ();
136
136
return 0 ;
137
137
}
138
- return vp-> size .height ;
138
+ return get_size () .height ;
139
139
}
140
140
141
141
Size2 ViewportTexture::get_size () const {
142
142
if (!vp) {
143
143
_err_print_viewport_not_set ();
144
144
return Size2 ();
145
145
}
146
- return vp->size ;
146
+ float scale = MIN (vp->get_screen_transform ().get_scale ().width , vp->get_screen_transform ().get_scale ().height );
147
+ return Size2 (vp->size .width * scale, vp->size .height * scale).ceil ();
147
148
}
148
149
149
150
RID ViewportTexture::get_rid () const {
@@ -313,10 +314,8 @@ void Viewport::_sub_window_update(Window *p_window) {
313
314
SubWindow &sw = gui.sub_windows .write [index ];
314
315
sw.pending_window_update = false ;
315
316
316
- Transform2D pos;
317
- pos.set_origin (p_window->get_position ());
318
317
RS::get_singleton ()->canvas_item_clear (sw.canvas_item );
319
- Rect2i r = Rect2i (p_window->get_position (), sw. window ->get_size ());
318
+ Rect2i r = Rect2i (p_window->get_position (), p_window ->get_size ());
320
319
321
320
if (!p_window->get_flag (Window::FLAG_BORDERLESS)) {
322
321
Ref<StyleBox> panel = gui.subwindow_focused == p_window ? p_window->theme_cache .embedded_border : p_window->theme_cache .embedded_unfocused_border ;
@@ -987,6 +986,7 @@ void Viewport::update_canvas_items() {
987
986
for (Viewport::SubWindow w : gui.sub_windows ) {
988
987
if (w.window && !w.pending_window_update ) {
989
988
w.pending_window_update = true ;
989
+ w.window ->_update_viewport_size ();
990
990
callable_mp (this , &Viewport::_sub_window_update).call_deferred (w.window );
991
991
}
992
992
}
0 commit comments