Index: dm/DMSrcSink.cpp |
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp |
index fa600ff4eb33bc07ba22c6d0eebe46e435085b52..82962ff6920e873eb54ea6c7751e88368557ef19 100644 |
--- a/dm/DMSrcSink.cpp |
+++ b/dm/DMSrcSink.cpp |
@@ -1084,6 +1084,15 @@ Error ViaRemote::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStr |
Error ViaSerialization::draw( |
const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) const { |
+ // Draw the Src directly as a reference. |
+ SkBitmap reference; |
+ if (bitmap) { |
+ Error err = fSink->draw(src, &reference, nullptr, log); |
+ if (!err.isEmpty()) { |
+ return err; |
+ } |
+ } |
+ |
// Record our Src into a picture. |
auto size = src.size(); |
SkPictureRecorder recorder; |
@@ -1102,6 +1111,15 @@ Error ViaSerialization::draw( |
return draw_to_canvas(fSink, bitmap, stream, log, size, [&](SkCanvas* canvas) { |
canvas->drawPicture(deserialized); |
+ // Check against the reference if we have one. |
+ if (bitmap) { |
+ if (reference.getSize() != bitmap->getSize()) { |
+ return "Serialized and direct have different dimensions."; |
+ } |
+ if (0 != memcmp(reference.getPixels(), bitmap->getPixels(), reference.getSize())) { |
+ return "Serialized and direct have different pixels."; |
+ } |
+ } |
return ""; |
}); |
} |