зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1508378 - Fix round error when damage rect size/position is odd number and scale factor is used, r=lsalzman
We have rendering artifacts when sceen scale is set and damage size/position is odd number. It's caused by round error so update the size/position accordingly. Differential Revision: https://phabricator.services.mozilla.com/D26903 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
afbad5faf0
Коммит
f8f3c43a24
|
@ -629,6 +629,23 @@ static void WaylandBufferDelayCommitHandler(WindowSurfaceWayland** aSurface) {
|
|||
}
|
||||
}
|
||||
|
||||
void WindowSurfaceWayland::CalcRectScale(LayoutDeviceIntRect& aRect, int aScale) {
|
||||
if (aRect.x & 0x1) {
|
||||
aRect.width += 1;
|
||||
}
|
||||
aRect.x = aRect.x / aScale;
|
||||
|
||||
if (aRect.y & 0x1) {
|
||||
aRect.height += 1;
|
||||
}
|
||||
aRect.y = aRect.y / aScale;
|
||||
|
||||
aRect.width = (aRect.width & 0x1) ? aRect.width / aScale + 1 :
|
||||
aRect.width / aScale;
|
||||
aRect.height = (aRect.height & 0x1) ? aRect.height / aScale + 1 :
|
||||
aRect.height / aScale;
|
||||
}
|
||||
|
||||
void WindowSurfaceWayland::CommitWaylandBuffer() {
|
||||
MOZ_ASSERT(mPendingCommit, "Committing empty surface!");
|
||||
|
||||
|
@ -684,11 +701,13 @@ void WindowSurfaceWayland::CommitWaylandBuffer() {
|
|||
gint scaleFactor = mWindow->GdkScaleFactor();
|
||||
for (auto iter = mWaylandBufferDamage.RectIter(); !iter.Done();
|
||||
iter.Next()) {
|
||||
const mozilla::LayoutDeviceIntRect& r = iter.Get();
|
||||
mozilla::LayoutDeviceIntRect r = iter.Get();
|
||||
// We need to remove the scale factor because the wl_surface_damage
|
||||
// also multiplies by current scale factor.
|
||||
wl_surface_damage(waylandSurface, r.x / scaleFactor, r.y / scaleFactor,
|
||||
r.width / scaleFactor, r.height / scaleFactor);
|
||||
if (scaleFactor > 1) {
|
||||
CalcRectScale(r, scaleFactor);
|
||||
}
|
||||
wl_surface_damage(waylandSurface, r.x, r.y, r.width, r.height);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ class WindowSurfaceWayland : public WindowSurface {
|
|||
const gfx::IntSize& aLockSize);
|
||||
bool CommitImageSurfaceToWaylandBuffer(const LayoutDeviceIntRegion& aRegion);
|
||||
void CommitWaylandBuffer();
|
||||
void CalcRectScale(LayoutDeviceIntRect& aRect, int scale);
|
||||
|
||||
// TODO: Do we need to hold a reference to nsWindow object?
|
||||
nsWindow* mWindow;
|
||||
|
|
Загрузка…
Ссылка в новой задаче