Index: src/gpu/GrLayerCache.cpp |
diff --git a/src/gpu/GrLayerCache.cpp b/src/gpu/GrLayerCache.cpp |
index fc5be5fd059d913b60883ab2467ea2d520165e88..e521b3e3239678c5c16d2ec2be35edf7648e9b04 100644 |
--- a/src/gpu/GrLayerCache.cpp |
+++ b/src/gpu/GrLayerCache.cpp |
@@ -123,14 +123,16 @@ void GrLayerCache::freeAll() { |
GrCachedLayer* GrLayerCache::createLayer(uint32_t pictureID, |
int start, int stop, |
- const SkIRect& bounds, |
+ const SkIRect& srcIR, |
+ const SkIRect& dstIR, |
const SkMatrix& initialMat, |
const unsigned* key, |
int keySize, |
const SkPaint* paint) { |
SkASSERT(pictureID != SK_InvalidGenID && start >= 0 && stop > 0); |
- GrCachedLayer* layer = SkNEW_ARGS(GrCachedLayer, (pictureID, start, stop, bounds, initialMat, |
+ GrCachedLayer* layer = SkNEW_ARGS(GrCachedLayer, (pictureID, start, stop, |
+ srcIR, dstIR, initialMat, |
key, keySize, paint)); |
fLayerHash.add(layer); |
return layer; |
@@ -144,7 +146,8 @@ GrCachedLayer* GrLayerCache::findLayer(uint32_t pictureID, const SkMatrix& initi |
GrCachedLayer* GrLayerCache::findLayerOrCreate(uint32_t pictureID, |
int start, int stop, |
- const SkIRect& bounds, |
+ const SkIRect& srcIR, |
+ const SkIRect& dstIR, |
const SkMatrix& initialMat, |
const unsigned* key, |
int keySize, |
@@ -152,7 +155,9 @@ GrCachedLayer* GrLayerCache::findLayerOrCreate(uint32_t pictureID, |
SkASSERT(pictureID != SK_InvalidGenID && start >= 0 && stop > 0); |
GrCachedLayer* layer = fLayerHash.find(GrCachedLayer::Key(pictureID, initialMat, key, keySize)); |
if (NULL == layer) { |
- layer = this->createLayer(pictureID, start, stop, bounds, initialMat, key, keySize, paint); |
+ layer = this->createLayer(pictureID, start, stop, |
+ srcIR, dstIR, initialMat, |
+ key, keySize, paint); |
} |
return layer; |
@@ -242,8 +247,14 @@ bool GrLayerCache::lock(GrCachedLayer* layer, const GrSurfaceDesc& desc, bool* n |
return true; |
} |
+ // TODO: make the test for exact match depend on the image filters themselves |
+ GrContext::ScratchTexMatch usage = GrContext::kApprox_ScratchTexMatch; |
+ if (layer->fFilter) { |
+ usage = GrContext::kExact_ScratchTexMatch; |
+ } |
+ |
SkAutoTUnref<GrTexture> tex( |
- fContext->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch)); |
+ fContext->refScratchTexture(desc, usage)); |
if (!tex) { |
return false; |