Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(616)

Unified Diff: include/core/SkImageFilter.h

Issue 414483003: Implement a persistent uniqueID-based cache for SkImageFilter. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Undo some unnecessary reformatting. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « include/core/SkDevice.h ('k') | include/gpu/SkGpuDevice.h » ('j') | src/core/SkImageFilter.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698