aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ImageTest.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 /tests/ImageTest.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 'tests/ImageTest.cpp')
-rw-r--r--tests/ImageTest.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index ab2215b17b..ba49000d9a 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -411,6 +411,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(c, reporter, ctxInfo) {
SkImageInfo info = SkImageInfo::MakeN32(20, 20, kOpaque_SkAlphaType);
sk_sp<SkImage> image(create_gpu_image(ctxInfo.grContext()));
const uint32_t uniqueID = image->uniqueID();
+ const auto desc = SkBitmapCacheDesc::Make(image.get());
auto surface(SkSurface::MakeRaster(info));
@@ -418,13 +419,13 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(c, reporter, ctxInfo) {
{
SkBitmap cachedBitmap;
- REPORTER_ASSERT(reporter, !SkBitmapCache::Find(uniqueID, &cachedBitmap));
+ REPORTER_ASSERT(reporter, !SkBitmapCache::Find(desc, &cachedBitmap));
}
surface->getCanvas()->drawImage(image, 0, 0);
{
SkBitmap cachedBitmap;
- if (SkBitmapCache::Find(uniqueID, &cachedBitmap)) {
+ if (SkBitmapCache::Find(desc, &cachedBitmap)) {
REPORTER_ASSERT(reporter, cachedBitmap.getGenerationID() == uniqueID);
REPORTER_ASSERT(reporter, cachedBitmap.isImmutable());
REPORTER_ASSERT(reporter, cachedBitmap.getPixels());
@@ -438,7 +439,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(c, reporter, ctxInfo) {
image.reset(nullptr);
{
SkBitmap cachedBitmap;
- REPORTER_ASSERT(reporter, !SkBitmapCache::Find(uniqueID, &cachedBitmap));
+ REPORTER_ASSERT(reporter, !SkBitmapCache::Find(desc, &cachedBitmap));
}
}