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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 | 727 |
728 private: | 728 private: |
729 CircleBatch(const Geometry& geometry) { | 729 CircleBatch(const Geometry& geometry) { |
730 this->initClassID<CircleBatch>(); | 730 this->initClassID<CircleBatch>(); |
731 fGeoData.push_back(geometry); | 731 fGeoData.push_back(geometry); |
732 | 732 |
733 this->setBounds(geometry.fDevBounds); | 733 this->setBounds(geometry.fDevBounds); |
734 } | 734 } |
735 | 735 |
736 bool onCombineIfPossible(GrBatch* t) override { | 736 bool onCombineIfPossible(GrBatch* t) override { |
| 737 if (!this->pipeline()->isEqual(*t->pipeline())) { |
| 738 return false; |
| 739 } |
| 740 |
737 CircleBatch* that = t->cast<CircleBatch>(); | 741 CircleBatch* that = t->cast<CircleBatch>(); |
738 | 742 |
739 // TODO use vertex color to avoid breaking batches | 743 // TODO use vertex color to avoid breaking batches |
740 if (this->color() != that->color()) { | 744 if (this->color() != that->color()) { |
741 return false; | 745 return false; |
742 } | 746 } |
743 | 747 |
744 if (this->stroke() != that->stroke()) { | 748 if (this->stroke() != that->stroke()) { |
745 return false; | 749 return false; |
746 } | 750 } |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 | 950 |
947 private: | 951 private: |
948 EllipseBatch(const Geometry& geometry) { | 952 EllipseBatch(const Geometry& geometry) { |
949 this->initClassID<EllipseBatch>(); | 953 this->initClassID<EllipseBatch>(); |
950 fGeoData.push_back(geometry); | 954 fGeoData.push_back(geometry); |
951 | 955 |
952 this->setBounds(geometry.fDevBounds); | 956 this->setBounds(geometry.fDevBounds); |
953 } | 957 } |
954 | 958 |
955 bool onCombineIfPossible(GrBatch* t) override { | 959 bool onCombineIfPossible(GrBatch* t) override { |
| 960 if (!this->pipeline()->isEqual(*t->pipeline())) { |
| 961 return false; |
| 962 } |
| 963 |
956 EllipseBatch* that = t->cast<EllipseBatch>(); | 964 EllipseBatch* that = t->cast<EllipseBatch>(); |
957 | 965 |
958 // TODO use vertex color to avoid breaking batches | 966 // TODO use vertex color to avoid breaking batches |
959 if (this->color() != that->color()) { | 967 if (this->color() != that->color()) { |
960 return false; | 968 return false; |
961 } | 969 } |
962 | 970 |
963 if (this->stroke() != that->stroke()) { | 971 if (this->stroke() != that->stroke()) { |
964 return false; | 972 return false; |
965 } | 973 } |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 | 1208 |
1201 private: | 1209 private: |
1202 DIEllipseBatch(const Geometry& geometry, const SkRect& bounds) { | 1210 DIEllipseBatch(const Geometry& geometry, const SkRect& bounds) { |
1203 this->initClassID<DIEllipseBatch>(); | 1211 this->initClassID<DIEllipseBatch>(); |
1204 fGeoData.push_back(geometry); | 1212 fGeoData.push_back(geometry); |
1205 | 1213 |
1206 this->setBounds(bounds); | 1214 this->setBounds(bounds); |
1207 } | 1215 } |
1208 | 1216 |
1209 bool onCombineIfPossible(GrBatch* t) override { | 1217 bool onCombineIfPossible(GrBatch* t) override { |
| 1218 if (!this->pipeline()->isEqual(*t->pipeline())) { |
| 1219 return false; |
| 1220 } |
| 1221 |
1210 DIEllipseBatch* that = t->cast<DIEllipseBatch>(); | 1222 DIEllipseBatch* that = t->cast<DIEllipseBatch>(); |
1211 | 1223 |
1212 // TODO use vertex color to avoid breaking batches | 1224 // TODO use vertex color to avoid breaking batches |
1213 if (this->color() != that->color()) { | 1225 if (this->color() != that->color()) { |
1214 return false; | 1226 return false; |
1215 } | 1227 } |
1216 | 1228 |
1217 if (this->mode() != that->mode()) { | 1229 if (this->mode() != that->mode()) { |
1218 return false; | 1230 return false; |
1219 } | 1231 } |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1573 | 1585 |
1574 private: | 1586 private: |
1575 RRectCircleRendererBatch(const Geometry& geometry) { | 1587 RRectCircleRendererBatch(const Geometry& geometry) { |
1576 this->initClassID<RRectCircleRendererBatch>(); | 1588 this->initClassID<RRectCircleRendererBatch>(); |
1577 fGeoData.push_back(geometry); | 1589 fGeoData.push_back(geometry); |
1578 | 1590 |
1579 this->setBounds(geometry.fDevBounds); | 1591 this->setBounds(geometry.fDevBounds); |
1580 } | 1592 } |
1581 | 1593 |
1582 bool onCombineIfPossible(GrBatch* t) override { | 1594 bool onCombineIfPossible(GrBatch* t) override { |
| 1595 if (!this->pipeline()->isEqual(*t->pipeline())) { |
| 1596 return false; |
| 1597 } |
| 1598 |
1583 RRectCircleRendererBatch* that = t->cast<RRectCircleRendererBatch>(); | 1599 RRectCircleRendererBatch* that = t->cast<RRectCircleRendererBatch>(); |
1584 | 1600 |
1585 // TODO use vertex color to avoid breaking batches | 1601 // TODO use vertex color to avoid breaking batches |
1586 if (this->color() != that->color()) { | 1602 if (this->color() != that->color()) { |
1587 return false; | 1603 return false; |
1588 } | 1604 } |
1589 | 1605 |
1590 if (this->stroke() != that->stroke()) { | 1606 if (this->stroke() != that->stroke()) { |
1591 return false; | 1607 return false; |
1592 } | 1608 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1755 | 1771 |
1756 private: | 1772 private: |
1757 RRectEllipseRendererBatch(const Geometry& geometry) { | 1773 RRectEllipseRendererBatch(const Geometry& geometry) { |
1758 this->initClassID<RRectEllipseRendererBatch>(); | 1774 this->initClassID<RRectEllipseRendererBatch>(); |
1759 fGeoData.push_back(geometry); | 1775 fGeoData.push_back(geometry); |
1760 | 1776 |
1761 this->setBounds(geometry.fDevBounds); | 1777 this->setBounds(geometry.fDevBounds); |
1762 } | 1778 } |
1763 | 1779 |
1764 bool onCombineIfPossible(GrBatch* t) override { | 1780 bool onCombineIfPossible(GrBatch* t) override { |
| 1781 if (!this->pipeline()->isEqual(*t->pipeline())) { |
| 1782 return false; |
| 1783 } |
| 1784 |
1765 RRectEllipseRendererBatch* that = t->cast<RRectEllipseRendererBatch>(); | 1785 RRectEllipseRendererBatch* that = t->cast<RRectEllipseRendererBatch>(); |
1766 | 1786 |
1767 // TODO use vertex color to avoid breaking batches | 1787 // TODO use vertex color to avoid breaking batches |
1768 if (this->color() != that->color()) { | 1788 if (this->color() != that->color()) { |
1769 return false; | 1789 return false; |
1770 } | 1790 } |
1771 | 1791 |
1772 if (this->stroke() != that->stroke()) { | 1792 if (this->stroke() != that->stroke()) { |
1773 return false; | 1793 return false; |
1774 } | 1794 } |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2012 } | 2032 } |
2013 | 2033 |
2014 BATCH_TEST_DEFINE(RRectBatch) { | 2034 BATCH_TEST_DEFINE(RRectBatch) { |
2015 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 2035 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
2016 GrColor color = GrRandomColor(random); | 2036 GrColor color = GrRandomColor(random); |
2017 const SkRRect& rrect = GrTest::TestRRectSimple(random); | 2037 const SkRRect& rrect = GrTest::TestRRectSimple(random); |
2018 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); | 2038 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); |
2019 } | 2039 } |
2020 | 2040 |
2021 #endif | 2041 #endif |
OLD | NEW |