aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkImageCacherator.cpp
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-03-24 17:00:17 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-24 21:40:33 +0000
commit9f4b0ae91e1875831cc11f0629b5db998ad85438 (patch)
treee7a969b5942bd5fac625403202f1f258d07a5bbf /src/core/SkImageCacherator.cpp
parent37b1d84436ccfbeafc2b321e469c462a2cfd4765 (diff)
simplify api to bitmapcache
Force all Find callers to make a bitmpacachedesc, which now has more rigid validation. Goal is to ensure we never make two desc (which turn into keys) that look different but represent the same image/transformation. BUG=skia: Change-Id: I8571837ee4754a69acc99e949bee9a465fa25f2b Reviewed-on: https://skia-review.googlesource.com/10114 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/core/SkImageCacherator.cpp')
-rw-r--r--src/core/SkImageCacherator.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index f0bc9973a6..06d2279946 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -180,7 +180,8 @@ bool SkImageCacherator::directGeneratePixels(const SkImageInfo& info, void* pixe
bool SkImageCacherator::lockAsBitmapOnlyIfAlreadyCached(SkBitmap* bitmap, CachedFormat format) {
return kNeedNewImageUniqueID != fUniqueIDs[format] &&
- SkBitmapCache::Find(fUniqueIDs[format], bitmap) &&
+ SkBitmapCache::Find(SkBitmapCacheDesc::Make(fUniqueIDs[format],
+ fInfo.width(), fInfo.height()), bitmap) &&
check_output_bitmap(*bitmap, fUniqueIDs[format]);
}
@@ -199,7 +200,8 @@ bool SkImageCacherator::tryLockAsBitmap(SkBitmap* bitmap, const SkImage* client,
}
bitmap->pixelRef()->setImmutableWithID(fUniqueIDs[format]);
if (SkImage::kAllow_CachingHint == chint) {
- SkBitmapCache::Add(fUniqueIDs[format], *bitmap);
+ SkBitmapCache::Add(SkBitmapCacheDesc::Make(fUniqueIDs[format],
+ fInfo.width(), fInfo.height()), *bitmap);
if (client) {
as_IB(client)->notifyAddedToCache();
}
@@ -259,7 +261,8 @@ bool SkImageCacherator::lockAsBitmap(GrContext* context, SkBitmap* bitmap, const
bitmap->pixelRef()->setImmutableWithID(fUniqueIDs[format]);
if (SkImage::kAllow_CachingHint == chint) {
- SkBitmapCache::Add(fUniqueIDs[format], *bitmap);
+ SkBitmapCache::Add(SkBitmapCacheDesc::Make(fUniqueIDs[format],
+ fInfo.width(), fInfo.height()), *bitmap);
if (client) {
as_IB(client)->notifyAddedToCache();
}