DM::NullSink
Motivation: The null sink can act as a control for experiments. Review URL: https://codereview.chromium.org/873723007
This commit is contained in:
parent
23b03c3c5a
commit
022afb8384
@ -221,6 +221,7 @@ static Sink* create_sink(const char* tag) {
|
||||
SINK("8888", RasterSink, kN32_SkColorType);
|
||||
SINK("pdf", PDFSink);
|
||||
SINK("skp", SKPSink);
|
||||
SINK("null", NullSink);
|
||||
}
|
||||
#undef SINK
|
||||
return NULL;
|
||||
@ -339,7 +340,8 @@ struct Task {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -75,6 +75,7 @@ void JsonWriter::DumpJson() {
|
||||
}
|
||||
|
||||
SkString path = SkOSPath::Join(FLAGS_writePath[0], "dm.json");
|
||||
sk_mkdir(FLAGS_writePath[0]);
|
||||
SkFILEWStream stream(path.c_str());
|
||||
stream.writeText(Json::StyledWriter().write(root).c_str());
|
||||
stream.flush();
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "SkCanvas.h"
|
||||
#include "SkData.h"
|
||||
#include "SkGPipe.h"
|
||||
#include "SkNullCanvas.h"
|
||||
#include "SkPicture.h"
|
||||
#include "gm.h"
|
||||
|
||||
@ -175,6 +176,15 @@ private:
|
||||
SkAutoTDelete<Sink> fSink;
|
||||
};
|
||||
|
||||
class NullSink : public Sink {
|
||||
public:
|
||||
Error draw(const Src& src, SkBitmap*, SkWStream* out) const SK_OVERRIDE {
|
||||
return src.draw(SkCreateNullCanvas());
|
||||
}
|
||||
int enclave() const SK_OVERRIDE { return kAnyThread_Enclave; }
|
||||
const char* fileExtension() const SK_OVERRIDE { return ""; }
|
||||
};
|
||||
|
||||
} // namespace DM
|
||||
|
||||
#endif//DMSrcSink_DEFINED
|
||||
|
Loading…
Reference in New Issue
Block a user