Bug 1477471 - Implement PushLayerWithBlend for DrawTargetTiled. r?jrmuizel
MozReview-Commit-ID: FcJnk5uRYhu
--- 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,