Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Unified Diff: src/utils/SkPaintFilterCanvas.cpp

Issue 1294013002: SkPaintFilterCanvas should inherit the target canvas state (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: cleanup Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/utils/SkPaintFilterCanvas.h ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « include/utils/SkPaintFilterCanvas.h ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698