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

Unified Diff: src/core/SkImageCacherator.cpp

Issue 1351453004: use allocator (if present) when we allocate our cache bitmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fission out test change to separate CL Created 5 years, 3 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 | « include/core/SkImageGenerator.h ('k') | src/core/SkImageGenerator.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageCacherator.cpp
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index f5ec5e34771e002b3463d499a379d7d62bbfad6b..91e342a79b441925ce0c731f16dc2deddef8cc98 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -11,6 +11,7 @@
#include "SkMallocPixelRef.h"
#include "SkNextID.h"
#include "SkPixelRef.h"
+#include "SkResourceCache.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
@@ -82,18 +83,20 @@ static bool check_output_bitmap(const SkBitmap& bitmap, uint32_t expectedID) {
// If you want the immutable bitmap with the same ID as our cacherator, call tryLockAsBitmap()
//
bool SkImageCacherator::generateBitmap(SkBitmap* bitmap) {
+ SkBitmap::Allocator* allocator = SkResourceCache::GetAllocator();
+
ScopedGenerator generator(this);
const SkImageInfo& genInfo = generator->getInfo();
if (fInfo.dimensions() == genInfo.dimensions()) {
SkASSERT(fOrigin.x() == 0 && fOrigin.y() == 0);
// fast-case, no copy needed
- return generator->tryGenerateBitmap(bitmap, fInfo);
+ return generator->tryGenerateBitmap(bitmap, fInfo, allocator);
} else {
// need to handle subsetting, so we first generate the full size version, and then
// "read" from it to get our subset. See skbug.com/4213
SkBitmap full;
- if (!generator->tryGenerateBitmap(&full, genInfo)) {
+ if (!generator->tryGenerateBitmap(&full, genInfo, allocator)) {
return false;
}
if (!bitmap->tryAllocPixels(fInfo, nullptr, full.getColorTable())) {
« no previous file with comments | « include/core/SkImageGenerator.h ('k') | src/core/SkImageGenerator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698