Index: src/utils/SkPaintFilterCanvas.cpp |
diff --git a/src/utils/SkPaintFilterCanvas.cpp b/src/utils/SkPaintFilterCanvas.cpp |
index 0ff6ae04d1f43de051c7c511d53c3e8bac62873e..dff1514acbfc7fb3f959ac63b8bfd2efb191c99b 100644 |
--- a/src/utils/SkPaintFilterCanvas.cpp |
+++ b/src/utils/SkPaintFilterCanvas.cpp |
@@ -30,6 +30,18 @@ private: |
SkPaintFilterCanvas::SkPaintFilterCanvas(int width, int height) : INHERITED(width, height) { } |
+SkPaintFilterCanvas::SkPaintFilterCanvas(SkCanvas *canvas) |
+ : INHERITED(canvas->imageInfo().width(), canvas->imageInfo().height()) { |
+ |
+ // Transfer matrix & clip state before adding the target canvas. |
+ SkIRect devClip; |
+ canvas->getClipDeviceBounds(&devClip); |
+ this->clipRect(SkRect::Make(devClip)); |
+ this->setMatrix(canvas->getTotalMatrix()); |
+ |
+ this->addCanvas(canvas); |
+} |
+ |
void SkPaintFilterCanvas::onDrawPaint(const SkPaint& paint) { |
AutoPaintFilter apf(this, kPaint_Type, paint); |
this->INHERITED::onDrawPaint(*apf.paint()); |