Chromium Code Reviews| Index: include/core/SkImageFilter.h |
| diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h |
| index cd34ba3f91bd55664c05ce46a6e268003e22ba8f..c108ae3643fd65b990194f38af1b711ecd3a92c8 100644 |
| --- a/include/core/SkImageFilter.h |
| +++ b/include/core/SkImageFilter.h |
| @@ -61,18 +61,28 @@ public: |
| virtual void remove(const SkImageFilter* key) = 0; |
| }; |
| + class GenIDCache : public SkRefCnt { |
|
bsalomon
2014/07/25 14:11:58
This guy could probably use a comment about what i
Stephen White
2014/07/25 17:34:17
Done. BTW, the name is temporary -- my plan is tha
|
| + public: |
| + struct Key; |
| + virtual ~GenIDCache() {} |
| + static GenIDCache* Create(size_t maxBytes); |
| + static GenIDCache* Get(); |
| + virtual bool get(const Key& key, SkBitmap* result, SkIPoint* offset) const = 0; |
| + virtual void set(const Key& key, const SkBitmap& result, const SkIPoint& offset) = 0; |
| + }; |
| + |
| class Context { |
| public: |
| - Context(const SkMatrix& ctm, const SkIRect& clipBounds, Cache* cache) : |
| + Context(const SkMatrix& ctm, const SkIRect& clipBounds, GenIDCache* cache) : |
| fCTM(ctm), fClipBounds(clipBounds), fCache(cache) { |
| } |
| const SkMatrix& ctm() const { return fCTM; } |
| const SkIRect& clipBounds() const { return fClipBounds; } |
| - Cache* cache() const { return fCache; } |
| + GenIDCache* cache() const { return fCache; } |
| private: |
| SkMatrix fCTM; |
| SkIRect fClipBounds; |
| - Cache* fCache; |
| + GenIDCache* fCache; |
| }; |
| class Proxy { |
| @@ -210,6 +220,7 @@ protected: |
| CropRect cropRect() const { return fCropRect; } |
| int inputCount() const { return fInputs.count(); } |
| SkImageFilter** inputs() const { return fInputs.get(); } |
| + uint32_t generationID() const { return fGenerationID; } |
| // If the caller wants a copy of the inputs, call this and it will transfer ownership |
| // of the unflattened input filters to the caller. This is just a short-cut for copying |
| @@ -221,6 +232,7 @@ protected: |
| CropRect fCropRect; |
| // most filters accept at most 2 input-filters |
| SkAutoSTArray<2, SkImageFilter*> fInputs; |
| + uint32_t fGenerationID; |
| void allocInputs(int count); |
| }; |
| @@ -308,10 +320,14 @@ protected: |
| const SkIRect& bounds) const; |
| private: |
| + bool usesSrcInput() const { return fUsesSrcInput; } |
| + |
| typedef SkFlattenable INHERITED; |
| int fInputCount; |
| SkImageFilter** fInputs; |
| + bool fUsesSrcInput; |
| CropRect fCropRect; |
| + uint32_t fGenerationID; // Globally unique |
|
bsalomon
2014/07/25 14:11:58
Is this assigned at creation and then never change
Stephen White
2014/07/25 17:34:17
Done.
|
| }; |
| #endif |