Chromium Code Reviews| Index: src/core/SkScaledImageCache.h |
| diff --git a/src/core/SkScaledImageCache.h b/src/core/SkScaledImageCache.h |
| index 32474b7f61013943ec6a1bd6ce741d8184f20aa1..14f43b346ff2806f27376465e29f2adab9be96ea 100644 |
| --- a/src/core/SkScaledImageCache.h |
| +++ b/src/core/SkScaledImageCache.h |
| @@ -31,10 +31,21 @@ public: |
| * instance of this cache. |
| */ |
| + static ID* FindAndLock(uint32_t pixelGenerationID, |
| + int32_t width, |
| + int32_t height, |
| + SkBitmap* scaled); |
|
reed1
2013/10/25 18:09:47
rename this last param? (since we're not scaling)
scroggo
2013/10/25 18:09:48
returnedBitmap?
hal.canary
2013/10/25 20:49:38
Done.
hal.canary
2013/10/25 20:49:38
Done.
|
| + |
| static ID* FindAndLock(const SkBitmap& original, SkScalar scaleX, |
| SkScalar scaleY, SkBitmap* scaled); |
| static ID* FindAndLockMip(const SkBitmap& original, SkMipMap const**); |
| + |
| + static ID* AddAndLock(uint32_t pixelGenerationID, |
| + int32_t width, |
| + int32_t height, |
| + const SkBitmap& scaled); |
| + |
| static ID* AddAndLock(const SkBitmap& original, SkScalar scaleX, |
| SkScalar scaleY, const SkBitmap& scaled); |
| static ID* AddAndLockMip(const SkBitmap& original, const SkMipMap*); |
| @@ -51,24 +62,48 @@ public: |
| ~SkScaledImageCache(); |
| /** |
| - * Search the cache for a scaled version of original. If found, return it |
| - * in scaled, and return its ID pointer. Use the returned ptr to unlock |
| - * the cache when you are done using scaled. |
| + * Search the cache for a matching bitmap (using generationID, |
| + * width, and height as a search key). If found, return it in |
| + * returnedBitmap, and return its ID pointer. Use the returned |
| + * ptr to unlock the cache when you are done using |
| + * returnedBitmap. |
| + * |
| + * If a match is not found, returnedBitmap will be unmodifed, and |
| + * NULL will be returned. |
| + * |
| + * This is used if there is no scaling or subsetting, for example |
| + * by SkLazyPixelRef. |
| + */ |
| + ID* findAndLock(uint32_t pixelGenerationID, int32_t width, int32_t height, |
| + SkBitmap* returnedBitmap); |
| + |
| + /** |
| + * Search the cache for a scaled version of original. If found, |
| + * return it in returnedBitmap, and return its ID pointer. Use |
| + * the returned ptr to unlock the cache when you are done using |
| + * returnedBitmap. |
| * |
| - * If a match is not found, scaled will be unmodifed, and NULL will be |
| - * returned. |
| + * If a match is not found, returnedBitmap will be unmodifed, and |
| + * NULL will be returned. |
| */ |
| ID* findAndLock(const SkBitmap& original, SkScalar scaleX, |
| - SkScalar scaleY, SkBitmap* scaled); |
| - ID* findAndLockMip(const SkBitmap& original, SkMipMap const**); |
| + SkScalar scaleY, SkBitmap* returnedBitmap); |
| + ID* findAndLockMip(const SkBitmap& original, |
| + SkMipMap const** returnedMipMap); |
| /** |
| - * To add a new (scaled) bitmap to the cache, call AddAndLock. Use the |
| - * returned ptr to unlock the cache when you are done using scaled. |
| + * To add a new bitmap (or mipMap) to the cache, call |
| + * AddAndLock. Use the returned ptr to unlock the cache when you |
| + * are done using scaled. |
| + * |
| + * Use (generationID, width, and height) or (original, scaleX, |
| + * scaleY) or (original) as a search key |
| */ |
| + ID* addAndLock(uint32_t pixelGenerationID, int32_t width, int32_t height, |
| + const SkBitmap& bitmap); |
| ID* addAndLock(const SkBitmap& original, SkScalar scaleX, |
| - SkScalar scaleY, const SkBitmap& scaled); |
| - ID* addAndLockMip(const SkBitmap& original, const SkMipMap*); |
| + SkScalar scaleY, const SkBitmap& bitmap); |
| + ID* addAndLockMip(const SkBitmap& original, const SkMipMap* mipMap); |
| /** |
| * Given a non-null ID ptr returned by either findAndLock or addAndLock, |
| @@ -101,7 +136,9 @@ private: |
| size_t fByteLimit; |
| int fCount; |
| - Rec* findAndLock(const SkBitmap& original, SkScalar sx, SkScalar sy); |
| + Rec* findAndLock(uint32_t generationID, SkScalar sx, SkScalar sy, |
| + const SkIRect& bounds); |
| + void addAndLock(Rec* rec); |
| void purgeAsNeeded(); |
| @@ -115,5 +152,4 @@ private: |
| void validate() const {} |
| #endif |
| }; |
| - |
| #endif |