Index: dm/DMSrcSink.cpp |
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp |
index c3c8a7bc6e9b6a4bfd5c2298fc626c7cce25153f..6b330231d23622ef020c95ecee0ed41e862b52c2 100644 |
--- a/dm/DMSrcSink.cpp |
+++ b/dm/DMSrcSink.cpp |
@@ -30,6 +30,7 @@ |
#include "SkOpts.h" |
#include "SkPictureData.h" |
#include "SkPictureRecorder.h" |
+#include "SkPipe.h" |
#include "SkRandom.h" |
#include "SkRecordDraw.h" |
#include "SkRecorder.h" |
@@ -1241,6 +1242,15 @@ Error XPSSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const |
} |
return draw_skdocument(src, doc.get(), dst); |
} |
+ |
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ |
+ |
+PipeSink::PipeSink() {} |
+ |
+Error PipeSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const { |
+ return src.draw(SkPipeSerializer().beginWrite(SkRect::Make(src.size()), dst)); |
+} |
+ |
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ |
SKPSink::SKPSink() {} |
@@ -1511,6 +1521,22 @@ Error ViaDefer::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStri |
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ |
+Error ViaPipe::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) const { |
+ auto size = src.size(); |
+ return draw_to_canvas(fSink, bitmap, stream, log, size, [&](SkCanvas* canvas) -> Error { |
+ SkDynamicMemoryWStream tmpStream; |
+ Error err = src.draw(SkPipeSerializer().beginWrite(SkRect::Make(size), &tmpStream)); |
+ if (!err.isEmpty()) { |
+ return err; |
+ } |
+ sk_sp<SkData> data = tmpStream.detachAsData(); |
+ SkPipeDeserializer().playback(data->data(), data->size(), canvas); |
+ return check_against_reference(bitmap, src, fSink); |
+ }); |
+} |
+ |
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ |
+ |
// Draw the Src into two pictures, then draw the second picture into the wrapped Sink. |
// This tests that any shortcuts we may take while recording that second picture are legal. |
Error ViaSecondPicture::draw( |