aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SkResourceCacheTest.cpp
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2017-03-24 22:09:30 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-24 22:09:40 +0000
commitdd1b4e94c4298213f1f238a8634471086d6749fb (patch)
tree6da125f682710e984ec99bea88073a465f8c9a9a /tests/SkResourceCacheTest.cpp
parent51fe9710465d01823f3bd9ad856f6460a98db130 (diff)
Revert "simplify api to bitmapcache"
This reverts commit 9f4b0ae91e1875831cc11f0629b5db998ad85438. Reason for revert: Nanobench asserts. ../../../src/core/SkBitmapCache.cpp:81: fatal error: "assert(scaledWidth != image->width() || scaledHeight != image->height())" Aborted Command exited with code 134 step returned non-zero exit code: 134 https://chromium-swarm.appspot.com/task?id=351b1d10c7936310&refresh=10 Original change's description: > 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> > TBR=brianosman@google.com,fmalita@chromium.org,reed@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Change-Id: I21b3c8a5bae409ba740cfc28b352c3b970dcf5af Reviewed-on: https://skia-review.googlesource.com/10171 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'tests/SkResourceCacheTest.cpp')
-rw-r--r--tests/SkResourceCacheTest.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/SkResourceCacheTest.cpp b/tests/SkResourceCacheTest.cpp
index b260d89503..542d80efff 100644
--- a/tests/SkResourceCacheTest.cpp
+++ b/tests/SkResourceCacheTest.cpp
@@ -89,8 +89,8 @@ static void test_mipmap_notify(skiatest::Reporter* reporter, SkResourceCache* ca
}
for (int i = 0; i < N; ++i) {
- const auto desc = SkBitmapCacheDesc::Make(src[i]);
- const SkMipMap* mipmap = SkMipMapCache::FindAndRef(desc, colorMode, cache);
+ const SkMipMap* mipmap = SkMipMapCache::FindAndRef(SkBitmapCacheDesc::Make(src[i]),
+ colorMode, cache);
if (cache) {
// if cache is null, we're working on the global cache, and other threads might purge
// it, making this check fragile.
@@ -100,7 +100,7 @@ static void test_mipmap_notify(skiatest::Reporter* reporter, SkResourceCache* ca
src[i].reset(); // delete the underlying pixelref, which *should* remove us from the cache
- mipmap = SkMipMapCache::FindAndRef(desc, colorMode, cache);
+ mipmap = SkMipMapCache::FindAndRef(SkBitmapCacheDesc::Make(src[i]), colorMode, cache);
REPORTER_ASSERT(reporter, !mipmap);
}
}
@@ -156,14 +156,14 @@ static void test_discarded_image(skiatest::Reporter* reporter, const SkMatrix& t
canvas->concat(transform);
canvas->drawImage(image, 0, 0, &paint);
- const auto desc = SkBitmapCacheDesc::Make(image.get());
+ auto imageId = image->uniqueID();
// delete the image
image.reset(nullptr);
// all resources should have been purged
SkBitmap result;
- REPORTER_ASSERT(reporter, !SkBitmapCache::Find(desc, &result));
+ REPORTER_ASSERT(reporter, !SkBitmapCache::Find(imageId, &result));
}
}