DM: track a direct/indirect bit for each Sink too.
The decoding tests can now veto indirect sinks like pipe-8888.
This moves Sink type detection from automatic to explicit; I can't think of any
way to automatically differentiate pipe-8888 from 8888 based only on the
output. (They should ideally be identical, after all.)
BUG=skia:4138
Review URL: https://codereview.chromium.org/1263113002
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 0cd2ac9..d1d9be0 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -71,11 +71,12 @@
, fScale(scale)
{}
-bool CodecSrc::veto(SinkType type) const {
- // No need to test decoding to non-raster backend.
+bool CodecSrc::veto(SinkFlags flags) const {
+ // No need to test decoding to non-raster or indirect backend.
// TODO: Once we implement GPU paths (e.g. JPEG YUV), we should use a deferred decode to
// let the GPU handle it.
- return type != kRaster_SinkType;
+ return flags.type != SinkFlags::kRaster
+ || flags.approach != SinkFlags::kDirect;
}
Error CodecSrc::draw(SkCanvas* canvas) const {
@@ -460,10 +461,11 @@
ImageSrc::ImageSrc(Path path, int divisor) : fPath(path), fDivisor(divisor) {}
-bool ImageSrc::veto(SinkType type) const {
- // No need to test decoding to non-raster backend.
+bool ImageSrc::veto(SinkFlags flags) const {
+ // No need to test decoding to non-raster or indirect backend.
// TODO: Instead, use lazy decoding to allow the GPU to handle cases like YUV.
- return type != kRaster_SinkType;
+ return flags.type != SinkFlags::kRaster
+ || flags.approach != SinkFlags::kDirect;
}
Error ImageSrc::draw(SkCanvas* canvas) const {