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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 instanceCount -= drawInfo.instanceCount(); | 828 instanceCount -= drawInfo.instanceCount(); |
829 } | 829 } |
830 } | 830 } |
831 | 831 |
832 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 832 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
833 | 833 |
834 private: | 834 private: |
835 CircleBatch(const Geometry& geometry) { | 835 CircleBatch(const Geometry& geometry) { |
836 this->initClassID<CircleBatch>(); | 836 this->initClassID<CircleBatch>(); |
837 fGeoData.push_back(geometry); | 837 fGeoData.push_back(geometry); |
| 838 |
| 839 this->setBounds(geometry.fDevBounds); |
838 } | 840 } |
839 | 841 |
840 bool onCombineIfPossible(GrBatch* t) override { | 842 bool onCombineIfPossible(GrBatch* t) override { |
841 CircleBatch* that = t->cast<CircleBatch>(); | 843 CircleBatch* that = t->cast<CircleBatch>(); |
842 | 844 |
843 // TODO use vertex color to avoid breaking batches | 845 // TODO use vertex color to avoid breaking batches |
844 if (this->color() != that->color()) { | 846 if (this->color() != that->color()) { |
845 return false; | 847 return false; |
846 } | 848 } |
847 | 849 |
848 if (this->stroke() != that->stroke()) { | 850 if (this->stroke() != that->stroke()) { |
849 return false; | 851 return false; |
850 } | 852 } |
851 | 853 |
852 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); | 854 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); |
853 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi
ewMatrix())) { | 855 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi
ewMatrix())) { |
854 return false; | 856 return false; |
855 } | 857 } |
856 | 858 |
857 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin())
; | 859 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin())
; |
| 860 this->joinBounds(that->bounds()); |
858 return true; | 861 return true; |
859 } | 862 } |
860 | 863 |
861 GrColor color() const { return fBatch.fColor; } | 864 GrColor color() const { return fBatch.fColor; } |
862 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } | 865 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } |
863 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } | 866 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } |
864 bool stroke() const { return fBatch.fStroke; } | 867 bool stroke() const { return fBatch.fStroke; } |
865 | 868 |
866 struct BatchTracker { | 869 struct BatchTracker { |
867 GrColor fColor; | 870 GrColor fColor; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 | 930 |
928 CircleBatch::Geometry geometry; | 931 CircleBatch::Geometry geometry; |
929 geometry.fViewMatrix = viewMatrix; | 932 geometry.fViewMatrix = viewMatrix; |
930 geometry.fColor = color; | 933 geometry.fColor = color; |
931 geometry.fInnerRadius = innerRadius; | 934 geometry.fInnerRadius = innerRadius; |
932 geometry.fOuterRadius = outerRadius; | 935 geometry.fOuterRadius = outerRadius; |
933 geometry.fStroke = isStrokeOnly && innerRadius > 0; | 936 geometry.fStroke = isStrokeOnly && innerRadius > 0; |
934 geometry.fDevBounds = bounds; | 937 geometry.fDevBounds = bounds; |
935 | 938 |
936 SkAutoTUnref<GrBatch> batch(CircleBatch::Create(geometry)); | 939 SkAutoTUnref<GrBatch> batch(CircleBatch::Create(geometry)); |
937 target->drawBatch(pipelineBuilder, batch, &bounds); | 940 target->drawBatch(pipelineBuilder, batch); |
938 } | 941 } |
939 | 942 |
940 /////////////////////////////////////////////////////////////////////////////// | 943 /////////////////////////////////////////////////////////////////////////////// |
941 | 944 |
942 class EllipseBatch : public GrBatch { | 945 class EllipseBatch : public GrBatch { |
943 public: | 946 public: |
944 struct Geometry { | 947 struct Geometry { |
945 GrColor fColor; | 948 GrColor fColor; |
946 SkMatrix fViewMatrix; | 949 SkMatrix fViewMatrix; |
947 SkScalar fXRadius; | 950 SkScalar fXRadius; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 instanceCount -= drawInfo.instanceCount(); | 1091 instanceCount -= drawInfo.instanceCount(); |
1089 } | 1092 } |
1090 } | 1093 } |
1091 | 1094 |
1092 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 1095 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
1093 | 1096 |
1094 private: | 1097 private: |
1095 EllipseBatch(const Geometry& geometry) { | 1098 EllipseBatch(const Geometry& geometry) { |
1096 this->initClassID<EllipseBatch>(); | 1099 this->initClassID<EllipseBatch>(); |
1097 fGeoData.push_back(geometry); | 1100 fGeoData.push_back(geometry); |
| 1101 |
| 1102 this->setBounds(geometry.fDevBounds); |
1098 } | 1103 } |
1099 | 1104 |
1100 bool onCombineIfPossible(GrBatch* t) override { | 1105 bool onCombineIfPossible(GrBatch* t) override { |
1101 EllipseBatch* that = t->cast<EllipseBatch>(); | 1106 EllipseBatch* that = t->cast<EllipseBatch>(); |
1102 | 1107 |
1103 // TODO use vertex color to avoid breaking batches | 1108 // TODO use vertex color to avoid breaking batches |
1104 if (this->color() != that->color()) { | 1109 if (this->color() != that->color()) { |
1105 return false; | 1110 return false; |
1106 } | 1111 } |
1107 | 1112 |
1108 if (this->stroke() != that->stroke()) { | 1113 if (this->stroke() != that->stroke()) { |
1109 return false; | 1114 return false; |
1110 } | 1115 } |
1111 | 1116 |
1112 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); | 1117 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); |
1113 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi
ewMatrix())) { | 1118 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi
ewMatrix())) { |
1114 return false; | 1119 return false; |
1115 } | 1120 } |
1116 | 1121 |
1117 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin())
; | 1122 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin())
; |
| 1123 this->joinBounds(that->bounds()); |
1118 return true; | 1124 return true; |
1119 } | 1125 } |
1120 | 1126 |
1121 GrColor color() const { return fBatch.fColor; } | 1127 GrColor color() const { return fBatch.fColor; } |
1122 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } | 1128 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } |
1123 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } | 1129 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } |
1124 bool stroke() const { return fBatch.fStroke; } | 1130 bool stroke() const { return fBatch.fStroke; } |
1125 | 1131 |
1126 struct BatchTracker { | 1132 struct BatchTracker { |
1127 GrColor fColor; | 1133 GrColor fColor; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 geometry.fViewMatrix = viewMatrix; | 1230 geometry.fViewMatrix = viewMatrix; |
1225 geometry.fColor = color; | 1231 geometry.fColor = color; |
1226 geometry.fXRadius = xRadius; | 1232 geometry.fXRadius = xRadius; |
1227 geometry.fYRadius = yRadius; | 1233 geometry.fYRadius = yRadius; |
1228 geometry.fInnerXRadius = innerXRadius; | 1234 geometry.fInnerXRadius = innerXRadius; |
1229 geometry.fInnerYRadius = innerYRadius; | 1235 geometry.fInnerYRadius = innerYRadius; |
1230 geometry.fStroke = isStrokeOnly && innerXRadius > 0 && innerYRadius > 0; | 1236 geometry.fStroke = isStrokeOnly && innerXRadius > 0 && innerYRadius > 0; |
1231 geometry.fDevBounds = bounds; | 1237 geometry.fDevBounds = bounds; |
1232 | 1238 |
1233 SkAutoTUnref<GrBatch> batch(EllipseBatch::Create(geometry)); | 1239 SkAutoTUnref<GrBatch> batch(EllipseBatch::Create(geometry)); |
1234 target->drawBatch(pipelineBuilder, batch, &bounds); | 1240 target->drawBatch(pipelineBuilder, batch); |
1235 | 1241 |
1236 return true; | 1242 return true; |
1237 } | 1243 } |
1238 | 1244 |
1239 ////////////////////////////////////////////////////////////////////////////////
///////////////// | 1245 ////////////////////////////////////////////////////////////////////////////////
///////////////// |
1240 | 1246 |
1241 class DIEllipseBatch : public GrBatch { | 1247 class DIEllipseBatch : public GrBatch { |
1242 public: | 1248 public: |
1243 struct Geometry { | 1249 struct Geometry { |
1244 GrColor fColor; | 1250 GrColor fColor; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 instanceCount -= drawInfo.instanceCount(); | 1386 instanceCount -= drawInfo.instanceCount(); |
1381 } | 1387 } |
1382 } | 1388 } |
1383 | 1389 |
1384 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 1390 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
1385 | 1391 |
1386 private: | 1392 private: |
1387 DIEllipseBatch(const Geometry& geometry) { | 1393 DIEllipseBatch(const Geometry& geometry) { |
1388 this->initClassID<DIEllipseBatch>(); | 1394 this->initClassID<DIEllipseBatch>(); |
1389 fGeoData.push_back(geometry); | 1395 fGeoData.push_back(geometry); |
| 1396 |
| 1397 this->setBounds(geometry.fBounds); |
| 1398 geometry.fViewMatrix.mapRect(this->getBounds()); |
1390 } | 1399 } |
1391 | 1400 |
1392 bool onCombineIfPossible(GrBatch* t) override { | 1401 bool onCombineIfPossible(GrBatch* t) override { |
1393 DIEllipseBatch* that = t->cast<DIEllipseBatch>(); | 1402 DIEllipseBatch* that = t->cast<DIEllipseBatch>(); |
1394 | 1403 |
1395 // TODO use vertex color to avoid breaking batches | 1404 // TODO use vertex color to avoid breaking batches |
1396 if (this->color() != that->color()) { | 1405 if (this->color() != that->color()) { |
1397 return false; | 1406 return false; |
1398 } | 1407 } |
1399 | 1408 |
1400 if (this->mode() != that->mode()) { | 1409 if (this->mode() != that->mode()) { |
1401 return false; | 1410 return false; |
1402 } | 1411 } |
1403 | 1412 |
1404 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); | 1413 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); |
1405 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi
ewMatrix())) { | 1414 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi
ewMatrix())) { |
1406 return false; | 1415 return false; |
1407 } | 1416 } |
1408 | 1417 |
1409 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin())
; | 1418 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin())
; |
| 1419 this->joinBounds(that->bounds()); |
1410 return true; | 1420 return true; |
1411 } | 1421 } |
1412 | 1422 |
1413 GrColor color() const { return fBatch.fColor; } | 1423 GrColor color() const { return fBatch.fColor; } |
1414 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } | 1424 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } |
1415 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } | 1425 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } |
1416 DIEllipseEdgeEffect::Mode mode() const { return fBatch.fMode; } | 1426 DIEllipseEdgeEffect::Mode mode() const { return fBatch.fMode; } |
1417 | 1427 |
1418 struct BatchTracker { | 1428 struct BatchTracker { |
1419 GrColor fColor; | 1429 GrColor fColor; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 geometry.fColor = color; | 1514 geometry.fColor = color; |
1505 geometry.fXRadius = xRadius; | 1515 geometry.fXRadius = xRadius; |
1506 geometry.fYRadius = yRadius; | 1516 geometry.fYRadius = yRadius; |
1507 geometry.fInnerXRadius = innerXRadius; | 1517 geometry.fInnerXRadius = innerXRadius; |
1508 geometry.fInnerYRadius = innerYRadius; | 1518 geometry.fInnerYRadius = innerYRadius; |
1509 geometry.fGeoDx = geoDx; | 1519 geometry.fGeoDx = geoDx; |
1510 geometry.fGeoDy = geoDy; | 1520 geometry.fGeoDy = geoDy; |
1511 geometry.fMode = mode; | 1521 geometry.fMode = mode; |
1512 geometry.fBounds = bounds; | 1522 geometry.fBounds = bounds; |
1513 | 1523 |
1514 viewMatrix.mapRect(&bounds); | |
1515 | |
1516 SkAutoTUnref<GrBatch> batch(DIEllipseBatch::Create(geometry)); | 1524 SkAutoTUnref<GrBatch> batch(DIEllipseBatch::Create(geometry)); |
1517 target->drawBatch(pipelineBuilder, batch, &bounds); | 1525 target->drawBatch(pipelineBuilder, batch); |
1518 | 1526 |
1519 return true; | 1527 return true; |
1520 } | 1528 } |
1521 | 1529 |
1522 /////////////////////////////////////////////////////////////////////////////// | 1530 /////////////////////////////////////////////////////////////////////////////// |
1523 | 1531 |
1524 static const uint16_t gRRectIndices[] = { | 1532 static const uint16_t gRRectIndices[] = { |
1525 // corners | 1533 // corners |
1526 0, 1, 5, 0, 5, 4, | 1534 0, 1, 5, 0, 5, 4, |
1527 2, 3, 7, 2, 7, 6, | 1535 2, 3, 7, 2, 7, 6, |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1790 } | 1798 } |
1791 } | 1799 } |
1792 | 1800 |
1793 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 1801 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
1794 | 1802 |
1795 private: | 1803 private: |
1796 RRectCircleRendererBatch(const Geometry& geometry, const GrIndexBuffer* inde
xBuffer) | 1804 RRectCircleRendererBatch(const Geometry& geometry, const GrIndexBuffer* inde
xBuffer) |
1797 : fIndexBuffer(indexBuffer) { | 1805 : fIndexBuffer(indexBuffer) { |
1798 this->initClassID<RRectCircleRendererBatch>(); | 1806 this->initClassID<RRectCircleRendererBatch>(); |
1799 fGeoData.push_back(geometry); | 1807 fGeoData.push_back(geometry); |
| 1808 |
| 1809 this->setBounds(geometry.fDevBounds); |
1800 } | 1810 } |
1801 | 1811 |
1802 bool onCombineIfPossible(GrBatch* t) override { | 1812 bool onCombineIfPossible(GrBatch* t) override { |
1803 RRectCircleRendererBatch* that = t->cast<RRectCircleRendererBatch>(); | 1813 RRectCircleRendererBatch* that = t->cast<RRectCircleRendererBatch>(); |
1804 | 1814 |
1805 // TODO use vertex color to avoid breaking batches | 1815 // TODO use vertex color to avoid breaking batches |
1806 if (this->color() != that->color()) { | 1816 if (this->color() != that->color()) { |
1807 return false; | 1817 return false; |
1808 } | 1818 } |
1809 | 1819 |
1810 if (this->stroke() != that->stroke()) { | 1820 if (this->stroke() != that->stroke()) { |
1811 return false; | 1821 return false; |
1812 } | 1822 } |
1813 | 1823 |
1814 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); | 1824 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); |
1815 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi
ewMatrix())) { | 1825 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi
ewMatrix())) { |
1816 return false; | 1826 return false; |
1817 } | 1827 } |
1818 | 1828 |
1819 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin())
; | 1829 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin())
; |
| 1830 this->joinBounds(that->bounds()); |
1820 return true; | 1831 return true; |
1821 } | 1832 } |
1822 | 1833 |
1823 GrColor color() const { return fBatch.fColor; } | 1834 GrColor color() const { return fBatch.fColor; } |
1824 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } | 1835 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } |
1825 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } | 1836 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } |
1826 bool stroke() const { return fBatch.fStroke; } | 1837 bool stroke() const { return fBatch.fStroke; } |
1827 | 1838 |
1828 struct BatchTracker { | 1839 struct BatchTracker { |
1829 GrColor fColor; | 1840 GrColor fColor; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2009 } | 2020 } |
2010 } | 2021 } |
2011 | 2022 |
2012 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 2023 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
2013 | 2024 |
2014 private: | 2025 private: |
2015 RRectEllipseRendererBatch(const Geometry& geometry, const GrIndexBuffer* ind
exBuffer) | 2026 RRectEllipseRendererBatch(const Geometry& geometry, const GrIndexBuffer* ind
exBuffer) |
2016 : fIndexBuffer(indexBuffer) { | 2027 : fIndexBuffer(indexBuffer) { |
2017 this->initClassID<RRectEllipseRendererBatch>(); | 2028 this->initClassID<RRectEllipseRendererBatch>(); |
2018 fGeoData.push_back(geometry); | 2029 fGeoData.push_back(geometry); |
| 2030 |
| 2031 this->setBounds(geometry.fDevBounds); |
2019 } | 2032 } |
2020 | 2033 |
2021 bool onCombineIfPossible(GrBatch* t) override { | 2034 bool onCombineIfPossible(GrBatch* t) override { |
2022 RRectEllipseRendererBatch* that = t->cast<RRectEllipseRendererBatch>(); | 2035 RRectEllipseRendererBatch* that = t->cast<RRectEllipseRendererBatch>(); |
2023 | 2036 |
2024 // TODO use vertex color to avoid breaking batches | 2037 // TODO use vertex color to avoid breaking batches |
2025 if (this->color() != that->color()) { | 2038 if (this->color() != that->color()) { |
2026 return false; | 2039 return false; |
2027 } | 2040 } |
2028 | 2041 |
2029 if (this->stroke() != that->stroke()) { | 2042 if (this->stroke() != that->stroke()) { |
2030 return false; | 2043 return false; |
2031 } | 2044 } |
2032 | 2045 |
2033 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); | 2046 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); |
2034 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi
ewMatrix())) { | 2047 if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->vi
ewMatrix())) { |
2035 return false; | 2048 return false; |
2036 } | 2049 } |
2037 | 2050 |
2038 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin())
; | 2051 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin())
; |
| 2052 this->joinBounds(that->bounds()); |
2039 return true; | 2053 return true; |
2040 } | 2054 } |
2041 | 2055 |
2042 GrColor color() const { return fBatch.fColor; } | 2056 GrColor color() const { return fBatch.fColor; } |
2043 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } | 2057 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } |
2044 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } | 2058 const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } |
2045 bool stroke() const { return fBatch.fStroke; } | 2059 bool stroke() const { return fBatch.fStroke; } |
2046 | 2060 |
2047 struct BatchTracker { | 2061 struct BatchTracker { |
2048 GrColor fColor; | 2062 GrColor fColor; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2167 | 2181 |
2168 RRectCircleRendererBatch::Geometry geometry; | 2182 RRectCircleRendererBatch::Geometry geometry; |
2169 geometry.fViewMatrix = viewMatrix; | 2183 geometry.fViewMatrix = viewMatrix; |
2170 geometry.fColor = color; | 2184 geometry.fColor = color; |
2171 geometry.fInnerRadius = innerRadius; | 2185 geometry.fInnerRadius = innerRadius; |
2172 geometry.fOuterRadius = outerRadius; | 2186 geometry.fOuterRadius = outerRadius; |
2173 geometry.fStroke = isStrokeOnly; | 2187 geometry.fStroke = isStrokeOnly; |
2174 geometry.fDevBounds = bounds; | 2188 geometry.fDevBounds = bounds; |
2175 | 2189 |
2176 SkAutoTUnref<GrBatch> batch(RRectCircleRendererBatch::Create(geometry, i
ndexBuffer)); | 2190 SkAutoTUnref<GrBatch> batch(RRectCircleRendererBatch::Create(geometry, i
ndexBuffer)); |
2177 target->drawBatch(pipelineBuilder, batch, &bounds); | 2191 target->drawBatch(pipelineBuilder, batch); |
2178 | 2192 |
2179 // otherwise we use the ellipse renderer | 2193 // otherwise we use the ellipse renderer |
2180 } else { | 2194 } else { |
2181 SkScalar innerXRadius = 0.0f; | 2195 SkScalar innerXRadius = 0.0f; |
2182 SkScalar innerYRadius = 0.0f; | 2196 SkScalar innerYRadius = 0.0f; |
2183 if (hasStroke) { | 2197 if (hasStroke) { |
2184 if (SkScalarNearlyZero(scaledStroke.length())) { | 2198 if (SkScalarNearlyZero(scaledStroke.length())) { |
2185 scaledStroke.set(SK_ScalarHalf, SK_ScalarHalf); | 2199 scaledStroke.set(SK_ScalarHalf, SK_ScalarHalf); |
2186 } else { | 2200 } else { |
2187 scaledStroke.scale(SK_ScalarHalf); | 2201 scaledStroke.scale(SK_ScalarHalf); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2219 geometry.fViewMatrix = viewMatrix; | 2233 geometry.fViewMatrix = viewMatrix; |
2220 geometry.fColor = color; | 2234 geometry.fColor = color; |
2221 geometry.fXRadius = xRadius; | 2235 geometry.fXRadius = xRadius; |
2222 geometry.fYRadius = yRadius; | 2236 geometry.fYRadius = yRadius; |
2223 geometry.fInnerXRadius = innerXRadius; | 2237 geometry.fInnerXRadius = innerXRadius; |
2224 geometry.fInnerYRadius = innerYRadius; | 2238 geometry.fInnerYRadius = innerYRadius; |
2225 geometry.fStroke = isStrokeOnly; | 2239 geometry.fStroke = isStrokeOnly; |
2226 geometry.fDevBounds = bounds; | 2240 geometry.fDevBounds = bounds; |
2227 | 2241 |
2228 SkAutoTUnref<GrBatch> batch(RRectEllipseRendererBatch::Create(geometry,
indexBuffer)); | 2242 SkAutoTUnref<GrBatch> batch(RRectEllipseRendererBatch::Create(geometry,
indexBuffer)); |
2229 target->drawBatch(pipelineBuilder, batch, &bounds); | 2243 target->drawBatch(pipelineBuilder, batch); |
2230 } | 2244 } |
2231 return true; | 2245 return true; |
2232 } | 2246 } |
OLD | NEW |