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 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
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 SK_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 GrBatch* Create(const GrGeometryProcessor* gp, const Geometry& geo, |
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) { | 49 : INHERITED(gp) { |
50 for (int i = 0; i < 9; i++) { | 50 for (int i = 0; i < 9; i++) { |
51 fKlmEqs[i] = klmEqs[i]; | 51 fKlmEqs[i] = klmEqs[i]; |
52 } | 52 } |
53 | 53 |
54 fGeometry = geo; | 54 fGeometry = geo; |
55 fSign = sign; | 55 fSign = sign; |
56 } | 56 } |
57 | 57 |
58 struct Vertex { | 58 struct Vertex { |
59 SkPoint fPosition; | 59 SkPoint fPosition; |
60 float fKLM[4]; // The last value is ignored. The effect expects a vec4
f. | 60 float fKLM[4]; // The last value is ignored. The effect expects a vec4
f. |
61 }; | 61 }; |
62 | 62 |
63 Geometry* geoData(int index) SK_OVERRIDE { | 63 Geometry* geoData(int index) override { |
64 SkASSERT(0 == index); | 64 SkASSERT(0 == index); |
65 return &fGeometry; | 65 return &fGeometry; |
66 } | 66 } |
67 | 67 |
68 void onGenerateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeli
ne) SK_OVERRIDE { | 68 void onGenerateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeli
ne) override { |
69 size_t vertexStride = this->geometryProcessor()->getVertexStride(); | 69 size_t vertexStride = this->geometryProcessor()->getVertexStride(); |
70 | 70 |
71 const GrVertexBuffer* vertexBuffer; | 71 const GrVertexBuffer* vertexBuffer; |
72 int firstVertex; | 72 int firstVertex; |
73 | 73 |
74 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, | 74 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, |
75 kVertsPerCubic, | 75 kVertsPerCubic, |
76 &vertexBuffer, | 76 &vertexBuffer, |
77 &firstVertex); | 77 &firstVertex); |
78 | 78 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 /** | 117 /** |
118 * This GM directly exercises effects that draw Bezier curves in the GPU backend
. | 118 * This GM directly exercises effects that draw Bezier curves in the GPU backend
. |
119 */ | 119 */ |
120 class BezierCubicEffects : public GM { | 120 class BezierCubicEffects : public GM { |
121 public: | 121 public: |
122 BezierCubicEffects() { | 122 BezierCubicEffects() { |
123 this->setBGColor(0xFFFFFFFF); | 123 this->setBGColor(0xFFFFFFFF); |
124 } | 124 } |
125 | 125 |
126 protected: | 126 protected: |
127 SkString onShortName() SK_OVERRIDE { | 127 SkString onShortName() override { |
128 return SkString("bezier_cubic_effects"); | 128 return SkString("bezier_cubic_effects"); |
129 } | 129 } |
130 | 130 |
131 SkISize onISize() SK_OVERRIDE { | 131 SkISize onISize() override { |
132 return SkISize::Make(800, 800); | 132 return SkISize::Make(800, 800); |
133 } | 133 } |
134 | 134 |
135 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 135 void onDraw(SkCanvas* canvas) override { |
136 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); | 136 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); |
137 if (NULL == rt) { | 137 if (NULL == rt) { |
138 this->drawGpuOnlyMessage(canvas); | 138 this->drawGpuOnlyMessage(canvas); |
139 return; | 139 return; |
140 } | 140 } |
141 GrContext* context = rt->getContext(); | 141 GrContext* context = rt->getContext(); |
142 if (NULL == context) { | 142 if (NULL == context) { |
143 return; | 143 return; |
144 } | 144 } |
145 | 145 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 /** | 263 /** |
264 * This GM directly exercises effects that draw Bezier curves in the GPU backend
. | 264 * This GM directly exercises effects that draw Bezier curves in the GPU backend
. |
265 */ | 265 */ |
266 class BezierConicEffects : public GM { | 266 class BezierConicEffects : public GM { |
267 public: | 267 public: |
268 BezierConicEffects() { | 268 BezierConicEffects() { |
269 this->setBGColor(0xFFFFFFFF); | 269 this->setBGColor(0xFFFFFFFF); |
270 } | 270 } |
271 | 271 |
272 protected: | 272 protected: |
273 SkString onShortName() SK_OVERRIDE { | 273 SkString onShortName() override { |
274 return SkString("bezier_conic_effects"); | 274 return SkString("bezier_conic_effects"); |
275 } | 275 } |
276 | 276 |
277 SkISize onISize() SK_OVERRIDE { | 277 SkISize onISize() override { |
278 return SkISize::Make(800, 800); | 278 return SkISize::Make(800, 800); |
279 } | 279 } |
280 | 280 |
281 | 281 |
282 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 282 void onDraw(SkCanvas* canvas) override { |
283 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); | 283 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); |
284 if (NULL == rt) { | 284 if (NULL == rt) { |
285 this->drawGpuOnlyMessage(canvas); | 285 this->drawGpuOnlyMessage(canvas); |
286 return; | 286 return; |
287 } | 287 } |
288 GrContext* context = rt->getContext(); | 288 GrContext* context = rt->getContext(); |
289 if (NULL == context) { | 289 if (NULL == context) { |
290 return; | 290 return; |
291 } | 291 } |
292 | 292 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 }; | 440 }; |
441 | 441 |
442 ////////////////////////////////////////////////////////////////////////////// | 442 ////////////////////////////////////////////////////////////////////////////// |
443 | 443 |
444 class BezierQuadTestBatch : public GrTestBatch { | 444 class BezierQuadTestBatch : public GrTestBatch { |
445 public: | 445 public: |
446 struct Geometry : public GrTestBatch::Geometry { | 446 struct Geometry : public GrTestBatch::Geometry { |
447 SkRect fBounds; | 447 SkRect fBounds; |
448 }; | 448 }; |
449 | 449 |
450 const char* name() const SK_OVERRIDE { return "BezierQuadTestBatch"; } | 450 const char* name() const override { return "BezierQuadTestBatch"; } |
451 | 451 |
452 static GrBatch* Create(const GrGeometryProcessor* gp, const Geometry& geo, | 452 static GrBatch* Create(const GrGeometryProcessor* gp, const Geometry& geo, |
453 const GrPathUtils::QuadUVMatrix& devToUV) { | 453 const GrPathUtils::QuadUVMatrix& devToUV) { |
454 return SkNEW_ARGS(BezierQuadTestBatch, (gp, geo, devToUV)); | 454 return SkNEW_ARGS(BezierQuadTestBatch, (gp, geo, devToUV)); |
455 } | 455 } |
456 | 456 |
457 private: | 457 private: |
458 BezierQuadTestBatch(const GrGeometryProcessor* gp, const Geometry& geo, | 458 BezierQuadTestBatch(const GrGeometryProcessor* gp, const Geometry& geo, |
459 const GrPathUtils::QuadUVMatrix& devToUV) | 459 const GrPathUtils::QuadUVMatrix& devToUV) |
460 : INHERITED(gp) | 460 : INHERITED(gp) |
461 , fGeometry(geo) | 461 , fGeometry(geo) |
462 , fDevToUV(devToUV) { | 462 , fDevToUV(devToUV) { |
463 } | 463 } |
464 | 464 |
465 struct Vertex { | 465 struct Vertex { |
466 SkPoint fPosition; | 466 SkPoint fPosition; |
467 float fKLM[4]; // The last value is ignored. The effect expects a vec4
f. | 467 float fKLM[4]; // The last value is ignored. The effect expects a vec4
f. |
468 }; | 468 }; |
469 | 469 |
470 Geometry* geoData(int index) SK_OVERRIDE { | 470 Geometry* geoData(int index) override { |
471 SkASSERT(0 == index); | 471 SkASSERT(0 == index); |
472 return &fGeometry; | 472 return &fGeometry; |
473 } | 473 } |
474 | 474 |
475 void onGenerateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeli
ne) SK_OVERRIDE { | 475 void onGenerateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeli
ne) override { |
476 size_t vertexStride = this->geometryProcessor()->getVertexStride(); | 476 size_t vertexStride = this->geometryProcessor()->getVertexStride(); |
477 | 477 |
478 const GrVertexBuffer* vertexBuffer; | 478 const GrVertexBuffer* vertexBuffer; |
479 int firstVertex; | 479 int firstVertex; |
480 | 480 |
481 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, | 481 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, |
482 kVertsPerCubic, | 482 kVertsPerCubic, |
483 &vertexBuffer, | 483 &vertexBuffer, |
484 &firstVertex); | 484 &firstVertex); |
485 | 485 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 /** | 521 /** |
522 * This GM directly exercises effects that draw Bezier quad curves in the GPU ba
ckend. | 522 * This GM directly exercises effects that draw Bezier quad curves in the GPU ba
ckend. |
523 */ | 523 */ |
524 class BezierQuadEffects : public GM { | 524 class BezierQuadEffects : public GM { |
525 public: | 525 public: |
526 BezierQuadEffects() { | 526 BezierQuadEffects() { |
527 this->setBGColor(0xFFFFFFFF); | 527 this->setBGColor(0xFFFFFFFF); |
528 } | 528 } |
529 | 529 |
530 protected: | 530 protected: |
531 SkString onShortName() SK_OVERRIDE { | 531 SkString onShortName() override { |
532 return SkString("bezier_quad_effects"); | 532 return SkString("bezier_quad_effects"); |
533 } | 533 } |
534 | 534 |
535 SkISize onISize() SK_OVERRIDE { | 535 SkISize onISize() override { |
536 return SkISize::Make(800, 800); | 536 return SkISize::Make(800, 800); |
537 } | 537 } |
538 | 538 |
539 | 539 |
540 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 540 void onDraw(SkCanvas* canvas) override { |
541 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); | 541 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); |
542 if (NULL == rt) { | 542 if (NULL == rt) { |
543 this->drawGpuOnlyMessage(canvas); | 543 this->drawGpuOnlyMessage(canvas); |
544 return; | 544 return; |
545 } | 545 } |
546 GrContext* context = rt->getContext(); | 546 GrContext* context = rt->getContext(); |
547 if (NULL == context) { | 547 if (NULL == context) { |
548 return; | 548 return; |
549 } | 549 } |
550 | 550 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 typedef GM INHERITED; | 656 typedef GM INHERITED; |
657 }; | 657 }; |
658 | 658 |
659 DEF_GM( return SkNEW(BezierCubicEffects); ) | 659 DEF_GM( return SkNEW(BezierCubicEffects); ) |
660 DEF_GM( return SkNEW(BezierConicEffects); ) | 660 DEF_GM( return SkNEW(BezierConicEffects); ) |
661 DEF_GM( return SkNEW(BezierQuadEffects); ) | 661 DEF_GM( return SkNEW(BezierQuadEffects); ) |
662 | 662 |
663 } | 663 } |
664 | 664 |
665 #endif | 665 #endif |
OLD | NEW |