| 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 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 verts[2].fOuterRadius = outerRadius; | 777 verts[2].fOuterRadius = outerRadius; |
| 778 verts[2].fInnerRadius = innerRadius; | 778 verts[2].fInnerRadius = innerRadius; |
| 779 | 779 |
| 780 verts[3].fPos = SkPoint::Make(bounds.fRight, bounds.fTop); | 780 verts[3].fPos = SkPoint::Make(bounds.fRight, bounds.fTop); |
| 781 verts[3].fOffset = SkPoint::Make(1, -1); | 781 verts[3].fOffset = SkPoint::Make(1, -1); |
| 782 verts[3].fOuterRadius = outerRadius; | 782 verts[3].fOuterRadius = outerRadius; |
| 783 verts[3].fInnerRadius = innerRadius; | 783 verts[3].fInnerRadius = innerRadius; |
| 784 | 784 |
| 785 verts += kVerticesPerQuad; | 785 verts += kVerticesPerQuad; |
| 786 } | 786 } |
| 787 helper.issueDraws(batchTarget); | 787 helper.issueDraw(batchTarget); |
| 788 } | 788 } |
| 789 | 789 |
| 790 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 790 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
| 791 | 791 |
| 792 private: | 792 private: |
| 793 CircleBatch(const Geometry& geometry) { | 793 CircleBatch(const Geometry& geometry) { |
| 794 this->initClassID<CircleBatch>(); | 794 this->initClassID<CircleBatch>(); |
| 795 fGeoData.push_back(geometry); | 795 fGeoData.push_back(geometry); |
| 796 | 796 |
| 797 this->setBounds(geometry.fDevBounds); | 797 this->setBounds(geometry.fDevBounds); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 verts[2].fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip); | 1006 verts[2].fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip); |
| 1007 verts[2].fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadRecip)
; | 1007 verts[2].fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadRecip)
; |
| 1008 | 1008 |
| 1009 verts[3].fPos = SkPoint::Make(bounds.fRight, bounds.fTop); | 1009 verts[3].fPos = SkPoint::Make(bounds.fRight, bounds.fTop); |
| 1010 verts[3].fOffset = SkPoint::Make(xRadius, -yRadius); | 1010 verts[3].fOffset = SkPoint::Make(xRadius, -yRadius); |
| 1011 verts[3].fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip); | 1011 verts[3].fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip); |
| 1012 verts[3].fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadRecip)
; | 1012 verts[3].fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadRecip)
; |
| 1013 | 1013 |
| 1014 verts += kVerticesPerQuad; | 1014 verts += kVerticesPerQuad; |
| 1015 } | 1015 } |
| 1016 helper.issueDraws(batchTarget); | 1016 helper.issueDraw(batchTarget); |
| 1017 } | 1017 } |
| 1018 | 1018 |
| 1019 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 1019 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
| 1020 | 1020 |
| 1021 private: | 1021 private: |
| 1022 EllipseBatch(const Geometry& geometry) { | 1022 EllipseBatch(const Geometry& geometry) { |
| 1023 this->initClassID<EllipseBatch>(); | 1023 this->initClassID<EllipseBatch>(); |
| 1024 fGeoData.push_back(geometry); | 1024 fGeoData.push_back(geometry); |
| 1025 | 1025 |
| 1026 this->setBounds(geometry.fDevBounds); | 1026 this->setBounds(geometry.fDevBounds); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 verts[2].fPos = SkPoint::Make(bounds.fRight, bounds.fBottom); | 1270 verts[2].fPos = SkPoint::Make(bounds.fRight, bounds.fBottom); |
| 1271 verts[2].fOuterOffset = SkPoint::Make(1.0f + offsetDx, 1.0f + offset
Dy); | 1271 verts[2].fOuterOffset = SkPoint::Make(1.0f + offsetDx, 1.0f + offset
Dy); |
| 1272 verts[2].fInnerOffset = SkPoint::Make(innerRatioX + offsetDx, innerR
atioY + offsetDy); | 1272 verts[2].fInnerOffset = SkPoint::Make(innerRatioX + offsetDx, innerR
atioY + offsetDy); |
| 1273 | 1273 |
| 1274 verts[3].fPos = SkPoint::Make(bounds.fRight, bounds.fTop); | 1274 verts[3].fPos = SkPoint::Make(bounds.fRight, bounds.fTop); |
| 1275 verts[3].fOuterOffset = SkPoint::Make(1.0f + offsetDx, -1.0f - offse
tDy); | 1275 verts[3].fOuterOffset = SkPoint::Make(1.0f + offsetDx, -1.0f - offse
tDy); |
| 1276 verts[3].fInnerOffset = SkPoint::Make(innerRatioX + offsetDx, -inner
RatioY - offsetDy); | 1276 verts[3].fInnerOffset = SkPoint::Make(innerRatioX + offsetDx, -inner
RatioY - offsetDy); |
| 1277 | 1277 |
| 1278 verts += kVerticesPerQuad; | 1278 verts += kVerticesPerQuad; |
| 1279 } | 1279 } |
| 1280 helper.issueDraws(batchTarget); | 1280 helper.issueDraw(batchTarget); |
| 1281 } | 1281 } |
| 1282 | 1282 |
| 1283 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 1283 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
| 1284 | 1284 |
| 1285 private: | 1285 private: |
| 1286 DIEllipseBatch(const Geometry& geometry, const SkRect& bounds) { | 1286 DIEllipseBatch(const Geometry& geometry, const SkRect& bounds) { |
| 1287 this->initClassID<DIEllipseBatch>(); | 1287 this->initClassID<DIEllipseBatch>(); |
| 1288 fGeoData.push_back(geometry); | 1288 fGeoData.push_back(geometry); |
| 1289 | 1289 |
| 1290 this->setBounds(bounds); | 1290 this->setBounds(bounds); |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1654 verts++; | 1654 verts++; |
| 1655 | 1655 |
| 1656 verts->fPos = SkPoint::Make(bounds.fRight, yCoords[i]); | 1656 verts->fPos = SkPoint::Make(bounds.fRight, yCoords[i]); |
| 1657 verts->fOffset = SkPoint::Make(1, yOuterRadii[i]); | 1657 verts->fOffset = SkPoint::Make(1, yOuterRadii[i]); |
| 1658 verts->fOuterRadius = outerRadius; | 1658 verts->fOuterRadius = outerRadius; |
| 1659 verts->fInnerRadius = innerRadius; | 1659 verts->fInnerRadius = innerRadius; |
| 1660 verts++; | 1660 verts++; |
| 1661 } | 1661 } |
| 1662 } | 1662 } |
| 1663 | 1663 |
| 1664 helper.issueDraws(batchTarget); | 1664 helper.issueDraw(batchTarget); |
| 1665 } | 1665 } |
| 1666 | 1666 |
| 1667 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 1667 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
| 1668 | 1668 |
| 1669 private: | 1669 private: |
| 1670 RRectCircleRendererBatch(const Geometry& geometry) { | 1670 RRectCircleRendererBatch(const Geometry& geometry) { |
| 1671 this->initClassID<RRectCircleRendererBatch>(); | 1671 this->initClassID<RRectCircleRendererBatch>(); |
| 1672 fGeoData.push_back(geometry); | 1672 fGeoData.push_back(geometry); |
| 1673 | 1673 |
| 1674 this->setBounds(geometry.fDevBounds); | 1674 this->setBounds(geometry.fDevBounds); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1846 verts->fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadReci
p); | 1846 verts->fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadReci
p); |
| 1847 verts++; | 1847 verts++; |
| 1848 | 1848 |
| 1849 verts->fPos = SkPoint::Make(bounds.fRight, yCoords[i]); | 1849 verts->fPos = SkPoint::Make(bounds.fRight, yCoords[i]); |
| 1850 verts->fOffset = SkPoint::Make(xOuterRadius, yOuterOffsets[i]); | 1850 verts->fOffset = SkPoint::Make(xOuterRadius, yOuterOffsets[i]); |
| 1851 verts->fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip); | 1851 verts->fOuterRadii = SkPoint::Make(xRadRecip, yRadRecip); |
| 1852 verts->fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadReci
p); | 1852 verts->fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadReci
p); |
| 1853 verts++; | 1853 verts++; |
| 1854 } | 1854 } |
| 1855 } | 1855 } |
| 1856 helper.issueDraws(batchTarget); | 1856 helper.issueDraw(batchTarget); |
| 1857 } | 1857 } |
| 1858 | 1858 |
| 1859 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 1859 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
| 1860 | 1860 |
| 1861 private: | 1861 private: |
| 1862 RRectEllipseRendererBatch(const Geometry& geometry) { | 1862 RRectEllipseRendererBatch(const Geometry& geometry) { |
| 1863 this->initClassID<RRectEllipseRendererBatch>(); | 1863 this->initClassID<RRectEllipseRendererBatch>(); |
| 1864 fGeoData.push_back(geometry); | 1864 fGeoData.push_back(geometry); |
| 1865 | 1865 |
| 1866 this->setBounds(geometry.fDevBounds); | 1866 this->setBounds(geometry.fDevBounds); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2127 } | 2127 } |
| 2128 | 2128 |
| 2129 BATCH_TEST_DEFINE(RRectBatch) { | 2129 BATCH_TEST_DEFINE(RRectBatch) { |
| 2130 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 2130 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
| 2131 GrColor color = GrRandomColor(random); | 2131 GrColor color = GrRandomColor(random); |
| 2132 const SkRRect& rrect = GrTest::TestRRectSimple(random); | 2132 const SkRRect& rrect = GrTest::TestRRectSimple(random); |
| 2133 return create_rrect_batch(color, viewMatrix, rrect, random_strokerec(random)
); | 2133 return create_rrect_batch(color, viewMatrix, rrect, random_strokerec(random)
); |
| 2134 } | 2134 } |
| 2135 | 2135 |
| 2136 #endif | 2136 #endif |
| OLD | NEW |