Reland 6914 w/ fixes.
git-svn-id: http://skia.googlecode.com/svn/trunk@6916 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 7b06d60..f4c4cf6 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1104,7 +1104,7 @@
return false;
}
// if the entire texture is already in our cache then no reason to tile it
- if (this->isBitmapInTextureCache(bitmap, params)) {
+ if (GrIsBitmapInCache(fContext, bitmap, ¶ms)) {
return false;
}
@@ -1848,22 +1848,6 @@
///////////////////////////////////////////////////////////////////////////////
-bool SkGpuDevice::isBitmapInTextureCache(const SkBitmap& bitmap,
- const GrTextureParams& params) const {
- uint64_t key = bitmap.getGenerationID();
- key |= ((uint64_t) bitmap.pixelRefOffset()) << 32;
-
- GrTextureDesc desc;
- desc.fWidth = bitmap.width();
- desc.fHeight = bitmap.height();
- desc.fConfig = SkBitmapConfig2GrPixelConfig(bitmap.config());
-
- GrCacheData cacheData(key);
-
- return this->context()->isTextureInCache(desc, cacheData, ¶ms);
-}
-
-
SkDevice* SkGpuDevice::onCreateCompatibleDevice(SkBitmap::Config config,
int width, int height,
bool isOpaque,
@@ -1883,10 +1867,10 @@
#if CACHE_COMPATIBLE_DEVICE_TEXTURES
// layers are never draw in repeat modes, so we can request an approx
// match and ignore any padding.
- GrContext::ScratchTexMatch matchType = (kSaveLayer_Usage == usage) ?
- GrContext::kApprox_ScratchTexMatch :
- GrContext::kExact_ScratchTexMatch;
- texture = fContext->lockScratchTexture(desc, matchType);
+ const GrContext::ScratchTexMatch match = (kSaveLayer_Usage == usage) ?
+ GrContext::kApprox_ScratchTexMatch :
+ GrContext::kExact_ScratchTexMatch;
+ texture = fContext->lockScratchTexture(desc, match);
#else
tunref.reset(fContext->createUncachedTexture(desc, NULL, 0));
texture = tunref.get();