DM::NullSink
Motivation: The null sink can act as a control for experiments.
Review URL: https://codereview.chromium.org/873723007
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 15c1cfa..e162e77 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -221,6 +221,7 @@
SINK("8888", RasterSink, kN32_SkColorType);
SINK("pdf", PDFSink);
SINK("skp", SKPSink);
+ SINK("null", NullSink);
}
#undef SINK
return NULL;
@@ -339,7 +340,8 @@
const char* ext = task->sink->fileExtension();
if (data->getLength()) {
WriteToDisk(*task, md5, ext, data, data->getLength(), NULL);
- } else {
+ SkASSERT(bitmap.drawsNothing());
+ } else if (!bitmap.drawsNothing()) {
WriteToDisk(*task, md5, ext, NULL, 0, &bitmap);
}
}