Allow Srcs to veto Sinks based on their broad type.
This breaks Sinks down into three auto-detected types:
- GPU: anything that requests to be run in the GPU enclave
- Vector: anything that writes to the stream instead of the bitmap
- Raster: everything else
Some examples: gpu -> GPU, msaa16 -> GPU, 8888 -> raster, pdf -> vector,
svg -> vector, pipe-8888 -> raster, tiles_rt-gpu -> GPU
This lets image decoding sinks veto non-raster backends explicitly,
and can let particular GMs veto GPU or non-GPU sinks as they like.
BUG=skia:
Review URL: https://codereview.chromium.org/1239953004
diff --git a/dm/DMSrcSink.h b/dm/DMSrcSink.h
index b80c7c9..3b180ea 100644
--- a/dm/DMSrcSink.h
+++ b/dm/DMSrcSink.h
@@ -53,6 +53,8 @@
bool fFatal;
};
+enum SinkType { kGPU_SinkType, kVector_SinkType, kRaster_SinkType };
+
struct Src {
// All Srcs must be thread safe.
virtual ~Src() {}
@@ -60,6 +62,7 @@
virtual SkISize size() const = 0;
virtual Name name() const = 0;
virtual void modifyGrContextOptions(GrContextOptions* options) const {}
+ virtual bool veto(SinkType) const { return false; }
};
struct Sink {
@@ -111,6 +114,7 @@
Error draw(SkCanvas*) const override;
SkISize size() const override;
Name name() const override;
+ bool veto(SinkType) const override;
private:
Path fPath;
Mode fMode;
@@ -128,6 +132,7 @@
Error draw(SkCanvas*) const override;
SkISize size() const override;
Name name() const override;
+ bool veto(SinkType) const override;
private:
Path fPath;
const int fDivisor;