aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkImageFilter.h
diff options
context:
space:
mode:
authorGravatar brianosman <brianosman@google.com>2016-09-22 07:15:37 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-22 07:15:37 -0700
commit2a75e5df300a2838f943ca52a52a85a5cf69802b (patch)
treeef64ee5043762606de08fde3da60b39777c3bc22 /include/core/SkImageFilter.h
parent4be0e7cfe0efceeaf4c7a4d598d77c27cfd3e69b (diff)
Add output format properties to SkImageFilter::Context
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. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2357273002 Review-Url: https://codereview.chromium.org/2357273002
Diffstat (limited to 'include/core/SkImageFilter.h')
-rw-r--r--include/core/SkImageFilter.h26
1 files changed, 23 insertions, 3 deletions
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
index 97f84dc596..9188a89e27 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
/**