From 34ea3f441fa25709a105c6e52bc58d11695124a3 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Sat, 1 Mar 2014 08:51:17 +1300 Subject: [PATCH] Bug 971720 - Adjust the source pattern transform when masking with RotatedBuffer to take the mask transform into account. r=roc --- gfx/layers/RotatedBuffer.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gfx/layers/RotatedBuffer.cpp b/gfx/layers/RotatedBuffer.cpp index 2f4063e0a783..866900261eca 100644 --- a/gfx/layers/RotatedBuffer.cpp +++ b/gfx/layers/RotatedBuffer.cpp @@ -125,17 +125,24 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget, } 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, ExtendMode::CLAMP, transform, Filter::POINT); #else SurfacePattern source(snapshot, ExtendMode::CLAMP, transform); #endif - Matrix oldTransform = aTarget->GetTransform(); aTarget->SetTransform(*aMaskTransform); aTarget->MaskSurface(source, aMask, Point(0, 0), DrawOptions(aOpacity, aOperator)); aTarget->SetTransform(oldTransform);