Bug 1013769 - Apply render target offset after the layer transform in BasicCompositor. r=Cwiiis, a=sledru
authorMatt Woodrow <mwoodrow@mozilla.com>
Wed, 21 May 2014 17:32:05 +1200
changeset 200607 6c782d9e00ab86aab14f5786754db809e1f58b2c
parent 200606 f8b8425b4a0073bd1a41487639b5bc5c0d56a8d0
child 200608 ca2e553fcd1b68a62e5c4da4c03a3fcef764419c
push id486
push userasasaki@mozilla.com
push dateMon, 14 Jul 2014 18:39:42 +0000
treeherdermozilla-release@d33428174ff1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersCwiiis, sledru
bugs1013769
milestone31.0
Bug 1013769 - Apply render target offset after the layer transform in BasicCompositor. r=Cwiiis, a=sledru
gfx/2d/Matrix.h
gfx/layers/basic/BasicCompositor.cpp
gfx/layers/basic/BasicLayersImpl.cpp
--- a/gfx/2d/Matrix.h
+++ b/gfx/2d/Matrix.h
@@ -68,16 +68,23 @@ public:
   Matrix &Translate(Float aX, Float aY)
   {
     _31 += _11 * aX + _21 * aY;
     _32 += _12 * aX + _22 * aY;
 
     return *this;
   }
 
+  Matrix &PostTranslate(Float aX, Float aY)
+  {
+    _31 += aX;
+    _32 += aY;
+    return *this;
+  }
+
   Matrix &Rotate(Float aAngle)
   {
     return *this = Matrix::Rotation(aAngle) * *this;
   }
 
   bool Invert()
   {
     // Compute co-factors.
--- a/gfx/layers/basic/BasicCompositor.cpp
+++ b/gfx/layers/basic/BasicCompositor.cpp
@@ -281,17 +281,17 @@ BasicCompositor::DrawQuad(const gfx::Rec
 
     // When we apply the 3D transformation, we do it against a temporary
     // surface, so undo the coordinate offset.
     new3DTransform = new3DTransform * gfx3DMatrix::Translation(-transformBounds.x, -transformBounds.y, 0);
 
     transformBounds.MoveTo(0, 0);
   }
 
-  newTransform.Translate(-offset.x, -offset.y);
+  newTransform.PostTranslate(-offset.x, -offset.y);
   buffer->SetTransform(newTransform);
 
   RefPtr<SourceSurface> sourceMask;
   Matrix maskTransform;
   if (aEffectChain.mSecondaryEffects[EFFECT_MASK]) {
     EffectMask *effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EFFECT_MASK].get());
     sourceMask = effectMask->mMaskTexture->AsSourceBasic()->GetSurface(dest);
     MOZ_ASSERT(effectMask->mMaskTransform.Is2D(), "How did we end up with a 3D transform here?!");
--- a/gfx/layers/basic/BasicLayersImpl.cpp
+++ b/gfx/layers/basic/BasicLayersImpl.cpp
@@ -112,17 +112,17 @@ FillRectWithMask(DrawTarget* aDT,
     aDT->PushClipRect(aRect);
     Matrix oldTransform = aDT->GetTransform();
 
     Matrix inverseMask = *aMaskTransform;
     inverseMask.Invert();
 
     Matrix transform = oldTransform * inverseMask;
     if (aSurfaceTransform) {
-      transform = transform * (*aSurfaceTransform);
+      transform = (*aSurfaceTransform) * transform;
     }
 
     SurfacePattern source(aSurface, aExtendMode, transform, aFilter);
 
     aDT->SetTransform(*aMaskTransform);
     aDT->MaskSurface(source, aMaskSource, Point(0, 0), aOptions);
     aDT->SetTransform(oldTransform);
     aDT->PopClip();