| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 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 test only works with the GPU backend. | 9 // This test only works with the GPU backend. |
| 10 | 10 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 SkPoint baseControlPts[] = { | 150 SkPoint baseControlPts[] = { |
| 151 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 151 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
| 152 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 152 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
| 153 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 153 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
| 154 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} | 154 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} |
| 155 }; | 155 }; |
| 156 for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType
) { | 156 for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType
) { |
| 157 SkAutoTUnref<GrGeometryProcessor> gp; | 157 SkAutoTUnref<GrGeometryProcessor> gp; |
| 158 { // scope to contain GrTestTarget | 158 { // scope to contain GrTestTarget |
| 159 GrTestTarget tt; | 159 GrTestTarget tt; |
| 160 context->getTestTarget(&tt); | 160 context->getTestTarget(&tt, rt); |
| 161 if (nullptr == tt.target()) { | 161 if (nullptr == tt.target()) { |
| 162 continue; | 162 continue; |
| 163 } | 163 } |
| 164 GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; | 164 GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; |
| 165 gp.reset(GrCubicEffect::Create(color, SkMatrix::I(), et, | 165 gp.reset(GrCubicEffect::Create(color, SkMatrix::I(), et, |
| 166 *tt.target()->caps())); | 166 *tt.target()->caps())); |
| 167 if (!gp) { | 167 if (!gp) { |
| 168 continue; | 168 continue; |
| 169 } | 169 } |
| 170 } | 170 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 SkRect bounds; | 210 SkRect bounds; |
| 211 bounds.set(pts, 4); | 211 bounds.set(pts, 4); |
| 212 | 212 |
| 213 SkPaint boundsPaint; | 213 SkPaint boundsPaint; |
| 214 boundsPaint.setColor(0xff808080); | 214 boundsPaint.setColor(0xff808080); |
| 215 boundsPaint.setStrokeWidth(0); | 215 boundsPaint.setStrokeWidth(0); |
| 216 boundsPaint.setStyle(SkPaint::kStroke_Style); | 216 boundsPaint.setStyle(SkPaint::kStroke_Style); |
| 217 canvas->drawRect(bounds, boundsPaint); | 217 canvas->drawRect(bounds, boundsPaint); |
| 218 | 218 |
| 219 GrTestTarget tt; | 219 GrTestTarget tt; |
| 220 context->getTestTarget(&tt); | 220 context->getTestTarget(&tt, rt); |
| 221 SkASSERT(tt.target()); | 221 SkASSERT(tt.target()); |
| 222 | 222 |
| 223 GrPipelineBuilder pipelineBuilder; | 223 GrPipelineBuilder pipelineBuilder; |
| 224 pipelineBuilder.setRenderTarget(rt); | 224 pipelineBuilder.setRenderTarget(rt); |
| 225 | 225 |
| 226 BezierCubicOrConicTestBatch::Geometry geometry; | 226 BezierCubicOrConicTestBatch::Geometry geometry; |
| 227 geometry.fColor = color; | 227 geometry.fColor = color; |
| 228 geometry.fBounds = bounds; | 228 geometry.fBounds = bounds; |
| 229 | 229 |
| 230 SkAutoTUnref<GrDrawBatch> batch( | 230 SkAutoTUnref<GrDrawBatch> batch( |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 SkPoint baseControlPts[] = { | 298 SkPoint baseControlPts[] = { |
| 299 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 299 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
| 300 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 300 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
| 301 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} | 301 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} |
| 302 }; | 302 }; |
| 303 SkScalar weight = rand.nextRangeF(0.f, 2.f); | 303 SkScalar weight = rand.nextRangeF(0.f, 2.f); |
| 304 for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType
) { | 304 for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType
) { |
| 305 SkAutoTUnref<GrGeometryProcessor> gp; | 305 SkAutoTUnref<GrGeometryProcessor> gp; |
| 306 { // scope to contain GrTestTarget | 306 { // scope to contain GrTestTarget |
| 307 GrTestTarget tt; | 307 GrTestTarget tt; |
| 308 context->getTestTarget(&tt); | 308 context->getTestTarget(&tt, rt); |
| 309 if (nullptr == tt.target()) { | 309 if (nullptr == tt.target()) { |
| 310 continue; | 310 continue; |
| 311 } | 311 } |
| 312 GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; | 312 GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; |
| 313 gp.reset(GrConicEffect::Create(color, SkMatrix::I(), et, | 313 gp.reset(GrConicEffect::Create(color, SkMatrix::I(), et, |
| 314 *tt.target()->caps(), SkMatri
x::I(), false)); | 314 *tt.target()->caps(), SkMatri
x::I(), false)); |
| 315 if (!gp) { | 315 if (!gp) { |
| 316 continue; | 316 continue; |
| 317 } | 317 } |
| 318 } | 318 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 //bounds.set(bPts, 2); | 355 //bounds.set(bPts, 2); |
| 356 bounds.set(pts, 3); | 356 bounds.set(pts, 3); |
| 357 | 357 |
| 358 SkPaint boundsPaint; | 358 SkPaint boundsPaint; |
| 359 boundsPaint.setColor(0xff808080); | 359 boundsPaint.setColor(0xff808080); |
| 360 boundsPaint.setStrokeWidth(0); | 360 boundsPaint.setStrokeWidth(0); |
| 361 boundsPaint.setStyle(SkPaint::kStroke_Style); | 361 boundsPaint.setStyle(SkPaint::kStroke_Style); |
| 362 canvas->drawRect(bounds, boundsPaint); | 362 canvas->drawRect(bounds, boundsPaint); |
| 363 | 363 |
| 364 GrTestTarget tt; | 364 GrTestTarget tt; |
| 365 context->getTestTarget(&tt); | 365 context->getTestTarget(&tt, rt); |
| 366 SkASSERT(tt.target()); | 366 SkASSERT(tt.target()); |
| 367 | 367 |
| 368 GrPipelineBuilder pipelineBuilder; | 368 GrPipelineBuilder pipelineBuilder; |
| 369 pipelineBuilder.setRenderTarget(rt); | 369 pipelineBuilder.setRenderTarget(rt); |
| 370 | 370 |
| 371 BezierCubicOrConicTestBatch::Geometry geometry; | 371 BezierCubicOrConicTestBatch::Geometry geometry; |
| 372 geometry.fColor = color; | 372 geometry.fColor = color; |
| 373 geometry.fBounds = bounds; | 373 geometry.fBounds = bounds; |
| 374 | 374 |
| 375 SkAutoTUnref<GrDrawBatch> batch( | 375 SkAutoTUnref<GrDrawBatch> batch( |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 for (int i = 0; i < kNumQuads; ++i) { | 539 for (int i = 0; i < kNumQuads; ++i) { |
| 540 SkPoint baseControlPts[] = { | 540 SkPoint baseControlPts[] = { |
| 541 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 541 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
| 542 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, | 542 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
| 543 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} | 543 {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} |
| 544 }; | 544 }; |
| 545 for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType
) { | 545 for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType
) { |
| 546 SkAutoTUnref<GrGeometryProcessor> gp; | 546 SkAutoTUnref<GrGeometryProcessor> gp; |
| 547 { // scope to contain GrTestTarget | 547 { // scope to contain GrTestTarget |
| 548 GrTestTarget tt; | 548 GrTestTarget tt; |
| 549 context->getTestTarget(&tt); | 549 context->getTestTarget(&tt, rt); |
| 550 if (nullptr == tt.target()) { | 550 if (nullptr == tt.target()) { |
| 551 continue; | 551 continue; |
| 552 } | 552 } |
| 553 GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; | 553 GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; |
| 554 gp.reset(GrQuadEffect::Create(color, SkMatrix::I(), et, | 554 gp.reset(GrQuadEffect::Create(color, SkMatrix::I(), et, |
| 555 *tt.target()->caps(), SkMatrix
::I(), false)); | 555 *tt.target()->caps(), SkMatrix
::I(), false)); |
| 556 if (!gp) { | 556 if (!gp) { |
| 557 continue; | 557 continue; |
| 558 } | 558 } |
| 559 } | 559 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 SkRect bounds; | 593 SkRect bounds; |
| 594 bounds.set(pts, 3); | 594 bounds.set(pts, 3); |
| 595 | 595 |
| 596 SkPaint boundsPaint; | 596 SkPaint boundsPaint; |
| 597 boundsPaint.setColor(0xff808080); | 597 boundsPaint.setColor(0xff808080); |
| 598 boundsPaint.setStrokeWidth(0); | 598 boundsPaint.setStrokeWidth(0); |
| 599 boundsPaint.setStyle(SkPaint::kStroke_Style); | 599 boundsPaint.setStyle(SkPaint::kStroke_Style); |
| 600 canvas->drawRect(bounds, boundsPaint); | 600 canvas->drawRect(bounds, boundsPaint); |
| 601 | 601 |
| 602 GrTestTarget tt; | 602 GrTestTarget tt; |
| 603 context->getTestTarget(&tt); | 603 context->getTestTarget(&tt, rt); |
| 604 SkASSERT(tt.target()); | 604 SkASSERT(tt.target()); |
| 605 | 605 |
| 606 GrPipelineBuilder pipelineBuilder; | 606 GrPipelineBuilder pipelineBuilder; |
| 607 pipelineBuilder.setRenderTarget(rt); | 607 pipelineBuilder.setRenderTarget(rt); |
| 608 | 608 |
| 609 GrPathUtils::QuadUVMatrix DevToUV(pts); | 609 GrPathUtils::QuadUVMatrix DevToUV(pts); |
| 610 | 610 |
| 611 BezierQuadTestBatch::Geometry geometry; | 611 BezierQuadTestBatch::Geometry geometry; |
| 612 geometry.fColor = color; | 612 geometry.fColor = color; |
| 613 geometry.fBounds = bounds; | 613 geometry.fBounds = bounds; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 629 private: | 629 private: |
| 630 typedef GM INHERITED; | 630 typedef GM INHERITED; |
| 631 }; | 631 }; |
| 632 | 632 |
| 633 DEF_GM(return new BezierCubicEffects;) | 633 DEF_GM(return new BezierCubicEffects;) |
| 634 DEF_GM(return new BezierConicEffects;) | 634 DEF_GM(return new BezierConicEffects;) |
| 635 DEF_GM(return new BezierQuadEffects;) | 635 DEF_GM(return new BezierQuadEffects;) |
| 636 } | 636 } |
| 637 | 637 |
| 638 #endif | 638 #endif |
| OLD | NEW |