| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 bool fStroke; | 196 bool fStroke; |
| 197 bool fUsesLocalCoords; | 197 bool fUsesLocalCoords; |
| 198 | 198 |
| 199 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 199 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 200 | 200 |
| 201 typedef GrGeometryProcessor INHERITED; | 201 typedef GrGeometryProcessor INHERITED; |
| 202 }; | 202 }; |
| 203 | 203 |
| 204 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(CircleEdgeEffect); | 204 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(CircleEdgeEffect); |
| 205 | 205 |
| 206 GrGeometryProcessor* CircleEdgeEffect::TestCreate(SkRandom* random, | 206 GrGeometryProcessor* CircleEdgeEffect::TestCreate(GrProcessorTestData* d) { |
| 207 GrContext* context, | 207 return CircleEdgeEffect::Create(GrRandomColor(d->fRandom), |
| 208 const GrCaps&, | 208 d->fRandom->nextBool(), |
| 209 GrTexture* textures[]) { | 209 GrTest::TestMatrix(d->fRandom), |
| 210 return CircleEdgeEffect::Create(GrRandomColor(random), | 210 d->fRandom->nextBool()); |
| 211 random->nextBool(), | |
| 212 GrTest::TestMatrix(random), | |
| 213 random->nextBool()); | |
| 214 } | 211 } |
| 215 | 212 |
| 216 /////////////////////////////////////////////////////////////////////////////// | 213 /////////////////////////////////////////////////////////////////////////////// |
| 217 | 214 |
| 218 /** | 215 /** |
| 219 * The output of this effect is a modulation of the input color and coverage for
an axis-aligned | 216 * The output of this effect is a modulation of the input color and coverage for
an axis-aligned |
| 220 * ellipse, specified as a 2D offset from center, and the reciprocals of the out
er and inner radii, | 217 * ellipse, specified as a 2D offset from center, and the reciprocals of the out
er and inner radii, |
| 221 * in both x and y directions. | 218 * in both x and y directions. |
| 222 * | 219 * |
| 223 * We are using an implicit function of x^2/a^2 + y^2/b^2 - 1 = 0. | 220 * We are using an implicit function of x^2/a^2 + y^2/b^2 - 1 = 0. |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 bool fStroke; | 375 bool fStroke; |
| 379 bool fUsesLocalCoords; | 376 bool fUsesLocalCoords; |
| 380 | 377 |
| 381 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 378 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 382 | 379 |
| 383 typedef GrGeometryProcessor INHERITED; | 380 typedef GrGeometryProcessor INHERITED; |
| 384 }; | 381 }; |
| 385 | 382 |
| 386 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(EllipseEdgeEffect); | 383 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(EllipseEdgeEffect); |
| 387 | 384 |
| 388 GrGeometryProcessor* EllipseEdgeEffect::TestCreate(SkRandom* random, | 385 GrGeometryProcessor* EllipseEdgeEffect::TestCreate(GrProcessorTestData* d) { |
| 389 GrContext* context, | 386 return EllipseEdgeEffect::Create(GrRandomColor(d->fRandom), |
| 390 const GrCaps&, | 387 d->fRandom->nextBool(), |
| 391 GrTexture* textures[]) { | 388 GrTest::TestMatrix(d->fRandom), |
| 392 return EllipseEdgeEffect::Create(GrRandomColor(random), | 389 d->fRandom->nextBool()); |
| 393 random->nextBool(), | |
| 394 GrTest::TestMatrix(random), | |
| 395 random->nextBool()); | |
| 396 } | 390 } |
| 397 | 391 |
| 398 /////////////////////////////////////////////////////////////////////////////// | 392 /////////////////////////////////////////////////////////////////////////////// |
| 399 | 393 |
| 400 /** | 394 /** |
| 401 * The output of this effect is a modulation of the input color and coverage for
an ellipse, | 395 * The output of this effect is a modulation of the input color and coverage for
an ellipse, |
| 402 * specified as a 2D offset from center for both the outer and inner paths (if s
troked). The | 396 * specified as a 2D offset from center for both the outer and inner paths (if s
troked). The |
| 403 * implict equation used is for a unit circle (x^2 + y^2 - 1 = 0) and the edge c
orrected by | 397 * implict equation used is for a unit circle (x^2 + y^2 - 1 = 0) and the edge c
orrected by |
| 404 * using differentials. | 398 * using differentials. |
| 405 * | 399 * |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 Mode fMode; | 576 Mode fMode; |
| 583 bool fUsesLocalCoords; | 577 bool fUsesLocalCoords; |
| 584 | 578 |
| 585 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 579 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 586 | 580 |
| 587 typedef GrGeometryProcessor INHERITED; | 581 typedef GrGeometryProcessor INHERITED; |
| 588 }; | 582 }; |
| 589 | 583 |
| 590 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DIEllipseEdgeEffect); | 584 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DIEllipseEdgeEffect); |
| 591 | 585 |
| 592 GrGeometryProcessor* DIEllipseEdgeEffect::TestCreate(SkRandom* random, | 586 GrGeometryProcessor* DIEllipseEdgeEffect::TestCreate(GrProcessorTestData* d) { |
| 593 GrContext* context, | 587 return DIEllipseEdgeEffect::Create(GrRandomColor(d->fRandom), |
| 594 const GrCaps&, | 588 GrTest::TestMatrix(d->fRandom), |
| 595 GrTexture* textures[]) { | 589 (Mode)(d->fRandom->nextRangeU(0,2)), |
| 596 return DIEllipseEdgeEffect::Create(GrRandomColor(random), | 590 d->fRandom->nextBool()); |
| 597 GrTest::TestMatrix(random), | |
| 598 (Mode)(random->nextRangeU(0,2)), | |
| 599 random->nextBool()); | |
| 600 } | 591 } |
| 601 | 592 |
| 602 /////////////////////////////////////////////////////////////////////////////// | 593 /////////////////////////////////////////////////////////////////////////////// |
| 603 | 594 |
| 604 bool GrOvalRenderer::DrawOval(GrDrawTarget* target, | 595 bool GrOvalRenderer::DrawOval(GrDrawTarget* target, |
| 605 GrPipelineBuilder* pipelineBuilder, | 596 GrPipelineBuilder* pipelineBuilder, |
| 606 GrColor color, | 597 GrColor color, |
| 607 const SkMatrix& viewMatrix, | 598 const SkMatrix& viewMatrix, |
| 608 bool useAA, | 599 bool useAA, |
| 609 const SkRect& oval, | 600 const SkRect& oval, |
| (...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2023 } | 2014 } |
| 2024 | 2015 |
| 2025 BATCH_TEST_DEFINE(RRectBatch) { | 2016 BATCH_TEST_DEFINE(RRectBatch) { |
| 2026 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 2017 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
| 2027 GrColor color = GrRandomColor(random); | 2018 GrColor color = GrRandomColor(random); |
| 2028 const SkRRect& rrect = GrTest::TestRRectSimple(random); | 2019 const SkRRect& rrect = GrTest::TestRRectSimple(random); |
| 2029 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); | 2020 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); |
| 2030 } | 2021 } |
| 2031 | 2022 |
| 2032 #endif | 2023 #endif |
| OLD | NEW |