diff options
author | robertphillips <robertphillips@google.com> | 2014-10-20 08:52:40 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-20 08:52:40 -0700 |
commit | 3aac6e0848010efe046bd86bcb341dad5a23e174 (patch) | |
tree | fa1245737e3610824e5a56c51afb015e56acd8cc /tests/GpuLayerCacheTest.cpp | |
parent | 4a36d9ab5efc6d0efd08a48bb46b5c64c15290d9 (diff) |
Add clip to layer cache
This CL adds the clip region to the GPU layer hoisting image cache. It also switches back to the old caching behavior of using the entire CTM in the cache key rather then just the upper 2x2. This latter change is to focus more on hoisting rather then caching.
It also includes 2 smaller fixes:
a) layer's that have an image filter are no longer atlased (b.c. doing so complicates applying the image filter)
b) the result of clipping the layer's bounds to the current clip is used as the hoisted layer's size. This reduces the amount of pixels drawn to match a normal (non-hoisted) draw pass.
Review URL: https://codereview.chromium.org/640773004
Diffstat (limited to 'tests/GpuLayerCacheTest.cpp')
-rw-r--r-- | tests/GpuLayerCacheTest.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/tests/GpuLayerCacheTest.cpp b/tests/GpuLayerCacheTest.cpp index f7b2d6ef3e..62f6ec7a8c 100644 --- a/tests/GpuLayerCacheTest.cpp +++ b/tests/GpuLayerCacheTest.cpp @@ -36,11 +36,12 @@ static void create_layers(skiatest::Reporter* reporter, for (int i = 0; i < numToAdd; ++i) { GrCachedLayer* layer = cache->findLayerOrCreate(picture.uniqueID(), idOffset+i+1, idOffset+i+2, + SkIRect::MakeEmpty(), SkMatrix::I(), NULL); REPORTER_ASSERT(reporter, layer); - GrCachedLayer* temp = cache->findLayer(picture.uniqueID(), idOffset+i+1, - SkMatrix::I()); + GrCachedLayer* temp = cache->findLayer(picture.uniqueID(), idOffset + i + 1, + SkIRect::MakeEmpty(), SkMatrix::I()); REPORTER_ASSERT(reporter, temp == layer); REPORTER_ASSERT(reporter, TestingAccess::NumLayers(cache) == idOffset + i + 1); @@ -108,7 +109,8 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) { create_layers(reporter, &cache, *picture, kInitialNumLayers, 0); for (int i = 0; i < kInitialNumLayers; ++i) { - GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, SkMatrix::I()); + GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, + SkIRect::MakeEmpty(), SkMatrix::I()); REPORTER_ASSERT(reporter, layer); lock_layer(reporter, &cache, layer); @@ -125,13 +127,15 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) { // Unlock the textures for (int i = 0; i < kInitialNumLayers; ++i) { - GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, SkMatrix::I()); + GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, + SkIRect::MakeEmpty(), SkMatrix::I()); REPORTER_ASSERT(reporter, layer); cache.removeUse(layer); } for (int i = 0; i < kInitialNumLayers; ++i) { - GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, SkMatrix::I()); + GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, + SkIRect::MakeEmpty(), SkMatrix::I()); REPORTER_ASSERT(reporter, layer); // All the layers should be unlocked @@ -153,7 +157,8 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) { // will force out the first atlased layer create_layers(reporter, &cache, *picture, 1, kInitialNumLayers); GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), - kInitialNumLayers+1, SkMatrix::I()); + kInitialNumLayers+1, + SkIRect::MakeEmpty(), SkMatrix::I()); REPORTER_ASSERT(reporter, layer); lock_layer(reporter, &cache, layer); @@ -161,7 +166,8 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) { } for (int i = 0; i < kInitialNumLayers+1; ++i) { - GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1, SkMatrix::I()); + GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i + 1, + SkIRect::MakeEmpty(), SkMatrix::I()); // 3 old layers plus the new one should be in the atlas. if (1 == i || 2 == i || 3 == i || 5 == i) { REPORTER_ASSERT(reporter, layer); |