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 16 matching lines...) Expand all Loading... |
27 static void create_layers(skiatest::Reporter* reporter, | 27 static void create_layers(skiatest::Reporter* reporter, |
28 GrLayerCache* cache, | 28 GrLayerCache* cache, |
29 const SkPicture& picture, | 29 const SkPicture& picture, |
30 int numToAdd, | 30 int numToAdd, |
31 int idOffset) { | 31 int idOffset) { |
32 | 32 |
33 for (int i = 0; i < numToAdd; ++i) { | 33 for (int i = 0; i < numToAdd; ++i) { |
34 GrCachedLayer* layer = cache->findLayerOrCreate(picture.uniqueID(), | 34 GrCachedLayer* layer = cache->findLayerOrCreate(picture.uniqueID(), |
35 idOffset+i+1, idOffset+i
+2, | 35 idOffset+i+1, idOffset+i
+2, |
36 SkIPoint::Make(0, 0), | 36 SkIPoint::Make(0, 0), |
37 SkMatrix::I()); | 37 SkMatrix::I(), |
| 38 NULL); |
38 REPORTER_ASSERT(reporter, layer); | 39 REPORTER_ASSERT(reporter, layer); |
39 GrCachedLayer* temp = cache->findLayer(picture.uniqueID(), idOffset+i+1,
idOffset+i+2, | 40 GrCachedLayer* temp = cache->findLayer(picture.uniqueID(), idOffset+i+1,
idOffset+i+2, |
40 SkIPoint::Make(0, 0), SkMatrix::I
()); | 41 SkIPoint::Make(0, 0), SkMatrix::I
()); |
41 REPORTER_ASSERT(reporter, temp == layer); | 42 REPORTER_ASSERT(reporter, temp == layer); |
42 | 43 |
43 REPORTER_ASSERT(reporter, TestingAccess::NumLayers(cache) == idOffset +
i + 1); | 44 REPORTER_ASSERT(reporter, TestingAccess::NumLayers(cache) == idOffset +
i + 1); |
44 | 45 |
45 REPORTER_ASSERT(reporter, picture.uniqueID() == layer->pictureID()); | 46 REPORTER_ASSERT(reporter, picture.uniqueID() == layer->pictureID()); |
46 REPORTER_ASSERT(reporter, layer->start() == idOffset + i + 1); | 47 REPORTER_ASSERT(reporter, layer->start() == idOffset + i + 1); |
47 REPORTER_ASSERT(reporter, layer->stop() == idOffset + i + 2); | 48 REPORTER_ASSERT(reporter, layer->stop() == idOffset + i + 2); |
48 REPORTER_ASSERT(reporter, layer->ctm() == SkMatrix::I()); | 49 REPORTER_ASSERT(reporter, layer->ctm() == SkMatrix::I()); |
49 REPORTER_ASSERT(reporter, NULL == layer->texture()); | 50 REPORTER_ASSERT(reporter, NULL == layer->texture()); |
| 51 REPORTER_ASSERT(reporter, NULL == layer->paint()); |
50 REPORTER_ASSERT(reporter, !layer->isAtlased()); | 52 REPORTER_ASSERT(reporter, !layer->isAtlased()); |
51 } | 53 } |
52 | 54 |
53 cache->trackPicture(&picture); | 55 cache->trackPicture(&picture); |
54 } | 56 } |
55 | 57 |
56 static void lock_layer(skiatest::Reporter* reporter, | 58 static void lock_layer(skiatest::Reporter* reporter, |
57 GrLayerCache* cache, | 59 GrLayerCache* cache, |
58 GrCachedLayer* layer) { | 60 GrCachedLayer* layer) { |
59 // Make the layer 512x512 (so it can be atlased) | 61 // Make the layer 512x512 (so it can be atlased) |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 205 |
204 picture.reset(NULL); | 206 picture.reset(NULL); |
205 cache.processDeletedPictures(); | 207 cache.processDeletedPictures(); |
206 | 208 |
207 REPORTER_ASSERT(reporter, TestingAccess::NumLayers(&cache) == 0); | 209 REPORTER_ASSERT(reporter, TestingAccess::NumLayers(&cache) == 0); |
208 // TODO: add VRAM/resource cache check here | 210 // TODO: add VRAM/resource cache check here |
209 } | 211 } |
210 } | 212 } |
211 | 213 |
212 #endif | 214 #endif |
OLD | NEW |