| 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 "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 const Attribute* fInCircleEdge; | 177 const Attribute* fInCircleEdge; |
| 178 bool fStroke; | 178 bool fStroke; |
| 179 | 179 |
| 180 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 180 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 181 | 181 |
| 182 typedef GrGeometryProcessor INHERITED; | 182 typedef GrGeometryProcessor INHERITED; |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(CircleGeometryProcessor); | 185 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(CircleGeometryProcessor); |
| 186 | 186 |
| 187 const GrGeometryProcessor* CircleGeometryProcessor::TestCreate(GrProcessorTestDa
ta* d) { | 187 sk_sp<GrGeometryProcessor> CircleGeometryProcessor::TestCreate(GrProcessorTestDa
ta* d) { |
| 188 return new CircleGeometryProcessor(d->fRandom->nextBool(), GrTest::TestMatri
x(d->fRandom)); | 188 return sk_sp<GrGeometryProcessor>( |
| 189 new CircleGeometryProcessor(d->fRandom->nextBool(), GrTest::TestMatrix(d
->fRandom))); |
| 189 } | 190 } |
| 190 | 191 |
| 191 /////////////////////////////////////////////////////////////////////////////// | 192 /////////////////////////////////////////////////////////////////////////////// |
| 192 | 193 |
| 193 /** | 194 /** |
| 194 * The output of this effect is a modulation of the input color and coverage for
an axis-aligned | 195 * The output of this effect is a modulation of the input color and coverage for
an axis-aligned |
| 195 * ellipse, specified as a 2D offset from center, and the reciprocals of the out
er and inner radii, | 196 * ellipse, specified as a 2D offset from center, and the reciprocals of the out
er and inner radii, |
| 196 * in both x and y directions. | 197 * in both x and y directions. |
| 197 * | 198 * |
| 198 * We are using an implicit function of x^2/a^2 + y^2/b^2 - 1 = 0. | 199 * We are using an implicit function of x^2/a^2 + y^2/b^2 - 1 = 0. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 SkMatrix fLocalMatrix; | 329 SkMatrix fLocalMatrix; |
| 329 bool fStroke; | 330 bool fStroke; |
| 330 | 331 |
| 331 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 332 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 332 | 333 |
| 333 typedef GrGeometryProcessor INHERITED; | 334 typedef GrGeometryProcessor INHERITED; |
| 334 }; | 335 }; |
| 335 | 336 |
| 336 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(EllipseGeometryProcessor); | 337 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(EllipseGeometryProcessor); |
| 337 | 338 |
| 338 const GrGeometryProcessor* EllipseGeometryProcessor::TestCreate(GrProcessorTestD
ata* d) { | 339 sk_sp<GrGeometryProcessor> EllipseGeometryProcessor::TestCreate(GrProcessorTestD
ata* d) { |
| 339 return new EllipseGeometryProcessor(d->fRandom->nextBool(), GrTest::TestMatr
ix(d->fRandom)); | 340 return sk_sp<GrGeometryProcessor>( |
| 341 new EllipseGeometryProcessor(d->fRandom->nextBool(), GrTest::TestMatrix(
d->fRandom))); |
| 340 } | 342 } |
| 341 | 343 |
| 342 /////////////////////////////////////////////////////////////////////////////// | 344 /////////////////////////////////////////////////////////////////////////////// |
| 343 | 345 |
| 344 /** | 346 /** |
| 345 * The output of this effect is a modulation of the input color and coverage for
an ellipse, | 347 * The output of this effect is a modulation of the input color and coverage for
an ellipse, |
| 346 * specified as a 2D offset from center for both the outer and inner paths (if s
troked). The | 348 * specified as a 2D offset from center for both the outer and inner paths (if s
troked). The |
| 347 * implict equation used is for a unit circle (x^2 + y^2 - 1 = 0) and the edge c
orrected by | 349 * implict equation used is for a unit circle (x^2 + y^2 - 1 = 0) and the edge c
orrected by |
| 348 * using differentials. | 350 * using differentials. |
| 349 * | 351 * |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 SkMatrix fViewMatrix; | 509 SkMatrix fViewMatrix; |
| 508 DIEllipseStyle fStyle; | 510 DIEllipseStyle fStyle; |
| 509 | 511 |
| 510 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 512 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 511 | 513 |
| 512 typedef GrGeometryProcessor INHERITED; | 514 typedef GrGeometryProcessor INHERITED; |
| 513 }; | 515 }; |
| 514 | 516 |
| 515 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DIEllipseGeometryProcessor); | 517 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DIEllipseGeometryProcessor); |
| 516 | 518 |
| 517 const GrGeometryProcessor* DIEllipseGeometryProcessor::TestCreate(GrProcessorTes
tData* d) { | 519 sk_sp<GrGeometryProcessor> DIEllipseGeometryProcessor::TestCreate(GrProcessorTes
tData* d) { |
| 518 return new DIEllipseGeometryProcessor(GrTest::TestMatrix(d->fRandom), | 520 return sk_sp<GrGeometryProcessor>( |
| 519 (DIEllipseStyle)(d->fRandom->nextRange
U(0,2))); | 521 new DIEllipseGeometryProcessor(GrTest::TestMatrix(d->fRandom), |
| 522 (DIEllipseStyle)(d->fRandom->nextRangeU(0
,2)))); |
| 520 } | 523 } |
| 521 | 524 |
| 522 /////////////////////////////////////////////////////////////////////////////// | 525 /////////////////////////////////////////////////////////////////////////////// |
| 523 | 526 |
| 524 GrDrawBatch* GrOvalRenderer::CreateOvalBatch(GrColor color, | 527 GrDrawBatch* GrOvalRenderer::CreateOvalBatch(GrColor color, |
| 525 const SkMatrix& viewMatrix, | 528 const SkMatrix& viewMatrix, |
| 526 const SkRect& oval, | 529 const SkRect& oval, |
| 527 const SkStrokeRec& stroke, | 530 const SkStrokeRec& stroke, |
| 528 GrShaderCaps* shaderCaps) { | 531 GrShaderCaps* shaderCaps) { |
| 529 // we can draw circles | 532 // we can draw circles |
| (...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1714 } | 1717 } |
| 1715 | 1718 |
| 1716 DRAW_BATCH_TEST_DEFINE(RRectBatch) { | 1719 DRAW_BATCH_TEST_DEFINE(RRectBatch) { |
| 1717 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 1720 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
| 1718 GrColor color = GrRandomColor(random); | 1721 GrColor color = GrRandomColor(random); |
| 1719 const SkRRect& rrect = GrTest::TestRRectSimple(random); | 1722 const SkRRect& rrect = GrTest::TestRRectSimple(random); |
| 1720 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); | 1723 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); |
| 1721 } | 1724 } |
| 1722 | 1725 |
| 1723 #endif | 1726 #endif |
| OLD | NEW |