Fix blurred content of embedded windows
This commit is contained in:
parent
b3bcb2dc14
commit
4c481a35b8
2 changed files with 9 additions and 6 deletions
|
@ -127,7 +127,7 @@ int ViewportTexture::get_width() const {
|
||||||
_err_print_viewport_not_set();
|
_err_print_viewport_not_set();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return vp->size.width;
|
return get_size().width;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ViewportTexture::get_height() const {
|
int ViewportTexture::get_height() const {
|
||||||
|
@ -135,7 +135,7 @@ int ViewportTexture::get_height() const {
|
||||||
_err_print_viewport_not_set();
|
_err_print_viewport_not_set();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return vp->size.height;
|
return get_size().height;
|
||||||
}
|
}
|
||||||
|
|
||||||
Size2 ViewportTexture::get_size() const {
|
Size2 ViewportTexture::get_size() const {
|
||||||
|
@ -143,7 +143,7 @@ Size2 ViewportTexture::get_size() const {
|
||||||
_err_print_viewport_not_set();
|
_err_print_viewport_not_set();
|
||||||
return Size2();
|
return Size2();
|
||||||
}
|
}
|
||||||
return vp->size;
|
return Size2(vp->size * vp->get_screen_transform().get_scale()).ceil();
|
||||||
}
|
}
|
||||||
|
|
||||||
RID ViewportTexture::get_rid() const {
|
RID ViewportTexture::get_rid() const {
|
||||||
|
@ -313,10 +313,8 @@ void Viewport::_sub_window_update(Window *p_window) {
|
||||||
SubWindow &sw = gui.sub_windows.write[index];
|
SubWindow &sw = gui.sub_windows.write[index];
|
||||||
sw.pending_window_update = false;
|
sw.pending_window_update = false;
|
||||||
|
|
||||||
Transform2D pos;
|
|
||||||
pos.set_origin(p_window->get_position());
|
|
||||||
RS::get_singleton()->canvas_item_clear(sw.canvas_item);
|
RS::get_singleton()->canvas_item_clear(sw.canvas_item);
|
||||||
Rect2i r = Rect2i(p_window->get_position(), sw.window->get_size());
|
Rect2i r = Rect2i(p_window->get_position(), p_window->get_size());
|
||||||
|
|
||||||
if (!p_window->get_flag(Window::FLAG_BORDERLESS)) {
|
if (!p_window->get_flag(Window::FLAG_BORDERLESS)) {
|
||||||
Ref<StyleBox> panel = gui.subwindow_focused == p_window ? p_window->theme_cache.embedded_border : p_window->theme_cache.embedded_unfocused_border;
|
Ref<StyleBox> panel = gui.subwindow_focused == p_window ? p_window->theme_cache.embedded_border : p_window->theme_cache.embedded_unfocused_border;
|
||||||
|
@ -980,6 +978,7 @@ void Viewport::update_canvas_items() {
|
||||||
for (Viewport::SubWindow w : gui.sub_windows) {
|
for (Viewport::SubWindow w : gui.sub_windows) {
|
||||||
if (w.window && !w.pending_window_update) {
|
if (w.window && !w.pending_window_update) {
|
||||||
w.pending_window_update = true;
|
w.pending_window_update = true;
|
||||||
|
w.window->_update_viewport_size();
|
||||||
callable_mp(this, &Viewport::_sub_window_update).call_deferred(w.window);
|
callable_mp(this, &Viewport::_sub_window_update).call_deferred(w.window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1231,6 +1231,10 @@ void Window::_update_viewport_size() {
|
||||||
notification(NOTIFICATION_WM_SIZE_CHANGED);
|
notification(NOTIFICATION_WM_SIZE_CHANGED);
|
||||||
|
|
||||||
if (embedder) {
|
if (embedder) {
|
||||||
|
float scale = MIN(embedder->stretch_transform.get_scale().width, embedder->stretch_transform.get_scale().height);
|
||||||
|
Size2 s = Size2(final_size.width * scale, final_size.height * scale).ceil();
|
||||||
|
RS::get_singleton()->viewport_set_global_canvas_transform(get_viewport_rid(), global_canvas_transform * scale * content_scale_factor);
|
||||||
|
RS::get_singleton()->viewport_set_size(get_viewport_rid(), s.width, s.height);
|
||||||
embedder->_sub_window_update(this);
|
embedder->_sub_window_update(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue