Bug 1449641 - Always use mDrawTarget when merging the buffered region into the window DrawTarget. r?sotaro draft
authorMarkus Stange <mstange@themasta.com>
Wed, 28 Mar 2018 13:23:35 -0400
changeset 773882 ffe501aeb1c663f857d3e91a6b470a74b4e428d0
parent 773877 80a748ea8cf2a11f8f46f43551b76ab117c3bf5a
push id104341
push userbmo:mstange@themasta.com
push dateWed, 28 Mar 2018 17:25:10 +0000
reviewerssotaro
bugs1449641
milestone61.0a1
Bug 1449641 - Always use mDrawTarget when merging the buffered region into the window DrawTarget. r?sotaro If we have a non-null mTarget, we already set mDrawTarget to mTarget. So "mTarget ? mTarget : mDrawTarget" will always evaluate to mDrawTarget. MozReview-Commit-ID: BlGYEdlL50Q
gfx/layers/basic/BasicCompositor.cpp
--- a/gfx/layers/basic/BasicCompositor.cpp
+++ b/gfx/layers/basic/BasicCompositor.cpp
@@ -1034,28 +1034,27 @@ BasicCompositor::TryToEndRemoteDrawing(b
     MessageLoop::current()->PostDelayedTask(runnable.forget(), retryMs);
     return;
   }
 
   if (mRenderTarget->mDrawTarget != mDrawTarget) {
     // Note: Most platforms require us to buffer drawing to the widget surface.
     // That's why we don't draw to mDrawTarget directly.
     RefPtr<SourceSurface> source = mWidget->EndBackBufferDrawing();
-    RefPtr<DrawTarget> dest(mTarget ? mTarget : mDrawTarget);
 
     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();
-      dest->CopySurface(source,
-                        IntRect(r.X(), r.Y(), r.Width(), r.Height()) - mRenderTarget->GetOrigin(),
-                        IntPoint(r.X(), r.Y()) - offset);
+      mDrawTarget->CopySurface(source,
+                               r.ToUnknownRect() - mRenderTarget->GetOrigin(),
+                               r.TopLeft().ToUnknownPoint() - offset);
     }
   }
 
   if (aForceToEnd || !mTarget) {
     mWidget->EndRemoteDrawingInRegion(mDrawTarget, mInvalidRegion);
   }
 
   mDrawTarget = nullptr;