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 20 matching lines...) Expand all Loading... |
31 namespace skiagm { | 31 namespace skiagm { |
32 | 32 |
33 class BezierCubicOrConicTestBatch : public GrTestBatch { | 33 class BezierCubicOrConicTestBatch : public GrTestBatch { |
34 public: | 34 public: |
35 struct Geometry : public GrTestBatch::Geometry { | 35 struct Geometry : public GrTestBatch::Geometry { |
36 SkRect fBounds; | 36 SkRect fBounds; |
37 }; | 37 }; |
38 | 38 |
39 const char* name() const override { return "BezierCubicOrConicTestBatch"; } | 39 const char* name() const override { return "BezierCubicOrConicTestBatch"; } |
40 | 40 |
41 static GrBatch* Create(const GrGeometryProcessor* gp, const Geometry& geo, | 41 static GrDrawBatch* Create(const GrGeometryProcessor* gp, const Geometry& ge
o, |
42 const SkScalar klmEqs[9], SkScalar sign) { | 42 const SkScalar klmEqs[9], SkScalar sign) { |
43 return SkNEW_ARGS(BezierCubicOrConicTestBatch, (gp, geo, klmEqs, sign)); | 43 return SkNEW_ARGS(BezierCubicOrConicTestBatch, (gp, geo, klmEqs, sign)); |
44 } | 44 } |
45 | 45 |
46 private: | 46 private: |
47 BezierCubicOrConicTestBatch(const GrGeometryProcessor* gp, const Geometry& g
eo, | 47 BezierCubicOrConicTestBatch(const GrGeometryProcessor* gp, const Geometry& g
eo, |
48 const SkScalar klmEqs[9], SkScalar sign) | 48 const SkScalar klmEqs[9], SkScalar sign) |
49 : INHERITED(gp, geo.fBounds) { | 49 : INHERITED(gp, geo.fBounds) { |
50 this->initClassID<BezierCubicOrConicTestBatch>(); | 50 this->initClassID<BezierCubicOrConicTestBatch>(); |
51 for (int i = 0; i < 9; i++) { | 51 for (int i = 0; i < 9; i++) { |
52 fKlmEqs[i] = klmEqs[i]; | 52 fKlmEqs[i] = klmEqs[i]; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 context->getTestTarget(&tt); | 221 context->getTestTarget(&tt); |
222 SkASSERT(tt.target()); | 222 SkASSERT(tt.target()); |
223 | 223 |
224 GrPipelineBuilder pipelineBuilder; | 224 GrPipelineBuilder pipelineBuilder; |
225 pipelineBuilder.setRenderTarget(rt); | 225 pipelineBuilder.setRenderTarget(rt); |
226 | 226 |
227 BezierCubicOrConicTestBatch::Geometry geometry; | 227 BezierCubicOrConicTestBatch::Geometry geometry; |
228 geometry.fColor = color; | 228 geometry.fColor = color; |
229 geometry.fBounds = bounds; | 229 geometry.fBounds = bounds; |
230 | 230 |
231 SkAutoTUnref<GrBatch> batch( | 231 SkAutoTUnref<GrDrawBatch> batch( |
232 BezierCubicOrConicTestBatch::Create(gp, geometry, kl
mEqs, klmSigns[c])); | 232 BezierCubicOrConicTestBatch::Create(gp, geometry, kl
mEqs, klmSigns[c])); |
233 | 233 |
234 tt.target()->drawBatch(pipelineBuilder, batch); | 234 tt.target()->drawBatch(pipelineBuilder, batch); |
235 } | 235 } |
236 ++col; | 236 ++col; |
237 if (numCols == col) { | 237 if (numCols == col) { |
238 col = 0; | 238 col = 0; |
239 ++row; | 239 ++row; |
240 } | 240 } |
241 } | 241 } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 context->getTestTarget(&tt); | 366 context->getTestTarget(&tt); |
367 SkASSERT(tt.target()); | 367 SkASSERT(tt.target()); |
368 | 368 |
369 GrPipelineBuilder pipelineBuilder; | 369 GrPipelineBuilder pipelineBuilder; |
370 pipelineBuilder.setRenderTarget(rt); | 370 pipelineBuilder.setRenderTarget(rt); |
371 | 371 |
372 BezierCubicOrConicTestBatch::Geometry geometry; | 372 BezierCubicOrConicTestBatch::Geometry geometry; |
373 geometry.fColor = color; | 373 geometry.fColor = color; |
374 geometry.fBounds = bounds; | 374 geometry.fBounds = bounds; |
375 | 375 |
376 SkAutoTUnref<GrBatch> batch( | 376 SkAutoTUnref<GrDrawBatch> batch( |
377 BezierCubicOrConicTestBatch::Create(gp, geometry, kl
mEqs, 1.f)); | 377 BezierCubicOrConicTestBatch::Create(gp, geometry, kl
mEqs, 1.f)); |
378 | 378 |
379 tt.target()->drawBatch(pipelineBuilder, batch); | 379 tt.target()->drawBatch(pipelineBuilder, batch); |
380 } | 380 } |
381 ++col; | 381 ++col; |
382 if (numCols == col) { | 382 if (numCols == col) { |
383 col = 0; | 383 col = 0; |
384 ++row; | 384 ++row; |
385 } | 385 } |
386 } | 386 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 ////////////////////////////////////////////////////////////////////////////// | 431 ////////////////////////////////////////////////////////////////////////////// |
432 | 432 |
433 class BezierQuadTestBatch : public GrTestBatch { | 433 class BezierQuadTestBatch : public GrTestBatch { |
434 public: | 434 public: |
435 struct Geometry : public GrTestBatch::Geometry { | 435 struct Geometry : public GrTestBatch::Geometry { |
436 SkRect fBounds; | 436 SkRect fBounds; |
437 }; | 437 }; |
438 | 438 |
439 const char* name() const override { return "BezierQuadTestBatch"; } | 439 const char* name() const override { return "BezierQuadTestBatch"; } |
440 | 440 |
441 static GrBatch* Create(const GrGeometryProcessor* gp, const Geometry& geo, | 441 static GrDrawBatch* Create(const GrGeometryProcessor* gp, const Geometry& ge
o, |
442 const GrPathUtils::QuadUVMatrix& devToUV) { | 442 const GrPathUtils::QuadUVMatrix& devToUV) { |
443 return SkNEW_ARGS(BezierQuadTestBatch, (gp, geo, devToUV)); | 443 return SkNEW_ARGS(BezierQuadTestBatch, (gp, geo, devToUV)); |
444 } | 444 } |
445 | 445 |
446 private: | 446 private: |
447 BezierQuadTestBatch(const GrGeometryProcessor* gp, const Geometry& geo, | 447 BezierQuadTestBatch(const GrGeometryProcessor* gp, const Geometry& geo, |
448 const GrPathUtils::QuadUVMatrix& devToUV) | 448 const GrPathUtils::QuadUVMatrix& devToUV) |
449 : INHERITED(gp, geo.fBounds) | 449 : INHERITED(gp, geo.fBounds) |
450 , fGeometry(geo) | 450 , fGeometry(geo) |
451 , fDevToUV(devToUV) { | 451 , fDevToUV(devToUV) { |
452 this->initClassID<BezierQuadTestBatch>(); | 452 this->initClassID<BezierQuadTestBatch>(); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 | 606 |
607 GrPipelineBuilder pipelineBuilder; | 607 GrPipelineBuilder pipelineBuilder; |
608 pipelineBuilder.setRenderTarget(rt); | 608 pipelineBuilder.setRenderTarget(rt); |
609 | 609 |
610 GrPathUtils::QuadUVMatrix DevToUV(pts); | 610 GrPathUtils::QuadUVMatrix DevToUV(pts); |
611 | 611 |
612 BezierQuadTestBatch::Geometry geometry; | 612 BezierQuadTestBatch::Geometry geometry; |
613 geometry.fColor = color; | 613 geometry.fColor = color; |
614 geometry.fBounds = bounds; | 614 geometry.fBounds = bounds; |
615 | 615 |
616 SkAutoTUnref<GrBatch> batch(BezierQuadTestBatch::Create(gp,
geometry, DevToUV)); | 616 SkAutoTUnref<GrDrawBatch> batch(BezierQuadTestBatch::Create(
gp, geometry, |
| 617
DevToUV)); |
617 | 618 |
618 tt.target()->drawBatch(pipelineBuilder, batch); | 619 tt.target()->drawBatch(pipelineBuilder, batch); |
619 } | 620 } |
620 ++col; | 621 ++col; |
621 if (numCols == col) { | 622 if (numCols == col) { |
622 col = 0; | 623 col = 0; |
623 ++row; | 624 ++row; |
624 } | 625 } |
625 } | 626 } |
626 } | 627 } |
627 } | 628 } |
628 | 629 |
629 private: | 630 private: |
630 typedef GM INHERITED; | 631 typedef GM INHERITED; |
631 }; | 632 }; |
632 | 633 |
633 DEF_GM( return SkNEW(BezierCubicEffects); ) | 634 DEF_GM( return SkNEW(BezierCubicEffects); ) |
634 DEF_GM( return SkNEW(BezierConicEffects); ) | 635 DEF_GM( return SkNEW(BezierConicEffects); ) |
635 DEF_GM( return SkNEW(BezierQuadEffects); ) | 636 DEF_GM( return SkNEW(BezierQuadEffects); ) |
636 | 637 |
637 } | 638 } |
638 | 639 |
639 #endif | 640 #endif |
OLD | NEW |