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

Unified Diff: src/core/SkScaledImageCache.h

Issue 37343002: Allow SkLazyPixelRef to use SkScaledImageCache (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: re-upload Created 7 years, 2 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
« no previous file with comments | « gyp/tests.gyp ('k') | src/core/SkScaledImageCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkScaledImageCache.h
diff --git a/src/core/SkScaledImageCache.h b/src/core/SkScaledImageCache.h
index 32474b7f61013943ec6a1bd6ce741d8184f20aa1..fee69d2d58598eb8fee6a7562a45bd2940912e6f 100644
--- a/src/core/SkScaledImageCache.h
+++ b/src/core/SkScaledImageCache.h
@@ -31,13 +31,25 @@ public:
* instance of this cache.
*/
+ static ID* FindAndLock(uint32_t pixelGenerationID,
+ int32_t width,
+ int32_t height,
+ SkBitmap* returnedBitmap);
+
static ID* FindAndLock(const SkBitmap& original, SkScalar scaleX,
- SkScalar scaleY, SkBitmap* scaled);
- static ID* FindAndLockMip(const SkBitmap& original, SkMipMap const**);
+ SkScalar scaleY, SkBitmap* returnedBitmap);
+ static ID* FindAndLockMip(const SkBitmap& original,
+ SkMipMap const** returnedMipMap);
+
+
+ static ID* AddAndLock(uint32_t pixelGenerationID,
+ int32_t width,
+ int32_t height,
+ const SkBitmap& bitmap);
static ID* AddAndLock(const SkBitmap& original, SkScalar scaleX,
- SkScalar scaleY, const SkBitmap& scaled);
- static ID* AddAndLockMip(const SkBitmap& original, const SkMipMap*);
+ SkScalar scaleY, const SkBitmap& bitmap);
+ static ID* AddAndLockMip(const SkBitmap& original, const SkMipMap* mipMap);
static void Unlock(ID*);
@@ -51,24 +63,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 +137,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 +153,4 @@ private:
void validate() const {}
#endif
};
-
#endif
« no previous file with comments | « gyp/tests.gyp ('k') | src/core/SkScaledImageCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698