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

Unified Diff: src/core/SkBitmapCache.h

Issue 521433002: harden requirements on SkBitmapCache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 | « no previous file | src/core/SkBitmapCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapCache.h
diff --git a/src/core/SkBitmapCache.h b/src/core/SkBitmapCache.h
index 2b2dfbbea44060d51791156f9819c330835a5645..74e854635313c6ccb2dce4cd36132b9459f7cb0c 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);
};
« no previous file with comments | « no previous file | src/core/SkBitmapCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698