Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: tests/GpuLayerCacheTest.cpp

Issue 1112523006: Sketch splitting SkPicture into an interface and SkBigPicture. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: note Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/utils/SkPictureUtils.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/utils/SkPictureUtils.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698