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 "GrBatchTarget.h" | 10 #include "GrBatchTarget.h" |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 726 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
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, const GrCaps& caps) override { |
737 if (!this->pipeline()->isEqual(*t->pipeline())) { | 737 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipel
ine(), t->bounds(), |
| 738 caps)) { |
738 return false; | 739 return false; |
739 } | 740 } |
740 | 741 |
741 CircleBatch* that = t->cast<CircleBatch>(); | 742 CircleBatch* that = t->cast<CircleBatch>(); |
742 | 743 |
743 // TODO use vertex color to avoid breaking batches | 744 // TODO use vertex color to avoid breaking batches |
744 if (this->color() != that->color()) { | 745 if (this->color() != that->color()) { |
745 return false; | 746 return false; |
746 } | 747 } |
747 | 748 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 950 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
950 | 951 |
951 private: | 952 private: |
952 EllipseBatch(const Geometry& geometry) { | 953 EllipseBatch(const Geometry& geometry) { |
953 this->initClassID<EllipseBatch>(); | 954 this->initClassID<EllipseBatch>(); |
954 fGeoData.push_back(geometry); | 955 fGeoData.push_back(geometry); |
955 | 956 |
956 this->setBounds(geometry.fDevBounds); | 957 this->setBounds(geometry.fDevBounds); |
957 } | 958 } |
958 | 959 |
959 bool onCombineIfPossible(GrBatch* t) override { | 960 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
960 if (!this->pipeline()->isEqual(*t->pipeline())) { | 961 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipel
ine(), t->bounds(), |
| 962 caps)) { |
961 return false; | 963 return false; |
962 } | 964 } |
963 | 965 |
964 EllipseBatch* that = t->cast<EllipseBatch>(); | 966 EllipseBatch* that = t->cast<EllipseBatch>(); |
965 | 967 |
966 // TODO use vertex color to avoid breaking batches | 968 // TODO use vertex color to avoid breaking batches |
967 if (this->color() != that->color()) { | 969 if (this->color() != that->color()) { |
968 return false; | 970 return false; |
969 } | 971 } |
970 | 972 |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 1209 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
1208 | 1210 |
1209 private: | 1211 private: |
1210 DIEllipseBatch(const Geometry& geometry, const SkRect& bounds) { | 1212 DIEllipseBatch(const Geometry& geometry, const SkRect& bounds) { |
1211 this->initClassID<DIEllipseBatch>(); | 1213 this->initClassID<DIEllipseBatch>(); |
1212 fGeoData.push_back(geometry); | 1214 fGeoData.push_back(geometry); |
1213 | 1215 |
1214 this->setBounds(bounds); | 1216 this->setBounds(bounds); |
1215 } | 1217 } |
1216 | 1218 |
1217 bool onCombineIfPossible(GrBatch* t) override { | 1219 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
1218 if (!this->pipeline()->isEqual(*t->pipeline())) { | 1220 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipel
ine(), t->bounds(), |
| 1221 caps)) { |
1219 return false; | 1222 return false; |
1220 } | 1223 } |
1221 | 1224 |
1222 DIEllipseBatch* that = t->cast<DIEllipseBatch>(); | 1225 DIEllipseBatch* that = t->cast<DIEllipseBatch>(); |
1223 | 1226 |
1224 // TODO use vertex color to avoid breaking batches | 1227 // TODO use vertex color to avoid breaking batches |
1225 if (this->color() != that->color()) { | 1228 if (this->color() != that->color()) { |
1226 return false; | 1229 return false; |
1227 } | 1230 } |
1228 | 1231 |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1584 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 1587 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
1585 | 1588 |
1586 private: | 1589 private: |
1587 RRectCircleRendererBatch(const Geometry& geometry) { | 1590 RRectCircleRendererBatch(const Geometry& geometry) { |
1588 this->initClassID<RRectCircleRendererBatch>(); | 1591 this->initClassID<RRectCircleRendererBatch>(); |
1589 fGeoData.push_back(geometry); | 1592 fGeoData.push_back(geometry); |
1590 | 1593 |
1591 this->setBounds(geometry.fDevBounds); | 1594 this->setBounds(geometry.fDevBounds); |
1592 } | 1595 } |
1593 | 1596 |
1594 bool onCombineIfPossible(GrBatch* t) override { | 1597 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
1595 if (!this->pipeline()->isEqual(*t->pipeline())) { | 1598 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipel
ine(), t->bounds(), |
| 1599 caps)) { |
1596 return false; | 1600 return false; |
1597 } | 1601 } |
1598 | 1602 |
1599 RRectCircleRendererBatch* that = t->cast<RRectCircleRendererBatch>(); | 1603 RRectCircleRendererBatch* that = t->cast<RRectCircleRendererBatch>(); |
1600 | 1604 |
1601 // TODO use vertex color to avoid breaking batches | 1605 // TODO use vertex color to avoid breaking batches |
1602 if (this->color() != that->color()) { | 1606 if (this->color() != that->color()) { |
1603 return false; | 1607 return false; |
1604 } | 1608 } |
1605 | 1609 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1770 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 1774 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
1771 | 1775 |
1772 private: | 1776 private: |
1773 RRectEllipseRendererBatch(const Geometry& geometry) { | 1777 RRectEllipseRendererBatch(const Geometry& geometry) { |
1774 this->initClassID<RRectEllipseRendererBatch>(); | 1778 this->initClassID<RRectEllipseRendererBatch>(); |
1775 fGeoData.push_back(geometry); | 1779 fGeoData.push_back(geometry); |
1776 | 1780 |
1777 this->setBounds(geometry.fDevBounds); | 1781 this->setBounds(geometry.fDevBounds); |
1778 } | 1782 } |
1779 | 1783 |
1780 bool onCombineIfPossible(GrBatch* t) override { | 1784 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
1781 if (!this->pipeline()->isEqual(*t->pipeline())) { | 1785 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipel
ine(), t->bounds(), |
| 1786 caps)) { |
1782 return false; | 1787 return false; |
1783 } | 1788 } |
1784 | 1789 |
1785 RRectEllipseRendererBatch* that = t->cast<RRectEllipseRendererBatch>(); | 1790 RRectEllipseRendererBatch* that = t->cast<RRectEllipseRendererBatch>(); |
1786 | 1791 |
1787 // TODO use vertex color to avoid breaking batches | 1792 // TODO use vertex color to avoid breaking batches |
1788 if (this->color() != that->color()) { | 1793 if (this->color() != that->color()) { |
1789 return false; | 1794 return false; |
1790 } | 1795 } |
1791 | 1796 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2032 } | 2037 } |
2033 | 2038 |
2034 BATCH_TEST_DEFINE(RRectBatch) { | 2039 BATCH_TEST_DEFINE(RRectBatch) { |
2035 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 2040 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
2036 GrColor color = GrRandomColor(random); | 2041 GrColor color = GrRandomColor(random); |
2037 const SkRRect& rrect = GrTest::TestRRectSimple(random); | 2042 const SkRRect& rrect = GrTest::TestRRectSimple(random); |
2038 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); | 2043 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); |
2039 } | 2044 } |
2040 | 2045 |
2041 #endif | 2046 #endif |
OLD | NEW |