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

Unified Diff: src/gpu/GrLayerCache.cpp

Issue 803183003: Fix layer hoisting image filter corner cases (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix unit test Created 6 years 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 | « src/gpu/GrLayerCache.h ('k') | src/gpu/GrLayerHoister.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/gpu/GrLayerCache.h ('k') | src/gpu/GrLayerHoister.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698