Chromium Code Reviews| Index: include/core/SkImageFilter.h |
| diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h |
| index 64e1581373d0c6eeb0a3b9e2ed1e4ee4d0d991ea..9f842eaea007ec8eaafcf38c0a1d2c76113f2447 100644 |
| --- a/include/core/SkImageFilter.h |
| +++ b/include/core/SkImageFilter.h |
| @@ -44,18 +44,43 @@ public: |
| virtual void purge() {} |
| }; |
| + enum SizeConstraint { |
| + kExact_SizeConstraint, |
| + kApprox_SizeConstraint, |
| + }; |
| + |
| class Context { |
| public: |
| - Context(const SkMatrix& ctm, const SkIRect& clipBounds, Cache* cache) : |
| - fCTM(ctm), fClipBounds(clipBounds), fCache(cache) { |
| - } |
| + Context(const SkMatrix& ctm, const SkIRect& clipBounds, Cache* cache, |
| + SizeConstraint constraint) |
| + : fCTM(ctm) |
| + , fClipBounds(clipBounds) |
| + , fCache(cache) |
| + , fSizeConstraint(constraint) |
| + {} |
| + Context(const Context& src, SizeConstraint constraint) |
|
Stephen White
2015/10/22 15:25:04
This is a convenience for two call sites. I'd pref
reed1
2015/10/22 16:24:55
Done.
|
| + : fCTM(src.fCTM) |
| + , fClipBounds(src.fClipBounds) |
| + , fCache(src.fCache) |
| + , fSizeConstraint(constraint) |
| + {} |
| + Context(const Context& src, const SkMatrix& ctm) |
|
Stephen White
2015/10/22 15:25:04
Same here.
reed1
2015/10/22 16:24:55
Done.
|
| + : fCTM(ctm) |
| + , fClipBounds(src.fClipBounds) |
| + , fCache(src.fCache) |
| + , fSizeConstraint(src.fSizeConstraint) |
| + {} |
| + |
| const SkMatrix& ctm() const { return fCTM; } |
| const SkIRect& clipBounds() const { return fClipBounds; } |
| Cache* cache() const { return fCache; } |
| + SizeConstraint sizeConstraint() const { return fSizeConstraint; } |
| + |
| private: |
| - SkMatrix fCTM; |
| - SkIRect fClipBounds; |
| - Cache* fCache; |
| + SkMatrix fCTM; |
| + SkIRect fClipBounds; |
| + Cache* fCache; |
| + SizeConstraint fSizeConstraint; |
| }; |
| class CropRect { |
| @@ -255,7 +280,7 @@ public: |
| // Otherwise, the filter will be processed in software and |
| // uploaded to the GPU. |
| bool filterInputGPU(int index, SkImageFilter::Proxy* proxy, const SkBitmap& src, const Context&, |
| - SkBitmap* result, SkIPoint* offset) const; |
| + SkBitmap* result, SkIPoint* offset, bool relaxSizeConstraint = true) const; |
| #endif |
| SK_TO_STRING_PUREVIRT() |
| @@ -345,7 +370,7 @@ protected: |
| // calls filterImage() on that input, and returns true on success. |
| // i.e., return !getInput(index) || getInput(index)->filterImage(...); |
| bool filterInput(int index, Proxy*, const SkBitmap& src, const Context&, |
| - SkBitmap* result, SkIPoint* offset) const; |
| + SkBitmap* result, SkIPoint* offset, bool relaxSizeConstraint = true) const; |
| /** |
| * Return true (and return a ref'd colorfilter) if this node in the DAG is just a |