| 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 SkCanvas* c = recorder.beginRecording(1, 1); | 114 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()); | |
| 118 SkAutoTUnref<const SkPicture> picture(recorder.endRecording()); | 115 SkAutoTUnref<const SkPicture> picture(recorder.endRecording()); |
| 119 | 116 |
| 120 GrLayerCache cache(context); | 117 GrLayerCache cache(context); |
| 121 | 118 |
| 122 create_layers(reporter, &cache, *picture, kInitialNumLayers, 0); | 119 create_layers(reporter, &cache, *picture, kInitialNumLayers, 0); |
| 123 | 120 |
| 124 for (unsigned i = 0; i < kInitialNumLayers; ++i) { | 121 for (unsigned i = 0; i < kInitialNumLayers; ++i) { |
| 125 unsigned indices[1] = { i + 1 }; | 122 unsigned indices[1] = { i + 1 }; |
| 126 GrCachedLayer* layer = TestingAccess::Find(&cache, picture->uniqueID
(), SkMatrix::I(), | 123 GrCachedLayer* layer = TestingAccess::Find(&cache, picture->uniqueID
(), SkMatrix::I(), |
| 127 indices, 1); | 124 indices, 1); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 241 |
| 245 picture.reset(NULL); | 242 picture.reset(NULL); |
| 246 cache.processDeletedPictures(); | 243 cache.processDeletedPictures(); |
| 247 | 244 |
| 248 REPORTER_ASSERT(reporter, TestingAccess::NumLayers(&cache) == 0); | 245 REPORTER_ASSERT(reporter, TestingAccess::NumLayers(&cache) == 0); |
| 249 // TODO: add VRAM/resource cache check here | 246 // TODO: add VRAM/resource cache check here |
| 250 } | 247 } |
| 251 } | 248 } |
| 252 | 249 |
| 253 #endif | 250 #endif |
| OLD | NEW |