aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2016-01-06 14:20:29 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-06 14:20:30 -0800
commit6eb4e36a93ea695e7adb771ea9ac3326680a8e98 (patch)
tree1eb1728fbd5b6d1c1298f30e99a9ddeb91c67aab /dm
parent85c8d06540942531fe3440fafa2a2825f128251a (diff)
DM: add a pixel check to serialize
If we're running through serialize and then drawing into some raster target (e.g. serialize-8888 like we run on the bots), make sure the serialized version is identical to what we'd get if we just drew into the rest of the pipeline (i.e. 8888). Start by blacklisting all current failures. This at least prevents further regression. BUG=skia:4095 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1561993003 Review URL: https://codereview.chromium.org/1561993003
Diffstat (limited to 'dm')
-rw-r--r--dm/DMSrcSink.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index fa600ff4eb..82962ff692 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 "";
});
}