create SkBitmapProvider to abstract images and bitmaps
BUG=skia:
Review URL: https://codereview.chromium.org/1340223003
diff --git a/tests/SkResourceCacheTest.cpp b/tests/SkResourceCacheTest.cpp
index cf8327f..9df1519 100644
--- a/tests/SkResourceCacheTest.cpp
+++ b/tests/SkResourceCacheTest.cpp
@@ -23,7 +23,7 @@
SkBitmap scaled;
int width = SkScalarRoundToInt(orig.width() * xScale);
int height = SkScalarRoundToInt(orig.height() * yScale);
- return SkBitmapCache::FindWH(orig, width, height, &scaled);
+ return SkBitmapCache::FindWH(SkBitmapCacheDesc::Make(orig, width, height), &scaled);
}
// Draw a scaled bitmap, then return true if it has been cached.
@@ -153,14 +153,14 @@
src.allocN32Pixels(5, 5);
src.setImmutable();
- const SkMipMap* mipmap = SkMipMapCache::FindAndRef(src, cache);
+ const SkMipMap* mipmap = SkMipMapCache::FindAndRef(SkBitmapCacheDesc::Make(src), cache);
REPORTER_ASSERT(reporter, nullptr == mipmap);
mipmap = SkMipMapCache::AddAndRef(src, cache);
REPORTER_ASSERT(reporter, mipmap);
{
- const SkMipMap* mm = SkMipMapCache::FindAndRef(src, cache);
+ const SkMipMap* mm = SkMipMapCache::FindAndRef(SkBitmapCacheDesc::Make(src), cache);
REPORTER_ASSERT(reporter, mm);
REPORTER_ASSERT(reporter, mm == mipmap);
mm->unref();
@@ -174,7 +174,7 @@
check_data(reporter, mipmap, 1, kInCache, kNotLocked);
// find us again
- mipmap = SkMipMapCache::FindAndRef(src, cache);
+ mipmap = SkMipMapCache::FindAndRef(SkBitmapCacheDesc::Make(src), cache);
check_data(reporter, mipmap, 2, kInCache, kLocked);
cache->purgeAll();
@@ -193,7 +193,7 @@
}
for (int i = 0; i < N; ++i) {
- const SkMipMap* mipmap = SkMipMapCache::FindAndRef(src[i], cache);
+ const SkMipMap* mipmap = SkMipMapCache::FindAndRef(SkBitmapCacheDesc::Make(src[i]), cache);
if (cache) {
// if cache is null, we're working on the global cache, and other threads might purge
// it, making this check fragile.
@@ -203,7 +203,7 @@
src[i].reset(); // delete the underlying pixelref, which *should* remove us from the cache
- mipmap = SkMipMapCache::FindAndRef(src[i], cache);
+ mipmap = SkMipMapCache::FindAndRef(SkBitmapCacheDesc::Make(src[i]), cache);
REPORTER_ASSERT(reporter, !mipmap);
}
}