Bug 1370757 - Only push device aligned clips. draft
authorMarkus Stange <mstange@themasta.com>
Tue, 06 Jun 2017 19:19:51 -0400
changeset 589989 7955200a154563cda667c51bbf34ea7469661213
parent 589988 e0537adbca408f40549adcd8a0e7f71fdd014be9
child 589990 35df78e7295a6d4a775aab9f7373b15e18949113
child 589992 4c76d094ae2feff883ad827f59a32b3f9b97b27d
push id62566
push userbmo:mstange@themasta.com
push dateWed, 07 Jun 2017 03:17:35 +0000
bugs1370757
milestone55.0a1
Bug 1370757 - Only push device aligned clips. MozReview-Commit-ID: BO9zds8fiKI
gfx/thebes/gfxQuartzNativeDrawing.cpp
--- a/gfx/thebes/gfxQuartzNativeDrawing.cpp
+++ b/gfx/thebes/gfxQuartzNativeDrawing.cpp
@@ -45,16 +45,22 @@ gfxQuartzNativeDrawing::BeginNativeDrawi
 
     transform.PostTranslate(-mNativeRect.x, -mNativeRect.y);
     mTempDrawTarget->SetTransform(transform);
 
     dt = mTempDrawTarget;
   } else {
     // Clip the DT in case BorrowedCGContext needs to create a new layer.
     // This prevents it from creating a new layer the size of the window.
+    // But make sure that this clip is device pixel aligned.
+    Matrix transform = dt->GetTransform();
+
+    Rect deviceRect = transform.TransformBounds(mNativeRect);
+    deviceRect.RoundOut();
+    mNativeRect = transform.Inverse().TransformBounds(deviceRect);
     mDrawTarget->PushClipRect(mNativeRect);
   }
 
   MOZ_ASSERT(dt->GetBackendType() == BackendType::SKIA);
   mCGContext = mBorrowedContext.Init(dt);
 
   if (NS_WARN_IF(!mCGContext)) {
     // Failed borrowing CG context, so we need to clean up.