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

Unified Diff: tests/SkResourceCacheTest.cpp

Issue 2029373004: respect srgb gamma when building mips (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix warning Created 4 years, 6 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 | « tests/MipMapTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SkResourceCacheTest.cpp
diff --git a/tests/SkResourceCacheTest.cpp b/tests/SkResourceCacheTest.cpp
index 3c0d1ffee3a467d00c6e35545a3ed1b003c73942..f363fb7a44b72cd894fa07abc897ea37d29ecf21 100644
--- a/tests/SkResourceCacheTest.cpp
+++ b/tests/SkResourceCacheTest.cpp
@@ -96,14 +96,18 @@ static void test_mipmapcache(skiatest::Reporter* reporter, SkResourceCache* cach
src.allocN32Pixels(5, 5);
src.setImmutable();
- const SkMipMap* mipmap = SkMipMapCache::FindAndRef(SkBitmapCacheDesc::Make(src), cache);
+ const SkSourceGammaTreatment treatment = SkSourceGammaTreatment::kIgnore;
+
+ const SkMipMap* mipmap = SkMipMapCache::FindAndRef(SkBitmapCacheDesc::Make(src), treatment,
+ cache);
REPORTER_ASSERT(reporter, nullptr == mipmap);
- mipmap = SkMipMapCache::AddAndRef(src, cache);
+ mipmap = SkMipMapCache::AddAndRef(src, treatment, cache);
REPORTER_ASSERT(reporter, mipmap);
{
- const SkMipMap* mm = SkMipMapCache::FindAndRef(SkBitmapCacheDesc::Make(src), cache);
+ const SkMipMap* mm = SkMipMapCache::FindAndRef(SkBitmapCacheDesc::Make(src), treatment,
+ cache);
REPORTER_ASSERT(reporter, mm);
REPORTER_ASSERT(reporter, mm == mipmap);
mm->unref();
@@ -117,7 +121,7 @@ static void test_mipmapcache(skiatest::Reporter* reporter, SkResourceCache* cach
check_data(reporter, mipmap, 1, kInCache, kNotLocked);
// find us again
- mipmap = SkMipMapCache::FindAndRef(SkBitmapCacheDesc::Make(src), cache);
+ mipmap = SkMipMapCache::FindAndRef(SkBitmapCacheDesc::Make(src), treatment, cache);
check_data(reporter, mipmap, 2, kInCache, kLocked);
cache->purgeAll();
@@ -127,16 +131,19 @@ static void test_mipmapcache(skiatest::Reporter* reporter, SkResourceCache* cach
}
static void test_mipmap_notify(skiatest::Reporter* reporter, SkResourceCache* cache) {
+ const SkSourceGammaTreatment treatment = SkSourceGammaTreatment::kIgnore;
const int N = 3;
+
SkBitmap src[N];
for (int i = 0; i < N; ++i) {
src[i].allocN32Pixels(5, 5);
src[i].setImmutable();
- SkMipMapCache::AddAndRef(src[i], cache)->unref();
+ SkMipMapCache::AddAndRef(src[i], treatment, cache)->unref();
}
for (int i = 0; i < N; ++i) {
- const SkMipMap* mipmap = SkMipMapCache::FindAndRef(SkBitmapCacheDesc::Make(src[i]), cache);
+ const SkMipMap* mipmap = SkMipMapCache::FindAndRef(SkBitmapCacheDesc::Make(src[i]),
+ treatment, cache);
if (cache) {
// if cache is null, we're working on the global cache, and other threads might purge
// it, making this check fragile.
@@ -146,7 +153,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(SkBitmapCacheDesc::Make(src[i]), cache);
+ mipmap = SkMipMapCache::FindAndRef(SkBitmapCacheDesc::Make(src[i]), treatment, cache);
REPORTER_ASSERT(reporter, !mipmap);
}
}
« no previous file with comments | « tests/MipMapTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698