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

Side by Side Diff: tests/ClipCacheTest.cpp

Issue 682223002: rename GrTextureDesc->GrSurfaceDesc, GrTextureFlags->GrSurfaceFlags (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: const Created 6 years, 1 month 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 | « tests/BlurTest.cpp ('k') | tests/FloatingPointTextureTest.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 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 "../../src/gpu/GrClipMaskManager.h" 11 #include "../../src/gpu/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* createTexture(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 GrTextureDesc 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_GrTextureFlagBit; 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;
31 desc.fHeight = Y_SIZE; 31 desc.fHeight = Y_SIZE;
32 32
33 // We are initializing the texture with zeros here 33 // We are initializing the texture with zeros here
34 GrTexture* texture = context->createUncachedTexture(desc, textureData, 0); 34 GrTexture* texture = context->createUncachedTexture(desc, textureData, 0);
35 if (!texture) { 35 if (!texture) {
36 return NULL; 36 return NULL;
37 } 37 }
38 38
39 return texture; 39 return texture;
40 } 40 }
41 41
42 // Ensure that the 'getConservativeBounds' calls are returning bounds clamped 42 // Ensure that the 'getConservativeBounds' calls are returning bounds clamped
43 // to the render target 43 // to the render target
44 static void test_clip_bounds(skiatest::Reporter* reporter, GrContext* context) { 44 static void test_clip_bounds(skiatest::Reporter* reporter, GrContext* context) {
45 45
46 static const int kXSize = 100; 46 static const int kXSize = 100;
47 static const int kYSize = 100; 47 static const int kYSize = 100;
48 48
49 GrTextureDesc desc; 49 GrSurfaceDesc desc;
50 desc.fFlags = kRenderTarget_GrTextureFlagBit; 50 desc.fFlags = kRenderTarget_GrSurfaceFlag;
51 desc.fConfig = kAlpha_8_GrPixelConfig; 51 desc.fConfig = kAlpha_8_GrPixelConfig;
52 desc.fWidth = kXSize; 52 desc.fWidth = kXSize;
53 desc.fHeight = kYSize; 53 desc.fHeight = kYSize;
54 54
55 GrTexture* texture = context->createUncachedTexture(desc, NULL, 0); 55 GrTexture* texture = context->createUncachedTexture(desc, NULL, 0);
56 if (!texture) { 56 if (!texture) {
57 return; 57 return;
58 } 58 }
59 59
60 SkAutoTUnref<GrTexture> au(texture); 60 SkAutoTUnref<GrTexture> au(texture);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 // check initial state 142 // check initial state
143 check_empty_state(reporter, cache); 143 check_empty_state(reporter, cache);
144 144
145 // set the current state 145 // set the current state
146 SkIRect bound1; 146 SkIRect bound1;
147 bound1.set(0, 0, 100, 100); 147 bound1.set(0, 0, 100, 100);
148 148
149 SkClipStack clip1(bound1); 149 SkClipStack clip1(bound1);
150 150
151 GrTextureDesc desc; 151 GrSurfaceDesc desc;
152 desc.fFlags = kRenderTarget_GrTextureFlagBit; 152 desc.fFlags = kRenderTarget_GrSurfaceFlag;
153 desc.fWidth = X_SIZE; 153 desc.fWidth = X_SIZE;
154 desc.fHeight = Y_SIZE; 154 desc.fHeight = Y_SIZE;
155 desc.fConfig = kSkia8888_GrPixelConfig; 155 desc.fConfig = kSkia8888_GrPixelConfig;
156 156
157 cache.acquireMask(clip1.getTopmostGenID(), desc, bound1); 157 cache.acquireMask(clip1.getTopmostGenID(), desc, bound1);
158 158
159 GrTexture* texture1 = cache.getLastMask(); 159 GrTexture* texture1 = cache.getLastMask();
160 REPORTER_ASSERT(reporter, texture1); 160 REPORTER_ASSERT(reporter, texture1);
161 if (NULL == texture1) { 161 if (NULL == texture1) {
162 return; 162 return;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 if (NULL == context) { 224 if (NULL == context) {
225 continue; 225 continue;
226 } 226 }
227 227
228 test_cache(reporter, context); 228 test_cache(reporter, context);
229 test_clip_bounds(reporter, context); 229 test_clip_bounds(reporter, context);
230 } 230 }
231 } 231 }
232 232
233 #endif 233 #endif
OLDNEW
« no previous file with comments | « tests/BlurTest.cpp ('k') | tests/FloatingPointTextureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698