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

Side by Side Diff: tests/GpuLayerCacheTest.cpp

Issue 559603004: Separate replacement creation from layer discovery (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixed initializer list order Created 6 years, 3 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/gpu/SkGpuDevice.cpp ('k') | no next file » | 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 16 matching lines...) Expand all
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
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
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698