Bug 1832760 [Wayland] Adjust EGL window size according to scale factor r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D185000
This commit is contained in:
stransky 2023-08-29 08:17:53 +00:00
Родитель a2bf1f8d21
Коммит 0d1524e618
1 изменённых файлов: 14 добавлений и 1 удалений

Просмотреть файл

@ -167,7 +167,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
@ -187,6 +195,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)",