OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrAAConvexPathRenderer.h" | 9 #include "GrAAConvexPathRenderer.h" |
10 | 10 |
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 const char* name() const override { return "AAConvexBatch"; } | 754 const char* name() const override { return "AAConvexBatch"; } |
755 | 755 |
756 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 756 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
757 // When this is called on a batch, there is only one geometry bundle | 757 // When this is called on a batch, there is only one geometry bundle |
758 out->setKnownFourComponents(fGeoData[0].fColor); | 758 out->setKnownFourComponents(fGeoData[0].fColor); |
759 } | 759 } |
760 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 760 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
761 out->setUnknownSingleComponent(); | 761 out->setUnknownSingleComponent(); |
762 } | 762 } |
763 | 763 |
| 764 private: |
| 765 |
764 void initBatchTracker(const GrPipelineOptimizations& opt) override { | 766 void initBatchTracker(const GrPipelineOptimizations& opt) override { |
765 // Handle any color overrides | 767 // Handle any color overrides |
766 if (!opt.readsColor()) { | 768 if (!opt.readsColor()) { |
767 fGeoData[0].fColor = GrColor_ILLEGAL; | 769 fGeoData[0].fColor = GrColor_ILLEGAL; |
768 } | 770 } |
769 opt.getOverrideColorIfSet(&fGeoData[0].fColor); | 771 opt.getOverrideColorIfSet(&fGeoData[0].fColor); |
770 | 772 |
771 // setup batch properties | 773 // setup batch properties |
772 fBatch.fColorIgnored = !opt.readsColor(); | 774 fBatch.fColorIgnored = !opt.readsColor(); |
773 fBatch.fColor = fGeoData[0].fColor; | 775 fBatch.fColor = fGeoData[0].fColor; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 firstVertex, firstIndex, draw.fVertexCnt, d
raw.fIndexCnt); | 924 firstVertex, firstIndex, draw.fVertexCnt, d
raw.fIndexCnt); |
923 target->draw(vertices); | 925 target->draw(vertices); |
924 firstVertex += draw.fVertexCnt; | 926 firstVertex += draw.fVertexCnt; |
925 firstIndex += draw.fIndexCnt; | 927 firstIndex += draw.fIndexCnt; |
926 } | 928 } |
927 } | 929 } |
928 } | 930 } |
929 | 931 |
930 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } | 932 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
931 | 933 |
932 private: | |
933 AAConvexPathBatch(const Geometry& geometry) { | 934 AAConvexPathBatch(const Geometry& geometry) { |
934 this->initClassID<AAConvexPathBatch>(); | 935 this->initClassID<AAConvexPathBatch>(); |
935 fGeoData.push_back(geometry); | 936 fGeoData.push_back(geometry); |
936 | 937 |
937 // compute bounds | 938 // compute bounds |
938 fBounds = geometry.fPath.getBounds(); | 939 fBounds = geometry.fPath.getBounds(); |
939 geometry.fViewMatrix.mapRect(&fBounds); | 940 geometry.fViewMatrix.mapRect(&fBounds); |
940 } | 941 } |
941 | 942 |
942 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { | 943 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) { | 1015 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) { |
1015 AAConvexPathBatch::Geometry geometry; | 1016 AAConvexPathBatch::Geometry geometry; |
1016 geometry.fColor = GrRandomColor(random); | 1017 geometry.fColor = GrRandomColor(random); |
1017 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); | 1018 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); |
1018 geometry.fPath = GrTest::TestPathConvex(random); | 1019 geometry.fPath = GrTest::TestPathConvex(random); |
1019 | 1020 |
1020 return AAConvexPathBatch::Create(geometry); | 1021 return AAConvexPathBatch::Create(geometry); |
1021 } | 1022 } |
1022 | 1023 |
1023 #endif | 1024 #endif |
OLD | NEW |