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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 continue; | 104 continue; |
105 } | 105 } |
106 | 106 |
107 GrContext* context = factory->get(glCtxType); | 107 GrContext* context = factory->get(glCtxType); |
108 | 108 |
109 if (NULL == context) { | 109 if (NULL == context) { |
110 continue; | 110 continue; |
111 } | 111 } |
112 | 112 |
113 SkPictureRecorder recorder; | 113 SkPictureRecorder recorder; |
114 recorder.beginRecording(1, 1); | 114 SkCanvas* c = recorder.beginRecording(1, 1); |
| 115 // Draw something, anything, to prevent an empty-picture optimizatio
n, |
| 116 // which is a singleton and never purged. |
| 117 c->drawRect(SkRect::MakeWH(1,1), SkPaint()); |
115 SkAutoTUnref<const SkPicture> picture(recorder.endRecording()); | 118 SkAutoTUnref<const SkPicture> picture(recorder.endRecording()); |
116 | 119 |
117 GrLayerCache cache(context); | 120 GrLayerCache cache(context); |
118 | 121 |
119 create_layers(reporter, &cache, *picture, kInitialNumLayers, 0); | 122 create_layers(reporter, &cache, *picture, kInitialNumLayers, 0); |
120 | 123 |
121 for (unsigned i = 0; i < kInitialNumLayers; ++i) { | 124 for (unsigned i = 0; i < kInitialNumLayers; ++i) { |
122 unsigned indices[1] = { i + 1 }; | 125 unsigned indices[1] = { i + 1 }; |
123 GrCachedLayer* layer = TestingAccess::Find(&cache, picture->uniqueID
(), SkMatrix::I(), | 126 GrCachedLayer* layer = TestingAccess::Find(&cache, picture->uniqueID
(), SkMatrix::I(), |
124 indices, 1); | 127 indices, 1); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 244 |
242 picture.reset(NULL); | 245 picture.reset(NULL); |
243 cache.processDeletedPictures(); | 246 cache.processDeletedPictures(); |
244 | 247 |
245 REPORTER_ASSERT(reporter, TestingAccess::NumLayers(&cache) == 0); | 248 REPORTER_ASSERT(reporter, TestingAccess::NumLayers(&cache) == 0); |
246 // TODO: add VRAM/resource cache check here | 249 // TODO: add VRAM/resource cache check here |
247 } | 250 } |
248 } | 251 } |
249 | 252 |
250 #endif | 253 #endif |
OLD | NEW |