| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #if SK_SUPPORT_GPU | 8 #if SK_SUPPORT_GPU |
| 9 | 9 |
| 10 #include "GrContext.h" | 10 #include "GrContext.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 REPORTER_ASSERT(reporter, layer); | 62 REPORTER_ASSERT(reporter, layer); |
| 63 GrCachedLayer* temp = TestingAccess::Find(cache, picture.uniqueID(), SkM
atrix::I(), | 63 GrCachedLayer* temp = TestingAccess::Find(cache, picture.uniqueID(), SkM
atrix::I(), |
| 64 key, 1); | 64 key, 1); |
| 65 REPORTER_ASSERT(reporter, temp == layer); | 65 REPORTER_ASSERT(reporter, temp == layer); |
| 66 | 66 |
| 67 REPORTER_ASSERT(reporter, TestingAccess::NumLayers(cache) == idOffset +
i + 1); | 67 REPORTER_ASSERT(reporter, TestingAccess::NumLayers(cache) == idOffset +
i + 1); |
| 68 | 68 |
| 69 REPORTER_ASSERT(reporter, picture.uniqueID() == layer->pictureID()); | 69 REPORTER_ASSERT(reporter, picture.uniqueID() == layer->pictureID()); |
| 70 REPORTER_ASSERT(reporter, layer->start() == idOffset + i + 1); | 70 REPORTER_ASSERT(reporter, layer->start() == idOffset + i + 1); |
| 71 REPORTER_ASSERT(reporter, layer->stop() == idOffset + i + 2); | 71 REPORTER_ASSERT(reporter, layer->stop() == idOffset + i + 2); |
| 72 REPORTER_ASSERT(reporter, nullptr == layer->texture()); | 72 REPORTER_ASSERT(reporter, !layer->texture()); |
| 73 REPORTER_ASSERT(reporter, nullptr == layer->paint()); | 73 REPORTER_ASSERT(reporter, !layer->paint()); |
| 74 REPORTER_ASSERT(reporter, !layer->isAtlased()); | 74 REPORTER_ASSERT(reporter, !layer->isAtlased()); |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 static void lock_layer(skiatest::Reporter* reporter, | 78 static void lock_layer(skiatest::Reporter* reporter, |
| 79 GrLayerCache* cache, | 79 GrLayerCache* cache, |
| 80 GrCachedLayer* layer) { | 80 GrCachedLayer* layer) { |
| 81 // Make each layer big enough to consume one whole plot in the atlas | 81 // Make each layer big enough to consume one whole plot in the atlas |
| 82 GrSurfaceDesc desc; | 82 GrSurfaceDesc desc; |
| 83 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 83 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // When hoisted layers aren't cached they are aggressively removed | 190 // When hoisted layers aren't cached they are aggressively removed |
| 191 // from the atlas | 191 // from the atlas |
| 192 #if GR_CACHE_HOISTED_LAYERS | 192 #if GR_CACHE_HOISTED_LAYERS |
| 193 // The first 4 layers should still be in the atlas. | 193 // The first 4 layers should still be in the atlas. |
| 194 if (i < 4) { | 194 if (i < 4) { |
| 195 REPORTER_ASSERT(reporter, layer->texture()); | 195 REPORTER_ASSERT(reporter, layer->texture()); |
| 196 REPORTER_ASSERT(reporter, layer->isAtlased()); | 196 REPORTER_ASSERT(reporter, layer->isAtlased()); |
| 197 } else { | 197 } else { |
| 198 #endif | 198 #endif |
| 199 // The final layer should not be atlased. | 199 // The final layer should not be atlased. |
| 200 REPORTER_ASSERT(reporter, nullptr == layer->texture()); | 200 REPORTER_ASSERT(reporter, !layer->texture()); |
| 201 REPORTER_ASSERT(reporter, !layer->isAtlased()); | 201 REPORTER_ASSERT(reporter, !layer->isAtlased()); |
| 202 #if GR_CACHE_HOISTED_LAYERS | 202 #if GR_CACHE_HOISTED_LAYERS |
| 203 } | 203 } |
| 204 #endif | 204 #endif |
| 205 } | 205 } |
| 206 | 206 |
| 207 // Let go of the backing texture | 207 // Let go of the backing texture |
| 208 cache.end(); | 208 cache.end(); |
| 209 REPORTER_ASSERT(reporter, nullptr == TestingAccess::GetBackingTexture(&cache
)); | 209 REPORTER_ASSERT(reporter, nullptr == TestingAccess::GetBackingTexture(&cache
)); |
| 210 | 210 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 if (1 == i || 2 == i || 3 == i || 5 == i) { | 251 if (1 == i || 2 == i || 3 == i || 5 == i) { |
| 252 REPORTER_ASSERT(reporter, layer); | 252 REPORTER_ASSERT(reporter, layer); |
| 253 REPORTER_ASSERT(reporter, !layer->locked()); | 253 REPORTER_ASSERT(reporter, !layer->locked()); |
| 254 REPORTER_ASSERT(reporter, layer->texture()); | 254 REPORTER_ASSERT(reporter, layer->texture()); |
| 255 REPORTER_ASSERT(reporter, layer->isAtlased()); | 255 REPORTER_ASSERT(reporter, layer->isAtlased()); |
| 256 } else if (4 == i) { | 256 } else if (4 == i) { |
| 257 #endif | 257 #endif |
| 258 // The one that was never atlased should still be around | 258 // The one that was never atlased should still be around |
| 259 REPORTER_ASSERT(reporter, layer); | 259 REPORTER_ASSERT(reporter, layer); |
| 260 | 260 |
| 261 REPORTER_ASSERT(reporter, nullptr == layer->texture()); | 261 REPORTER_ASSERT(reporter, !layer->texture()); |
| 262 REPORTER_ASSERT(reporter, !layer->isAtlased()); | 262 REPORTER_ASSERT(reporter, !layer->isAtlased()); |
| 263 #if GR_CACHE_HOISTED_LAYERS | 263 #if GR_CACHE_HOISTED_LAYERS |
| 264 } else { | 264 } else { |
| 265 // The one bumped out of the atlas (i.e., 0) should be gone | 265 // The one bumped out of the atlas (i.e., 0) should be gone |
| 266 REPORTER_ASSERT(reporter, nullptr == layer); | 266 REPORTER_ASSERT(reporter, nullptr == layer); |
| 267 } | 267 } |
| 268 #endif | 268 #endif |
| 269 } | 269 } |
| 270 | 270 |
| 271 //-------------------------------------------------------------------- | 271 //-------------------------------------------------------------------- |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 cache.end(); | 360 cache.end(); |
| 361 | 361 |
| 362 #if GR_CACHE_STATS | 362 #if GR_CACHE_STATS |
| 363 resourceCache->getStats(&stats); | 363 resourceCache->getStats(&stats); |
| 364 REPORTER_ASSERT(reporter, 2 == stats.fTotal); | 364 REPORTER_ASSERT(reporter, 2 == stats.fTotal); |
| 365 REPORTER_ASSERT(reporter, 2 == stats.fNumPurgeable); | 365 REPORTER_ASSERT(reporter, 2 == stats.fNumPurgeable); |
| 366 #endif | 366 #endif |
| 367 } | 367 } |
| 368 | 368 |
| 369 #endif | 369 #endif |
| OLD | NEW |