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. |