diff options
author | 2014-12-16 07:41:37 -0800 | |
---|---|---|
committer | 2014-12-16 07:41:37 -0800 | |
commit | 86f032832fc3527ab561bcbd9d2a546f7f676f73 (patch) | |
tree | 01fb6a7da4aef332c11a271e6bd3f889193a7b5f /src/gpu/GrLayerCache.cpp | |
parent | 861e1037017bbb7ac52ec5ebecab3a636a82a3e8 (diff) |
Revert of Fix layer hoisting image filter corner cases (patchset #3 id:40001 of https://codereview.chromium.org/803183003/)
Reason for revert:
Breaking DM
Original issue's description:
> Fix layer hoisting image filter corner cases
>
> This CL fixes 5 bugs related to hoisting image filters:
>
> For image filters the src layer (the one prior to filtering) often needs to be
> smaller then the final layer. This requires the saveLayer's optional bounds
> to be stored (in SkLayerInfo.h and SkRecordDraw.cpp) and then used in
> compute_source_rect and carried around in GrCachedLayer.
>
> The image filters can add an extra offset to the final draw operation.
> This is now computed in GrLayerHoister::FilterLayer and carried around in
> GrCachedLayer.
>
> Filtered layers must use exact matches. This is now done in GrLayerCache::lock.
>
> The filter cache requires a valid matrix so it can compute the correct offset.
> This is now done in GrLayerHoister::FilterLayer.
>
> Filtered layers need to be drawn with drawSprite while unfiltered (and therefore
> hopefully atlased) layers can be drawn with drawBitmap. This is now done in
> draw_replacement_bitmap.
>
> Committed: https://skia.googlesource.com/skia/+/702eb9622102599d94ab6798e6227cf29f48c2d3
TBR=bsalomon@google.com
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.chromium.org/790643009
Diffstat (limited to 'src/gpu/GrLayerCache.cpp')
-rw-r--r-- | src/gpu/GrLayerCache.cpp | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/gpu/GrLayerCache.cpp b/src/gpu/GrLayerCache.cpp index e521b3e323..fc5be5fd05 100644 --- a/src/gpu/GrLayerCache.cpp +++ b/src/gpu/GrLayerCache.cpp @@ -123,16 +123,14 @@ void GrLayerCache::freeAll() { GrCachedLayer* GrLayerCache::createLayer(uint32_t pictureID, int start, int stop, - const SkIRect& srcIR, - const SkIRect& dstIR, + const SkIRect& bounds, 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, - srcIR, dstIR, initialMat, + GrCachedLayer* layer = SkNEW_ARGS(GrCachedLayer, (pictureID, start, stop, bounds, initialMat, key, keySize, paint)); fLayerHash.add(layer); return layer; @@ -146,8 +144,7 @@ GrCachedLayer* GrLayerCache::findLayer(uint32_t pictureID, const SkMatrix& initi GrCachedLayer* GrLayerCache::findLayerOrCreate(uint32_t pictureID, int start, int stop, - const SkIRect& srcIR, - const SkIRect& dstIR, + const SkIRect& bounds, const SkMatrix& initialMat, const unsigned* key, int keySize, @@ -155,9 +152,7 @@ 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, - srcIR, dstIR, initialMat, - key, keySize, paint); + layer = this->createLayer(pictureID, start, stop, bounds, initialMat, key, keySize, paint); } return layer; @@ -247,14 +242,8 @@ 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, usage)); + fContext->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch)); if (!tex) { return false; |