Index: dm/DMSrcSink.h |
diff --git a/dm/DMSrcSink.h b/dm/DMSrcSink.h |
index 3a7d4ee516cfa7ccb87e9a0e9c7cfbe3c7d19634..b251762b9aadd0880e5e52e62e65fa045c24b6e9 100644 |
--- a/dm/DMSrcSink.h |
+++ b/dm/DMSrcSink.h |
@@ -20,6 +20,10 @@ |
namespace DM { |
+// Return the extension of the provided SkString. Returns a pointer into the SkString's |
+// data, so its lifetime is the same as the SkString. |
+const char* SkStringExtension(const SkString&); |
+ |
// This is just convenience. It lets you use either return "foo" or return SkStringPrintf(...). |
struct ImplicitString : public SkString { |
template <typename T> |
@@ -58,6 +62,14 @@ struct SinkFlags { |
enum { kDirect, kIndirect } approach; |
}; |
+enum { kAnyThread_Enclave, |
+ kGPU_Enclave, |
+#ifdef SK_CODEC_DECODES_RAW |
+ kRAW_Enclave, |
+#endif |
+ kNumEnclaves, |
+ }; |
+ |
struct Src { |
// All Srcs must be thread safe. |
virtual ~Src() {} |
@@ -66,6 +78,8 @@ struct Src { |
virtual Name name() const = 0; |
virtual void modifyGrContextOptions(GrContextOptions* options) const {} |
virtual bool veto(SinkFlags) const { return false; } |
+ // If not kAnyThread_Enclave, overrides the Sink's enclave |
+ virtual int enclave() const { return kAnyThread_Enclave; } |
}; |
struct Sink { |
@@ -82,9 +96,6 @@ struct Sink { |
virtual SinkFlags flags() const = 0; |
}; |
-enum { kAnyThread_Enclave, kGPU_Enclave }; |
-static const int kNumEnclaves = kGPU_Enclave + 1; |
- |
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ |
class GMSrc : public Src { |
@@ -124,12 +135,14 @@ public: |
SkISize size() const override; |
Name name() const override; |
bool veto(SinkFlags) const override; |
+ int enclave() const override { return fEnclave; } |
private: |
Path fPath; |
Mode fMode; |
DstColorType fDstColorType; |
SkAlphaType fDstAlphaType; |
float fScale; |
+ int fEnclave; |
}; |
class AndroidCodecSrc : public Src { |
@@ -147,12 +160,14 @@ public: |
SkISize size() const override; |
Name name() const override; |
bool veto(SinkFlags) const override; |
+ int enclave() const override { return fEnclave; } |
private: |
Path fPath; |
Mode fMode; |
CodecSrc::DstColorType fDstColorType; |
SkAlphaType fDstAlphaType; |
int fSampleSize; |
+ int fEnclave; |
}; |
// Allows for testing of various implementations of Android's BitmapRegionDecoder |