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

Unified Diff: src/core/SkBitmapCache.cpp

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 | « src/core/SkBitmapCache.h ('k') | src/core/SkBitmapProcState.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapCache.cpp
diff --git a/src/core/SkBitmapCache.cpp b/src/core/SkBitmapCache.cpp
index 99e2f5c5035f2f73e391b93b8d8c64e772e54629..8de8ab79edac2d8b0224bb3a0e140b81551964cc 100644
--- a/src/core/SkBitmapCache.cpp
+++ b/src/core/SkBitmapCache.cpp
@@ -10,6 +10,10 @@
#include "SkMipMap.h"
#include "SkRect.h"
+SkBitmap::Allocator* SkBitmapCache::GetAllocator() {
+ return SkResourceCache::GetAllocator();
+}
+
/**
This function finds the bounds of the bitmap *within its pixelRef*.
If the bitmap lacks a pixelRef, it will return an empty rect, since
@@ -91,6 +95,7 @@ void SkBitmapCache::Add(const SkBitmap& src, SkScalar invScaleX, SkScalar invSca
// degenerate, and the key we use for mipmaps
return;
}
+ SkASSERT(result.isImmutable());
SkResourceCache::Add(SkNEW_ARGS(BitmapRec, (src.getGenerationID(), invScaleX, invScaleY,
get_bounds_from_bitmap(src), result)));
}
@@ -101,6 +106,7 @@ bool SkBitmapCache::Find(uint32_t genID, int width, int height, SkBitmap* result
}
void SkBitmapCache::Add(uint32_t genID, int width, int height, const SkBitmap& result) {
+ SkASSERT(result.isImmutable());
SkResourceCache::Add(SkNEW_ARGS(BitmapRec, (genID, SK_Scalar1, SK_Scalar1,
SkIRect::MakeWH(width, height), result)));
}
« no previous file with comments | « src/core/SkBitmapCache.h ('k') | src/core/SkBitmapProcState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698