Bug 1370757 - Only push device aligned clips. r=lsalzman
authorMarkus Stange <mstange@themasta.com>
Tue, 06 Jun 2017 19:19:51 -0400
changeset 411475 9db3efe6c0357bb84cc0603e6cb3b4a4a8db2531
parent 411474 79cbec4c644c193bf8737f18493a789784638ba9
child 411476 34bb128e167e830831d649b193b0231dd89bb864
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsalzman
bugs1370757, 1364007
milestone55.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 1370757 - Only push device aligned clips. r=lsalzman The new clip from bug 1364007 can cause us to clip to a rectangle that's not aligned to device pixels. With the current rect inflation, we didn't notice, but if we want to remove the inflation then we need to make sure to round out the rect that we clip to. 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.