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 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 | 825 |
826 void GrOvalRenderer::DrawCircle(GrDrawTarget* target, | 826 void GrOvalRenderer::DrawCircle(GrDrawTarget* target, |
827 GrPipelineBuilder* pipelineBuilder, | 827 GrPipelineBuilder* pipelineBuilder, |
828 GrColor color, | 828 GrColor color, |
829 const SkMatrix& viewMatrix, | 829 const SkMatrix& viewMatrix, |
830 bool useCoverageAA, | 830 bool useCoverageAA, |
831 const SkRect& circle, | 831 const SkRect& circle, |
832 const SkStrokeRec& stroke) { | 832 const SkStrokeRec& stroke) { |
833 SkAutoTUnref<GrBatch> batch(create_circle_batch(color, viewMatrix, useCovera
geAA, circle, | 833 SkAutoTUnref<GrBatch> batch(create_circle_batch(color, viewMatrix, useCovera
geAA, circle, |
834 stroke)); | 834 stroke)); |
835 target->drawBatch(pipelineBuilder, batch); | 835 target->drawBatch(*pipelineBuilder, batch); |
836 } | 836 } |
837 | 837 |
838 /////////////////////////////////////////////////////////////////////////////// | 838 /////////////////////////////////////////////////////////////////////////////// |
839 | 839 |
840 class EllipseBatch : public GrBatch { | 840 class EllipseBatch : public GrBatch { |
841 public: | 841 public: |
842 struct Geometry { | 842 struct Geometry { |
843 GrColor fColor; | 843 GrColor fColor; |
844 SkMatrix fViewMatrix; | 844 SkMatrix fViewMatrix; |
845 SkScalar fXRadius; | 845 SkScalar fXRadius; |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 const SkMatrix& viewMatrix, | 1085 const SkMatrix& viewMatrix, |
1086 bool useCoverageAA, | 1086 bool useCoverageAA, |
1087 const SkRect& ellipse, | 1087 const SkRect& ellipse, |
1088 const SkStrokeRec& stroke) { | 1088 const SkStrokeRec& stroke) { |
1089 SkAutoTUnref<GrBatch> batch(create_ellipse_batch(color, viewMatrix, useCover
ageAA, ellipse, | 1089 SkAutoTUnref<GrBatch> batch(create_ellipse_batch(color, viewMatrix, useCover
ageAA, ellipse, |
1090 stroke)); | 1090 stroke)); |
1091 if (!batch) { | 1091 if (!batch) { |
1092 return false; | 1092 return false; |
1093 } | 1093 } |
1094 | 1094 |
1095 target->drawBatch(pipelineBuilder, batch); | 1095 target->drawBatch(*pipelineBuilder, batch); |
1096 return true; | 1096 return true; |
1097 } | 1097 } |
1098 | 1098 |
1099 ////////////////////////////////////////////////////////////////////////////////
///////////////// | 1099 ////////////////////////////////////////////////////////////////////////////////
///////////////// |
1100 | 1100 |
1101 class DIEllipseBatch : public GrBatch { | 1101 class DIEllipseBatch : public GrBatch { |
1102 public: | 1102 public: |
1103 struct Geometry { | 1103 struct Geometry { |
1104 GrColor fColor; | 1104 GrColor fColor; |
1105 SkMatrix fViewMatrix; | 1105 SkMatrix fViewMatrix; |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 GrColor color, | 1329 GrColor color, |
1330 const SkMatrix& viewMatrix, | 1330 const SkMatrix& viewMatrix, |
1331 bool useCoverageAA, | 1331 bool useCoverageAA, |
1332 const SkRect& ellipse, | 1332 const SkRect& ellipse, |
1333 const SkStrokeRec& stroke) { | 1333 const SkStrokeRec& stroke) { |
1334 SkAutoTUnref<GrBatch> batch(create_diellipse_batch(color, viewMatrix, useCov
erageAA, ellipse, | 1334 SkAutoTUnref<GrBatch> batch(create_diellipse_batch(color, viewMatrix, useCov
erageAA, ellipse, |
1335 stroke)); | 1335 stroke)); |
1336 if (!batch) { | 1336 if (!batch) { |
1337 return false; | 1337 return false; |
1338 } | 1338 } |
1339 target->drawBatch(pipelineBuilder, batch); | 1339 target->drawBatch(*pipelineBuilder, batch); |
1340 return true; | 1340 return true; |
1341 } | 1341 } |
1342 | 1342 |
1343 /////////////////////////////////////////////////////////////////////////////// | 1343 /////////////////////////////////////////////////////////////////////////////// |
1344 | 1344 |
1345 static const uint16_t gRRectIndices[] = { | 1345 static const uint16_t gRRectIndices[] = { |
1346 // corners | 1346 // corners |
1347 0, 1, 5, 0, 5, 4, | 1347 0, 1, 5, 0, 5, 4, |
1348 2, 3, 7, 2, 7, 6, | 1348 2, 3, 7, 2, 7, 6, |
1349 8, 9, 13, 8, 13, 12, | 1349 8, 9, 13, 8, 13, 12, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 SkMatrix invert; | 1437 SkMatrix invert; |
1438 if (!viewMatrix.invert(&invert)) { | 1438 if (!viewMatrix.invert(&invert)) { |
1439 return false; | 1439 return false; |
1440 } | 1440 } |
1441 | 1441 |
1442 pipelineBuilder->addCoverageProcessor(effect)->unref(); | 1442 pipelineBuilder->addCoverageProcessor(effect)->unref(); |
1443 SkRect bounds = outer->getBounds(); | 1443 SkRect bounds = outer->getBounds(); |
1444 if (applyAA) { | 1444 if (applyAA) { |
1445 bounds.outset(SK_ScalarHalf, SK_ScalarHalf); | 1445 bounds.outset(SK_ScalarHalf, SK_ScalarHalf); |
1446 } | 1446 } |
1447 target->drawBWRect(pipelineBuilder, color, SkMatrix::I(), bounds, NULL, &inv
ert); | 1447 target->drawBWRect(*pipelineBuilder, color, SkMatrix::I(), bounds, NULL, &in
vert); |
1448 return true; | 1448 return true; |
1449 } | 1449 } |
1450 | 1450 |
1451 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 1451 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
1452 | 1452 |
1453 class RRectCircleRendererBatch : public GrBatch { | 1453 class RRectCircleRendererBatch : public GrBatch { |
1454 public: | 1454 public: |
1455 struct Geometry { | 1455 struct Geometry { |
1456 GrColor fColor; | 1456 GrColor fColor; |
1457 SkMatrix fViewMatrix; | 1457 SkMatrix fViewMatrix; |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1972 | 1972 |
1973 if (!viewMatrix.rectStaysRect() || !rrect.isSimple()) { | 1973 if (!viewMatrix.rectStaysRect() || !rrect.isSimple()) { |
1974 return false; | 1974 return false; |
1975 } | 1975 } |
1976 | 1976 |
1977 SkAutoTUnref<GrBatch> batch(create_rrect_batch(color, viewMatrix, rrect, str
oke)); | 1977 SkAutoTUnref<GrBatch> batch(create_rrect_batch(color, viewMatrix, rrect, str
oke)); |
1978 if (!batch) { | 1978 if (!batch) { |
1979 return false; | 1979 return false; |
1980 } | 1980 } |
1981 | 1981 |
1982 target->drawBatch(pipelineBuilder, batch); | 1982 target->drawBatch(*pipelineBuilder, batch); |
1983 return true; | 1983 return true; |
1984 } | 1984 } |
1985 | 1985 |
1986 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 1986 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
1987 | 1987 |
1988 #ifdef GR_TEST_UTILS | 1988 #ifdef GR_TEST_UTILS |
1989 | 1989 |
1990 BATCH_TEST_DEFINE(CircleBatch) { | 1990 BATCH_TEST_DEFINE(CircleBatch) { |
1991 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 1991 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
1992 GrColor color = GrRandomColor(random); | 1992 GrColor color = GrRandomColor(random); |
(...skipping 21 matching lines...) Expand all Loading... |
2014 } | 2014 } |
2015 | 2015 |
2016 BATCH_TEST_DEFINE(RRectBatch) { | 2016 BATCH_TEST_DEFINE(RRectBatch) { |
2017 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 2017 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
2018 GrColor color = GrRandomColor(random); | 2018 GrColor color = GrRandomColor(random); |
2019 const SkRRect& rrect = GrTest::TestRRectSimple(random); | 2019 const SkRRect& rrect = GrTest::TestRRectSimple(random); |
2020 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); | 2020 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); |
2021 } | 2021 } |
2022 | 2022 |
2023 #endif | 2023 #endif |
OLD | NEW |