Bug 993784 - Part 1: Use Moz2D mask data for BasicThebesLayer drawing. r=roc
authorMatt Woodrow <mwoodrow@mozilla.com>
Wed, 09 Apr 2014 21:15:19 +1200
changeset 177821 398f17d079cf2b116b437e6904fba142acef9072
parent 177820 ab89b8f6b4812f6c81c826fefde40fa5fb501e69
child 177822 3c1fc4eed0f528736d2f9c5ba646a1f4e7c02072
push id26566
push useremorley@mozilla.com
push dateThu, 10 Apr 2014 16:55:48 +0000
treeherdermozilla-central@83ae54e18689 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs993784
milestone31.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 993784 - Part 1: Use Moz2D mask data for BasicThebesLayer drawing. r=roc
gfx/layers/RotatedBuffer.cpp
gfx/layers/RotatedBuffer.h
gfx/layers/basic/BasicThebesLayer.cpp
gfx/layers/client/ContentClient.h
--- a/gfx/layers/RotatedBuffer.cpp
+++ b/gfx/layers/RotatedBuffer.cpp
@@ -189,17 +189,17 @@ RotatedContentBuffer::IsClippingCheap(Dr
          aRegion.GetNumRects() <= 1;
 }
 
 void
 RotatedContentBuffer::DrawTo(ThebesLayer* aLayer,
                              DrawTarget* aTarget,
                              float aOpacity,
                              CompositionOp aOp,
-                             gfxASurface* aMask,
+                             SourceSurface* aMask,
                              const Matrix* aMaskTransform)
 {
   if (!EnsureBuffer()) {
     return;
   }
 
   bool clipped = false;
 
@@ -215,27 +215,17 @@ RotatedContentBuffer::DrawTo(ThebesLayer
     // well clip to the smallest area possible --- the visible region.
     // Bug 599189 if there is a non-integer-translation transform in aTarget,
     // we might sample pixels outside GetEffectiveVisibleRegion(), which is wrong
     // and may cause gray lines.
     gfxUtils::ClipToRegionSnapped(aTarget, aLayer->GetEffectiveVisibleRegion());
     clipped = true;
   }
 
-  RefPtr<gfx::SourceSurface> mask;
-  if (aMask) {
-    mask = gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(aTarget, aMask);
-  }
-
-  Matrix maskTransform;
-  if (aMaskTransform) {
-    maskTransform = *aMaskTransform;
-  }
-
-  DrawBufferWithRotation(aTarget, BUFFER_BLACK, aOpacity, aOp, mask, &maskTransform);
+  DrawBufferWithRotation(aTarget, BUFFER_BLACK, aOpacity, aOp, aMask, aMaskTransform);
   if (clipped) {
     aTarget->PopClip();
   }
 }
 
 DrawTarget*
 RotatedContentBuffer::BorrowDrawTargetForQuadrantUpdate(const nsIntRect& aBounds,
                                                         ContextSource aSource)
--- a/gfx/layers/RotatedBuffer.h
+++ b/gfx/layers/RotatedBuffer.h
@@ -309,17 +309,17 @@ public:
    * Complete the drawing operation. The region to draw must have been
    * drawn before this is called. The contents of the buffer are drawn
    * to aTarget.
    */
   void DrawTo(ThebesLayer* aLayer,
               gfx::DrawTarget* aTarget,
               float aOpacity,
               gfx::CompositionOp aOp,
-              gfxASurface* aMask,
+              gfx::SourceSurface* aMask,
               const gfx::Matrix* aMaskTransform);
 
 protected:
   // new texture client versions
   void SetBufferProvider(TextureClient* aClient)
   {
     // Only this buffer provider can give us a buffer.  If we
     // already have one, something has gone wrong.
--- a/gfx/layers/basic/BasicThebesLayer.cpp
+++ b/gfx/layers/basic/BasicThebesLayer.cpp
@@ -118,18 +118,18 @@ BasicThebesLayer::PaintThebes(gfxContext
   if (BasicManager()->IsTransactionIncomplete())
     return;
 
   gfxRect clipExtents;
   clipExtents = aContext->GetClipExtents();
 
   // Pull out the mask surface and transform here, because the mask
   // is internal to basic layers
-  AutoMaskData mask;
-  gfxASurface* maskSurface = nullptr;
+  AutoMoz2DMaskData mask;
+  SourceSurface* maskSurface = nullptr;
   Matrix maskTransform;
   if (GetMaskData(aMaskLayer, &mask)) {
     maskSurface = mask.GetSurface();
     maskTransform = mask.GetTransform();
   }
 
   if (!IsHidden() && !clipExtents.IsEmpty()) {
     mContentClient->DrawTo(this, aContext->GetDrawTarget(), opacity,
--- a/gfx/layers/client/ContentClient.h
+++ b/gfx/layers/client/ContentClient.h
@@ -147,17 +147,17 @@ public:
   {
     BorrowDrawTarget::ReturnDrawTarget(aReturned);
   }
 
   void DrawTo(ThebesLayer* aLayer,
               gfx::DrawTarget* aTarget,
               float aOpacity,
               gfx::CompositionOp aOp,
-              gfxASurface* aMask,
+              gfx::SourceSurface* aMask,
               const gfx::Matrix* aMaskTransform)
   {
     RotatedContentBuffer::DrawTo(aLayer, aTarget, aOpacity, aOp,
                                  aMask, aMaskTransform);
   }
 
   virtual void CreateBuffer(ContentType aType, const nsIntRect& aRect, uint32_t aFlags,
                             RefPtr<gfx::DrawTarget>* aBlackDT, RefPtr<gfx::DrawTarget>* aWhiteDT) MOZ_OVERRIDE;