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

Unified Diff: dm/DMSrcSink.cpp

Issue 1129693003: Do we still need this DOUBLE_LOOP feature? (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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 | « dm/DMSrcSink.h ('k') | no next file » | 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 840936c894b29d7742fee8d9b07e30b06b72bc74..79b791979fc0a85f9dc774c82a820aacccf7fc5e 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -288,19 +288,7 @@ Error SKPSrc::draw(SkCanvas* canvas) const {
stream.reset((SkStream*)NULL); // Might as well drop this when we're done with it.
canvas->clipRect(kSKPViewport);
- // Testing TextBlob batching requires that we see individual text blobs more than once
- // TODO remove this and add a flag to DM so we can run skps multiple times
-//#define DOUBLE_LOOP
-#ifdef DOUBLE_LOOP
- {
- SkAutoCanvasRestore acr(canvas, true);
-#endif
- canvas->drawPicture(pic);
-#ifdef DOUBLE_LOOP
- }
- canvas->clear(0);
canvas->drawPicture(pic);
-#endif
return "";
}
@@ -720,6 +708,23 @@ Error ViaSecondPicture::draw(
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+// Draw the Src twice. This can help exercise caching.
+Error ViaTwice::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) const {
+ return draw_to_canvas(fSink, bitmap, stream, log, src.size(), [&](SkCanvas* canvas) -> Error {
+ for (int i = 0; i < 2; i++) {
+ SkAutoCanvasRestore acr(canvas, true/*save now*/);
+ canvas->clear(SK_ColorTRANSPARENT);
+ Error err = src.draw(canvas);
+ if (err.isEmpty()) {
+ return err;
+ }
+ }
+ return "";
+ });
+}
+
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
// This is like SkRecords::Draw, in that it plays back SkRecords ops into a Canvas.
// Unlike SkRecords::Draw, it builds a single-op sub-picture out of each Draw-type op.
// This is an only-slightly-exaggerated simluation of Blink's Slimming Paint pictures.
« no previous file with comments | « dm/DMSrcSink.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698