OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "GrOvalRenderer.h" | 8 #include "GrOvalRenderer.h" |
9 | 9 |
10 #include "GrBatch.h" | 10 #include "GrBatch.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 }; | 219 }; |
220 | 220 |
221 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(CircleEdgeEffect); | 221 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(CircleEdgeEffect); |
222 | 222 |
223 GrGeometryProcessor* CircleEdgeEffect::TestCreate(SkRandom* random, | 223 GrGeometryProcessor* CircleEdgeEffect::TestCreate(SkRandom* random, |
224 GrContext* context, | 224 GrContext* context, |
225 const GrDrawTargetCaps&, | 225 const GrDrawTargetCaps&, |
226 GrTexture* textures[]) { | 226 GrTexture* textures[]) { |
227 return CircleEdgeEffect::Create(GrRandomColor(random), | 227 return CircleEdgeEffect::Create(GrRandomColor(random), |
228 random->nextBool(), | 228 random->nextBool(), |
229 GrProcessorUnitTest::TestMatrix(random)); | 229 GrTest::TestMatrix(random)); |
230 } | 230 } |
231 | 231 |
232 /////////////////////////////////////////////////////////////////////////////// | 232 /////////////////////////////////////////////////////////////////////////////// |
233 | 233 |
234 /** | 234 /** |
235 * The output of this effect is a modulation of the input color and coverage for
an axis-aligned | 235 * The output of this effect is a modulation of the input color and coverage for
an axis-aligned |
236 * ellipse, specified as a 2D offset from center, and the reciprocals of the out
er and inner radii, | 236 * ellipse, specified as a 2D offset from center, and the reciprocals of the out
er and inner radii, |
237 * in both x and y directions. | 237 * in both x and y directions. |
238 * | 238 * |
239 * We are using an implicit function of x^2/a^2 + y^2/b^2 - 1 = 0. | 239 * We are using an implicit function of x^2/a^2 + y^2/b^2 - 1 = 0. |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 }; | 417 }; |
418 | 418 |
419 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(EllipseEdgeEffect); | 419 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(EllipseEdgeEffect); |
420 | 420 |
421 GrGeometryProcessor* EllipseEdgeEffect::TestCreate(SkRandom* random, | 421 GrGeometryProcessor* EllipseEdgeEffect::TestCreate(SkRandom* random, |
422 GrContext* context, | 422 GrContext* context, |
423 const GrDrawTargetCaps&, | 423 const GrDrawTargetCaps&, |
424 GrTexture* textures[]) { | 424 GrTexture* textures[]) { |
425 return EllipseEdgeEffect::Create(GrRandomColor(random), | 425 return EllipseEdgeEffect::Create(GrRandomColor(random), |
426 random->nextBool(), | 426 random->nextBool(), |
427 GrProcessorUnitTest::TestMatrix(random)); | 427 GrTest::TestMatrix(random)); |
428 } | 428 } |
429 | 429 |
430 /////////////////////////////////////////////////////////////////////////////// | 430 /////////////////////////////////////////////////////////////////////////////// |
431 | 431 |
432 /** | 432 /** |
433 * The output of this effect is a modulation of the input color and coverage for
an ellipse, | 433 * The output of this effect is a modulation of the input color and coverage for
an ellipse, |
434 * specified as a 2D offset from center for both the outer and inner paths (if s
troked). The | 434 * specified as a 2D offset from center for both the outer and inner paths (if s
troked). The |
435 * implict equation used is for a unit circle (x^2 + y^2 - 1 = 0) and the edge c
orrected by | 435 * implict equation used is for a unit circle (x^2 + y^2 - 1 = 0) and the edge c
orrected by |
436 * using differentials. | 436 * using differentials. |
437 * | 437 * |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 typedef GrGeometryProcessor INHERITED; | 631 typedef GrGeometryProcessor INHERITED; |
632 }; | 632 }; |
633 | 633 |
634 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DIEllipseEdgeEffect); | 634 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DIEllipseEdgeEffect); |
635 | 635 |
636 GrGeometryProcessor* DIEllipseEdgeEffect::TestCreate(SkRandom* random, | 636 GrGeometryProcessor* DIEllipseEdgeEffect::TestCreate(SkRandom* random, |
637 GrContext* context, | 637 GrContext* context, |
638 const GrDrawTargetCaps&, | 638 const GrDrawTargetCaps&, |
639 GrTexture* textures[]) { | 639 GrTexture* textures[]) { |
640 return DIEllipseEdgeEffect::Create(GrRandomColor(random), | 640 return DIEllipseEdgeEffect::Create(GrRandomColor(random), |
641 GrProcessorUnitTest::TestMatrix(random), | 641 GrTest::TestMatrix(random), |
642 (Mode)(random->nextRangeU(0,2))); | 642 (Mode)(random->nextRangeU(0,2))); |
643 } | 643 } |
644 | 644 |
645 /////////////////////////////////////////////////////////////////////////////// | 645 /////////////////////////////////////////////////////////////////////////////// |
646 | 646 |
647 void GrOvalRenderer::reset() { | 647 void GrOvalRenderer::reset() { |
648 SkSafeSetNull(fRRectIndexBuffer); | 648 SkSafeSetNull(fRRectIndexBuffer); |
649 SkSafeSetNull(fStrokeRRectIndexBuffer); | 649 SkSafeSetNull(fStrokeRRectIndexBuffer); |
650 } | 650 } |
651 | 651 |
(...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2222 geometry.fInnerXRadius = innerXRadius; | 2222 geometry.fInnerXRadius = innerXRadius; |
2223 geometry.fInnerYRadius = innerYRadius; | 2223 geometry.fInnerYRadius = innerYRadius; |
2224 geometry.fStroke = isStrokeOnly; | 2224 geometry.fStroke = isStrokeOnly; |
2225 geometry.fDevBounds = bounds; | 2225 geometry.fDevBounds = bounds; |
2226 | 2226 |
2227 SkAutoTUnref<GrBatch> batch(RRectEllipseRendererBatch::Create(geometry,
indexBuffer)); | 2227 SkAutoTUnref<GrBatch> batch(RRectEllipseRendererBatch::Create(geometry,
indexBuffer)); |
2228 target->drawBatch(pipelineBuilder, batch, &bounds); | 2228 target->drawBatch(pipelineBuilder, batch, &bounds); |
2229 } | 2229 } |
2230 return true; | 2230 return true; |
2231 } | 2231 } |
OLD | NEW |