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

Unified Diff: dm/DMSrcSink.cpp

Issue 1360943003: simplify code in SkRecords.h (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: another SaveLayer Created 5 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
« no previous file with comments | « no previous file | include/private/SkRecords.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMSrcSink.cpp
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index e5faed7da1ebc93632c65f4a062506bc66d4b5e0..25b5f7b4609c615ee4973c5da44eaa6e83a49fd9 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -24,10 +24,11 @@
#include "SkRecordDraw.h"
#include "SkRecorder.h"
#include "SkSVGCanvas.h"
+#include "SkScaledCodec.h"
#include "SkScanlineDecoder.h"
#include "SkStream.h"
+#include "SkTLogic.h"
#include "SkXMLWriter.h"
-#include "SkScaledCodec.h"
DEFINE_bool(multiPage, false, "For document-type backends, render the source"
" into multiple pages");
@@ -1212,8 +1213,6 @@ struct DrawsAsSingletonPictures {
SkCanvas* fCanvas;
const SkDrawableList& fDrawables;
- SK_CREATE_MEMBER_DETECTOR(paint);
-
template <typename T>
void draw(const T& op, SkCanvas* canvas) {
// We must pass SkMatrix::I() as our initial matrix.
@@ -1223,20 +1222,20 @@ struct DrawsAsSingletonPictures {
d(op);
}
- // Most things that have paints are Draw-type ops. Create sub-pictures for each.
+ // Draws get their own picture.
template <typename T>
- SK_WHEN(HasMember_paint<T>, void) operator()(const T& op) {
+ SK_WHEN(T::kTags & SkRecords::kDraw_Tag, void) operator()(const T& op) {
SkPictureRecorder rec;
this->draw(op, rec.beginRecording(SkRect::MakeLargest()));
SkAutoTUnref<SkPicture> pic(rec.endRecordingAsPicture());
fCanvas->drawPicture(pic);
}
- // If you don't have a paint or are a SaveLayer, you're not a Draw-type op.
- // We cannot make subpictures out of these because they affect state. Draw them directly.
+ // We'll just issue non-draws directly.
template <typename T>
- SK_WHEN(!HasMember_paint<T>, void) operator()(const T& op) { this->draw(op, fCanvas); }
- void operator()(const SkRecords::SaveLayer& op) { this->draw(op, fCanvas); }
+ skstd::enable_if_t<!(T::kTags & SkRecords::kDraw_Tag), void> operator()(const T& op) {
+ this->draw(op, fCanvas);
+ }
};
// Record Src into a picture, then record it into a macro picture with a sub-picture for each draw.
« no previous file with comments | « no previous file | include/private/SkRecords.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698