Bug 1477471 - Implement PushLayerWithBlend for DrawTargetTiled. r?jrmuizel draft
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 24 Jul 2018 13:57:17 -0400
changeset 822080 7f09e8f2bf177030741bf8cffc0ff8df1d23c1f2
parent 822009 cb59a65fb720ee100bb03cc9f4b02e645755786b
child 822081 e0ef3576bf8b08be997e7555f5d58c9fc422e7ff
push id117281
push userkgupta@mozilla.com
push dateTue, 24 Jul 2018 18:02:37 +0000
reviewersjrmuizel
bugs1477471
milestone63.0a1
Bug 1477471 - Implement PushLayerWithBlend for DrawTargetTiled. r?jrmuizel MozReview-Commit-ID: FcJnk5uRYhu
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,