OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 // This is a GPU-backend specific test. It relies on static intializers to work | 9 // This is a GPU-backend specific test. It relies on static intializers to work |
10 | 10 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 GrScissorState scissor; | 241 GrScissorState scissor; |
242 | 242 |
243 // setup clip | 243 // setup clip |
244 SkRect screen = SkRect::MakeWH(SkIntToScalar(kRenderTargetWidth), | 244 SkRect screen = SkRect::MakeWH(SkIntToScalar(kRenderTargetWidth), |
245 SkIntToScalar(kRenderTargetHeight)); | 245 SkIntToScalar(kRenderTargetHeight)); |
246 | 246 |
247 SkClipStack stack; | 247 SkClipStack stack; |
248 stack.clipDevRect(screen, SkRegion::kReplace_Op, false); | 248 stack.clipDevRect(screen, SkRegion::kReplace_Op, false); |
249 | 249 |
250 // wrap the SkClipStack in a GrClipData | 250 // wrap the SkClipStack in a GrClipData |
251 GrClipData clipData; | 251 GrClip clip; |
252 clipData.fClipStack.reset(SkRef(&stack)); | 252 clip.setClipStack(&stack); |
253 this->setClip(&clipData); | |
254 | 253 |
255 SkRandom random; | 254 SkRandom random; |
256 static const int NUM_TESTS = 512; | 255 static const int NUM_TESTS = 512; |
257 for (int t = 0; t < NUM_TESTS;) { | 256 for (int t = 0; t < NUM_TESTS;) { |
258 // setup random render target(can fail) | 257 // setup random render target(can fail) |
259 SkAutoTUnref<GrRenderTarget> rt(random_render_target(fContext, &random))
; | 258 SkAutoTUnref<GrRenderTarget> rt(random_render_target(fContext, &random))
; |
260 if (!rt.get()) { | 259 if (!rt.get()) { |
261 SkDebugf("Could not allocate render target"); | 260 SkDebugf("Could not allocate render target"); |
262 return false; | 261 return false; |
263 } | 262 } |
264 | 263 |
265 GrPipelineBuilder pipelineBuilder; | 264 GrPipelineBuilder pipelineBuilder; |
266 pipelineBuilder.setRenderTarget(rt.get()); | 265 pipelineBuilder.setRenderTarget(rt.get()); |
| 266 pipelineBuilder.setClip(clip); |
267 | 267 |
268 // if path rendering we have to setup a couple of things like the draw t
ype | 268 // if path rendering we have to setup a couple of things like the draw t
ype |
269 bool usePathRendering = gpu->glCaps().pathRenderingSupport() && random.n
extBool(); | 269 bool usePathRendering = gpu->glCaps().pathRenderingSupport() && random.n
extBool(); |
270 | 270 |
271 // twiddle drawstate knobs randomly | 271 // twiddle drawstate knobs randomly |
272 bool hasGeometryProcessor = !usePathRendering; | 272 bool hasGeometryProcessor = !usePathRendering; |
273 SkAutoTUnref<const GrGeometryProcessor> gp; | 273 SkAutoTUnref<const GrGeometryProcessor> gp; |
274 SkAutoTUnref<const GrPathProcessor> pathProc; | 274 SkAutoTUnref<const GrPathProcessor> pathProc; |
275 if (hasGeometryProcessor) { | 275 if (hasGeometryProcessor) { |
276 gp.reset(get_random_gp(fContext, gpu->glCaps(), &random, dummyTextur
es)); | 276 gp.reset(get_random_gp(fContext, gpu->glCaps(), &random, dummyTextur
es)); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 } | 364 } |
365 #endif | 365 #endif |
366 GrTestTarget target; | 366 GrTestTarget target; |
367 context->getTestTarget(&target); | 367 context->getTestTarget(&target); |
368 REPORTER_ASSERT(reporter, target.target()->programUnitTest(maxStages
)); | 368 REPORTER_ASSERT(reporter, target.target()->programUnitTest(maxStages
)); |
369 } | 369 } |
370 } | 370 } |
371 } | 371 } |
372 | 372 |
373 #endif | 373 #endif |
OLD | NEW |