| Index: tests/GpuLayerCacheTest.cpp
|
| diff --git a/tests/GpuLayerCacheTest.cpp b/tests/GpuLayerCacheTest.cpp
|
| index 1043a208f5c74312931bd451e85260d0b58c5d16..43a845b11d17e9c5e2a0bc563780e3b7fd28f426 100644
|
| --- a/tests/GpuLayerCacheTest.cpp
|
| +++ b/tests/GpuLayerCacheTest.cpp
|
| @@ -24,6 +24,10 @@ public:
|
| static int Uses(GrCachedLayer* layer) {
|
| return layer->uses();
|
| }
|
| + static GrCachedLayer* Find(GrLayerCache* cache, uint32_t pictureID,
|
| + const SkMatrix& initialMat, const int* key, int keySize) {
|
| + return cache->findLayer(pictureID, initialMat, key, keySize);
|
| + }
|
| };
|
|
|
| // Add several layers to the cache
|
| @@ -34,14 +38,16 @@ static void create_layers(skiatest::Reporter* reporter,
|
| int idOffset) {
|
|
|
| for (int i = 0; i < numToAdd; ++i) {
|
| + int indices[1] = { idOffset+i+1 };
|
| GrCachedLayer* layer = cache->findLayerOrCreate(picture.uniqueID(),
|
| idOffset+i+1, idOffset+i+2,
|
| SkIRect::MakeEmpty(),
|
| SkMatrix::I(),
|
| + indices, 1,
|
| NULL);
|
| REPORTER_ASSERT(reporter, layer);
|
| - GrCachedLayer* temp = cache->findLayer(picture.uniqueID(), idOffset + i + 1,
|
| - SkIRect::MakeEmpty(), SkMatrix::I());
|
| + GrCachedLayer* temp = TestingAccess::Find(cache, picture.uniqueID(), SkMatrix::I(),
|
| + indices, 1);
|
| REPORTER_ASSERT(reporter, temp == layer);
|
|
|
| REPORTER_ASSERT(reporter, TestingAccess::NumLayers(cache) == idOffset + i + 1);
|
| @@ -111,8 +117,9 @@ 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,
|
| - SkIRect::MakeEmpty(), SkMatrix::I());
|
| + int indices[1] = { i + 1 };
|
| + GrCachedLayer* layer = TestingAccess::Find(&cache, picture->uniqueID(), SkMatrix::I(),
|
| + indices, 1);
|
| REPORTER_ASSERT(reporter, layer);
|
|
|
| lock_layer(reporter, &cache, layer);
|
| @@ -129,15 +136,19 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
|
|
|
| // Unlock the textures
|
| for (int i = 0; i < kInitialNumLayers; ++i) {
|
| - GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1,
|
| - SkIRect::MakeEmpty(), SkMatrix::I());
|
| + int indices[1] = { i+1 };
|
| +
|
| + GrCachedLayer* layer = TestingAccess::Find(&cache, picture->uniqueID(), SkMatrix::I(),
|
| + indices, 1);
|
| REPORTER_ASSERT(reporter, layer);
|
| cache.removeUse(layer);
|
| }
|
|
|
| for (int i = 0; i < kInitialNumLayers; ++i) {
|
| - GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i+1,
|
| - SkIRect::MakeEmpty(), SkMatrix::I());
|
| + int indices[1] = { i+1 };
|
| +
|
| + GrCachedLayer* layer = TestingAccess::Find(&cache, picture->uniqueID(), SkMatrix::I(),
|
| + indices, 1);
|
| REPORTER_ASSERT(reporter, layer);
|
|
|
| // All the layers should be unlocked
|
| @@ -161,12 +172,13 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
|
| }
|
|
|
| {
|
| + int indices[1] = { kInitialNumLayers+1 };
|
| +
|
| // Add an additional layer. Since all the layers are unlocked this
|
| // will force out the first atlased layer
|
| create_layers(reporter, &cache, *picture, 1, kInitialNumLayers);
|
| - GrCachedLayer* layer = cache.findLayer(picture->uniqueID(),
|
| - kInitialNumLayers+1,
|
| - SkIRect::MakeEmpty(), SkMatrix::I());
|
| + GrCachedLayer* layer = TestingAccess::Find(&cache, picture->uniqueID(), SkMatrix::I(),
|
| + indices, 1);
|
| REPORTER_ASSERT(reporter, layer);
|
|
|
| lock_layer(reporter, &cache, layer);
|
| @@ -174,8 +186,10 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
|
| }
|
|
|
| for (int i = 0; i < kInitialNumLayers+1; ++i) {
|
| - GrCachedLayer* layer = cache.findLayer(picture->uniqueID(), i + 1,
|
| - SkIRect::MakeEmpty(), SkMatrix::I());
|
| + int indices[1] = { i+1 };
|
| +
|
| + GrCachedLayer* layer = TestingAccess::Find(&cache, picture->uniqueID(), SkMatrix::I(),
|
| + indices, 1);
|
| #if GR_CACHE_HOISTED_LAYERS
|
| // 3 old layers plus the new one should be in the atlas.
|
| if (1 == i || 2 == i || 3 == i || 5 == i) {
|
|
|