Bug 971720 - Adjust the source pattern transform when masking with RotatedBuffer to take the mask transform into account. r=roc

This commit is contained in:
Matt Woodrow 2014-03-01 08:51:17 +13:00
parent 0827270cd6
commit 34ea3f441f

View File

@ -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);