aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkBitmapCache.h
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2014-08-29 10:25:26 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-08-29 10:25:26 -0700
commit14b6aba0997a8b463eae824d770fc5ad1ab89617 (patch)
treeaf4adf0e0f672cb81ef1f2b2101923f1f1af8827 /src/core/SkBitmapCache.h
parentb2f94d1f4a74f82ea4dd3feb1690ef6d05892afb (diff)
harden requirements on SkBitmapCache
BUG=skia: R=humper@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/521433002
Diffstat (limited to 'src/core/SkBitmapCache.h')
-rw-r--r--src/core/SkBitmapCache.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/core/SkBitmapCache.h b/src/core/SkBitmapCache.h
index 2b2dfbbea4..74e8546353 100644
--- a/src/core/SkBitmapCache.h
+++ b/src/core/SkBitmapCache.h
@@ -9,17 +9,26 @@
#define SkBitmapCache_DEFINED
#include "SkScalar.h"
+#include "SkBitmap.h"
-class SkBitmap;
class SkMipMap;
class SkBitmapCache {
public:
/**
+ * Use this allocator for bitmaps, so they can use ashmem when available.
+ */
+ static SkBitmap::Allocator* GetAllocator();
+
+ /**
* Search based on the src bitmap and inverse scales in X and Y. If found, returns true and
* result will be set to the matching bitmap with its pixels already locked.
*/
static bool Find(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY, SkBitmap* result);
+
+ /*
+ * result must be marked isImmutable()
+ */
static void Add(const SkBitmap& src, SkScalar invScaleX, SkScalar invScaleY,
const SkBitmap& result);
@@ -28,6 +37,10 @@ public:
* result will be set to the matching bitmap with its pixels already locked.
*/
static bool Find(uint32_t genID, int width, int height, SkBitmap* result);
+
+ /*
+ * result must be marked isImmutable()
+ */
static void Add(uint32_t genID, int width, int height, const SkBitmap& result);
};