Bug 1444447 - Correctly copy drawn surfaces to the full window render target in BasicCompositor r=mstange
authorBarret Rennie <barret@brennie.ca>
Mon, 22 Apr 2019 17:13:34 +0000
changeset 470381 040c255450c993aab51f1c6ba989203e1f94efa8
parent 470371 81021da13bce7f15ef4129ad300af8894cd2af3f
child 470382 67463f3dd222b254016a8bd210d9f5e3052bf1d8
push id35905
push userdvarga@mozilla.com
push dateTue, 23 Apr 2019 09:53:27 +0000
treeherdermozilla-central@831918f009f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1444447
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1444447 - Correctly copy drawn surfaces to the full window render target in BasicCompositor r=mstange Differential Revision: https://phabricator.services.mozilla.com/D27969
gfx/layers/basic/BasicCompositor.cpp
--- a/gfx/layers/basic/BasicCompositor.cpp
+++ b/gfx/layers/basic/BasicCompositor.cpp
@@ -1055,41 +1055,42 @@ void BasicCompositor::TryToEndRemoteDraw
                                [self]() { self->TryToEndRemoteDrawing(); });
     MessageLoop::current()->PostDelayedTask(runnable.forget(), retryMs);
     return;
   }
 
   if (mRenderTarget->mDrawTarget != mDrawTarget || mFullWindowRenderTarget) {
     RefPtr<SourceSurface> source;
 
+    // Note: Most platforms require us to buffer drawing to the widget
+    // surface. That's why we don't draw to mDrawTarget directly.
+    IntPoint srcOffset = mRenderTarget->GetOrigin();
+    IntPoint dstOffset = mTarget ? mTargetBounds.TopLeft() : IntPoint();
+
     if (mRenderTarget->mDrawTarget != mDrawTarget) {
       source = mWidget->EndBackBufferDrawing();
 
-      // Note: Most platforms require us to buffer drawing to the widget
-      // surface. That's why we don't draw to mDrawTarget directly.
-      nsIntPoint offset = mTarget ? mTargetBounds.TopLeft() : nsIntPoint();
-
       // The source DrawTarget is clipped to the invalidation region, so we have
       // to copy the individual rectangles in the region or else we'll draw
       // blank pixels.
       for (auto iter = mInvalidRegion.RectIter(); !iter.Done(); iter.Next()) {
         const LayoutDeviceIntRect& r = iter.Get();
-        mDrawTarget->CopySurface(source,
-                                 r.ToUnknownRect() - mRenderTarget->GetOrigin(),
-                                 r.TopLeft().ToUnknownPoint() - offset);
+        mDrawTarget->CopySurface(source, r.ToUnknownRect() - srcOffset,
+                                 r.TopLeft().ToUnknownPoint() - dstOffset);
       }
     } else {
       source = mRenderTarget->mDrawTarget->Snapshot();
     }
 
     if (mFullWindowRenderTarget) {
       for (auto iter = mInvalidRegion.RectIter(); !iter.Done(); iter.Next()) {
         const LayoutDeviceIntRect& r = iter.Get();
         mFullWindowRenderTarget->mDrawTarget->CopySurface(
-            source, r.ToUnknownRect(), r.TopLeft().ToUnknownPoint());
+            source, r.ToUnknownRect() - srcOffset,
+            r.TopLeft().ToUnknownPoint() - dstOffset);
       }
 
       mFullWindowRenderTarget->mDrawTarget->Flush();
     }
   }
 
   if (aForceToEnd || !mTarget) {
     mWidget->EndRemoteDrawingInRegion(mDrawTarget, mInvalidRegion);