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

Unified Diff: src/utils/SkPaintFilterCanvas.cpp

Issue 1302173002: [M45] SkPaintFilterCanvas should inherit the target canvas state (Closed) Base URL: https://chromium.googlesource.com/skia.git@m45
Patch Set: 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 1abebef8cad5e517da186c9dc945d7ed22a15a3f..98c89addb52b0a8f913347ea67213bd5b1c67c08 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