Index: src/core/SkLiteDL.cpp |
diff --git a/src/core/SkLiteDL.cpp b/src/core/SkLiteDL.cpp |
index 8c8abb1cc3232e37ff5d71983e88c734b3cccc11..98315f566b2e17122d0ec4c41c77aa5b4b77afdb 100644 |
--- a/src/core/SkLiteDL.cpp |
+++ b/src/core/SkLiteDL.cpp |
@@ -6,6 +6,7 @@ |
*/ |
#include "SkCanvas.h" |
+#include "SkColorFilter.h" |
#include "SkData.h" |
#include "SkDrawFilter.h" |
#include "SkImageFilter.h" |
@@ -14,6 +15,7 @@ |
#include "SkPicture.h" |
#include "SkRSXform.h" |
#include "SkTextBlob.h" |
+#include "SkXfermode.h" |
#ifndef SKLITEDL_PAGE |
#define SKLITEDL_PAGE 4096 |
@@ -816,3 +818,23 @@ void SkLiteDL::reset(SkRect bounds) { |
fUsed = 0; |
fBounds = bounds; |
} |
+ |
+void SkLiteDL::drawAsLayer(SkCanvas* c, const SkMatrix* matrix |
+ , SkColorFilter* cf |
+ , SkXfermode* xfer |
+ , U8CPU alpha) { |
+ auto fallback_plan = [&] { |
reed1
2016/09/07 15:29:55
cool way to construct this.
|
+ SkPaint p; |
+ p.setColorFilter(sk_ref_sp(cf)); |
+ p.setXfermode(sk_ref_sp(xfer)); |
+ p.setAlpha(alpha); |
+ SkRect bounds = this->getBounds(); |
+ c->saveLayer(&bounds, &p); |
+ this->draw(c, matrix); |
+ c->restore(); |
+ }; |
+ |
+ // TODO: single-draw specializations |
+ |
+ return fallback_plan(); |
+} |