Bug 971720 - Adjust the source pattern transform when masking with RotatedBuffer to take the mask transform into account. r=roc, a=lsblakk
authorMatt Woodrow <mwoodrow@mozilla.com>
Sat, 01 Mar 2014 08:51:17 +1300
changeset 176443 a99090d5a6f4203ae253e5de5b84a25e310b3072
parent 176442 eb47781c21ef6799c7358b67fcacfad29143de28
child 176444 dcc1d457658ab157feda6a23c2aec2ac83101f66
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, lsblakk
bugs971720
milestone28.0
Bug 971720 - Adjust the source pattern transform when masking with RotatedBuffer to take the mask transform into account. r=roc, a=lsblakk
gfx/layers/RotatedBuffer.cpp
--- a/gfx/layers/RotatedBuffer.cpp
+++ b/gfx/layers/RotatedBuffer.cpp
@@ -122,27 +122,34 @@ RotatedBuffer::DrawBufferQuadrant(gfx::D
     // OP_SOURCE is unbounded in Azure, and we really don't want that behaviour here.
     // We also can't do a ClearRect+FillRect since we need the drawing to happen
     // as an atomic operation (to prevent flickering).
     aTarget->PushClipRect(gfx::Rect(fillRect.x, fillRect.y,
                                     fillRect.width, fillRect.height));
   }
 
   if (aMask) {
+    Matrix oldTransform = aTarget->GetTransform();
+
     // Transform from user -> buffer space.
     Matrix transform;
     transform.Translate(quadrantTranslation.x, quadrantTranslation.y);
 
+    Matrix inverseMask = *aMaskTransform;
+    inverseMask.Invert();
+
+    transform *= oldTransform;
+    transform *= inverseMask;
+
 #ifdef MOZ_GFX_OPTIMIZE_MOBILE
     SurfacePattern source(snapshot, EXTEND_CLAMP, transform, FILTER_POINT);
 #else
     SurfacePattern source(snapshot, EXTEND_CLAMP, transform);
 #endif
 
-    Matrix oldTransform = aTarget->GetTransform();
     aTarget->SetTransform(*aMaskTransform);
     aTarget->MaskSurface(source, aMask, Point(0, 0), DrawOptions(aOpacity, aOperator));
     aTarget->SetTransform(oldTransform);
   } else {
 #ifdef MOZ_GFX_OPTIMIZE_MOBILE
     DrawSurfaceOptions options(FILTER_POINT);
 #else
     DrawSurfaceOptions options;