Skip to content

Commit

Permalink
Bug 1832760 [Wayland] Adjust EGL window size according to scale facto…
Browse files Browse the repository at this point in the history
…r r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D185000
  • Loading branch information
stransky committed Aug 1, 2023
1 parent ade591d commit 13b3e78
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion widget/gtk/MozContainerWayland.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,15 @@ static bool moz_container_wayland_egl_window_needs_size_update_locked(
nsIntSize recentSize;
wl_egl_window_get_attached_size(wl_container->eglwindow, &recentSize.width,
&recentSize.height);
return aSize != recentSize;
if (aSize != recentSize) {
return true;
}

return recentSize.width % aScale != 0 || recentSize.height % aScale != 0;
}

static int adjust_size_for_scale(int aSize, int aScale) {
return aSize - (aSize % aScale);
}

// This is called from layout/compositor code only with
Expand All @@ -190,6 +198,11 @@ void moz_container_wayland_egl_window_set_size(MozContainer* container,
return;
}

// See Bug 1832760. Width/height has to be divided by scale factor,
// we're getting compositor errors otherwise.
aSize.width = adjust_size_for_scale(aSize.width, aScale);
aSize.height = adjust_size_for_scale(aSize.height, aScale);

LOGCONTAINER(
"moz_container_wayland_egl_window_set_size [%p] %d x %d scale %d "
"(unscaled %d x %d)",
Expand Down

0 comments on commit 13b3e78

Please sign in to comment.