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

Side by Side Diff: tests/ClipCacheTest.cpp

Issue 1144013007: Remove GrContext from GrClipMaskCache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more Created 5 years, 6 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/GrResourceProvider.h ('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 2012 Google Inc. 2 * Copyright 2012 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 #include "Test.h" 8 #include "Test.h"
9 // This is a GR test 9 // This is a GR test
10 #if SK_SUPPORT_GPU 10 #if SK_SUPPORT_GPU
11 #include "GrClipMaskManager.h" 11 #include "GrClipMaskManager.h"
12 #include "GrContextFactory.h" 12 #include "GrContextFactory.h"
13 #include "SkGpuDevice.h" 13 #include "SkGpuDevice.h"
14 14
15 static const int X_SIZE = 12; 15 static const int X_SIZE = 12;
16 static const int Y_SIZE = 12; 16 static const int Y_SIZE = 12;
17 17
18 //////////////////////////////////////////////////////////////////////////////// 18 ////////////////////////////////////////////////////////////////////////////////
19 // note: this is unused 19 // note: this is unused
20 static GrTexture* createTexture(GrContext* context) { 20 static GrTexture* create_texture(GrContext* context) {
21 unsigned char textureData[X_SIZE][Y_SIZE][4]; 21 unsigned char textureData[X_SIZE][Y_SIZE][4];
22 22
23 memset(textureData, 0, 4* X_SIZE * Y_SIZE); 23 memset(textureData, 0, 4* X_SIZE * Y_SIZE);
24 24
25 GrSurfaceDesc desc; 25 GrSurfaceDesc desc;
26 26
27 // let Skia know we will be using this texture as a render target 27 // let Skia know we will be using this texture as a render target
28 desc.fFlags = kRenderTarget_GrSurfaceFlag; 28 desc.fFlags = kRenderTarget_GrSurfaceFlag;
29 desc.fConfig = kSkia8888_GrPixelConfig; 29 desc.fConfig = kSkia8888_GrPixelConfig;
30 desc.fWidth = X_SIZE; 30 desc.fWidth = X_SIZE;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 cache.getLastBound(&cacheBound); 126 cache.getLastBound(&cacheBound);
127 REPORTER_ASSERT(reporter, emptyBound == cacheBound); 127 REPORTER_ASSERT(reporter, emptyBound == cacheBound);
128 } 128 }
129 129
130 //////////////////////////////////////////////////////////////////////////////// 130 ////////////////////////////////////////////////////////////////////////////////
131 // basic test of the cache's base functionality: 131 // basic test of the cache's base functionality:
132 // push, pop, set, canReuse & getters 132 // push, pop, set, canReuse & getters
133 static void test_cache(skiatest::Reporter* reporter, GrContext* context) { 133 static void test_cache(skiatest::Reporter* reporter, GrContext* context) {
134 134
135 if (false) { // avoid bit rot, suppress warning 135 if (false) { // avoid bit rot, suppress warning
136 createTexture(context); 136 create_texture(context);
137 } 137 }
138 GrClipMaskCache cache; 138 GrClipMaskCache cache(context->resourceProvider());
139
140 cache.setContext(context);
141 139
142 // check initial state 140 // check initial state
143 check_empty_state(reporter, cache); 141 check_empty_state(reporter, cache);
144 142
145 // set the current state 143 // set the current state
146 SkIRect bound1; 144 SkIRect bound1;
147 bound1.set(0, 0, 100, 100); 145 bound1.set(0, 0, 100, 100);
148 146
149 SkClipStack clip1(bound1); 147 SkClipStack clip1(bound1);
150 148
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 if (NULL == context) { 222 if (NULL == context) {
225 continue; 223 continue;
226 } 224 }
227 225
228 test_cache(reporter, context); 226 test_cache(reporter, context);
229 test_clip_bounds(reporter, context); 227 test_clip_bounds(reporter, context);
230 } 228 }
231 } 229 }
232 230
233 #endif 231 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrResourceProvider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698