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

Unified Diff: src/core/SkLiteDL.cpp

Issue 2315283002: SkLiteDL: drawAsLayer() (Closed)
Patch Set: Created 4 years, 3 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
« src/core/SkLiteDL.h ('K') | « src/core/SkLiteDL.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
+}
« src/core/SkLiteDL.h ('K') | « src/core/SkLiteDL.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698