Bug 1477471 - Implement PushLayerWithBlend for DrawTargetTiled. r=jrmuizel
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 24 Jul 2018 14:06:23 -0400
changeset 483226 a01697589ad0f23687a5cb67a3ed88b5a8c073e8
parent 483225 c77747cf8e212355be7be3c9d368eee14af431e2
child 483227 dc036d48bba75840d54bd31b57f6d79ec67b4c71
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1477471
milestone63.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 1477471 - Implement PushLayerWithBlend for DrawTargetTiled. r=jrmuizel
gfx/2d/DrawTargetTiled.cpp
gfx/2d/DrawTargetTiled.h
--- a/gfx/2d/DrawTargetTiled.cpp
+++ b/gfx/2d/DrawTargetTiled.cpp
@@ -343,16 +343,39 @@ DrawTargetTiled::PushLayer(bool aOpaque,
   }
 
   PushedLayer layer(GetPermitSubpixelAA());
   mPushedLayers.push_back(layer);
   SetPermitSubpixelAA(aOpaque);
 }
 
 void
+DrawTargetTiled::PushLayerWithBlend(bool aOpaque, Float aOpacity,
+                                    SourceSurface* aMask,
+                                    const Matrix& aMaskTransform,
+                                    const IntRect& aBounds,
+                                    bool aCopyBackground,
+                                    CompositionOp aOp)
+{
+  // XXX - not sure this is what we want or whether we want to continue drawing to a larger
+  // intermediate surface, that would require tweaking the code in here a little though.
+  for (size_t i = 0; i < mTiles.size(); i++) {
+    if (!mTiles[i].mClippedOut) {
+      IntRect bounds = aBounds;
+      bounds.MoveBy(-mTiles[i].mTileOrigin);
+      mTiles[i].mDrawTarget->PushLayerWithBlend(aOpaque, aOpacity, aMask, aMaskTransform, bounds, aCopyBackground, aOp);
+    }
+  }
+
+  PushedLayer layer(GetPermitSubpixelAA());
+  mPushedLayers.push_back(layer);
+  SetPermitSubpixelAA(aOpaque);
+}
+
+void
 DrawTargetTiled::PopLayer()
 {
   // XXX - not sure this is what we want or whether we want to continue drawing to a larger
   // intermediate surface, that would require tweaking the code in here a little though.
   for (size_t i = 0; i < mTiles.size(); i++) {
     if (!mTiles[i].mClippedOut) {
       mTiles[i].mDrawTarget->PopLayer();
     }
--- a/gfx/2d/DrawTargetTiled.h
+++ b/gfx/2d/DrawTargetTiled.h
@@ -111,16 +111,22 @@ public:
   virtual void PushClip(const Path *aPath) override;
   virtual void PushClipRect(const Rect &aRect) override;
   virtual void PopClip() override;
   virtual void PushLayer(bool aOpaque, Float aOpacity,
                          SourceSurface* aMask,
                          const Matrix& aMaskTransform,
                          const IntRect& aBounds = IntRect(),
                          bool aCopyBackground = false) override;
+  virtual void PushLayerWithBlend(bool aOpaque, Float aOpacity,
+                         SourceSurface* aMask,
+                         const Matrix& aMaskTransform,
+                         const IntRect& aBounds = IntRect(),
+                         bool aCopyBackground = false,
+                         CompositionOp = CompositionOp::OP_OVER) override;
   virtual void PopLayer() override;
 
 
   virtual void SetTransform(const Matrix &aTransform) override;
 
   virtual void SetPermitSubpixelAA(bool aPermitSubpixelAA) override;
 
   virtual already_AddRefed<SourceSurface> CreateSourceSurfaceFromData(unsigned char *aData,