Index: include/core/SkImageFilter.h |
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h |
index 97f84dc596720a2176869b1e97a63adfcb3c41c1..9188a89e274fd0792ab4f130b6118a21cd51363f 100644 |
--- a/include/core/SkImageFilter.h |
+++ b/include/core/SkImageFilter.h |
@@ -34,22 +34,42 @@ struct SkImageFilterCacheKey; |
*/ |
class SK_API SkImageFilter : public SkFlattenable { |
public: |
+ // Extra information about the output of a filter DAG. For now, this is just the color space |
+ // (of the original requesting device). This is used when constructing intermediate rendering |
+ // surfaces, so that we ensure we land in a surface that's similar/compatible to the final |
+ // consumer of the DAG's output. |
+ class OutputProperties { |
+ public: |
+ explicit OutputProperties(SkColorSpace* colorSpace) : fColorSpace(colorSpace) {} |
+ |
+ SkColorSpace* colorSpace() const { return fColorSpace; } |
+ |
+ private: |
+ // This will be a pointer to the device's color space, and our lifetime is bounded by |
+ // the device, so we can store a bare pointer. |
+ SkColorSpace* fColorSpace; |
+ }; |
+ |
class Context { |
public: |
- Context(const SkMatrix& ctm, const SkIRect& clipBounds, SkImageFilterCache* cache) |
+ Context(const SkMatrix& ctm, const SkIRect& clipBounds, SkImageFilterCache* cache, |
+ const OutputProperties& outputProperties) |
: fCTM(ctm) |
, fClipBounds(clipBounds) |
, fCache(cache) |
+ , fOutputProperties(outputProperties) |
{} |
const SkMatrix& ctm() const { return fCTM; } |
const SkIRect& clipBounds() const { return fClipBounds; } |
SkImageFilterCache* cache() const { return fCache; } |
+ const OutputProperties& outputProperties() const { return fOutputProperties; } |
private: |
SkMatrix fCTM; |
SkIRect fClipBounds; |
SkImageFilterCache* fCache; |
+ OutputProperties fOutputProperties; |
}; |
class CropRect { |
@@ -130,10 +150,10 @@ public: |
MapDirection = kReverse_MapDirection) const; |
#if SK_SUPPORT_GPU |
- static sk_sp<SkSpecialImage> DrawWithFP(GrContext* context, |
+ static sk_sp<SkSpecialImage> DrawWithFP(GrContext* context, |
sk_sp<GrFragmentProcessor> fp, |
const SkIRect& bounds, |
- sk_sp<SkColorSpace> colorSpace); |
+ const OutputProperties& outputProperties); |
#endif |
/** |