OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 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 "GrAALinearizingConvexPathRenderer.h" | 9 #include "GrAALinearizingConvexPathRenderer.h" |
10 | 10 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 const char* name() const override { return "AAConvexBatch"; } | 132 const char* name() const override { return "AAConvexBatch"; } |
133 | 133 |
134 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 134 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
135 // When this is called on a batch, there is only one geometry bundle | 135 // When this is called on a batch, there is only one geometry bundle |
136 out->setKnownFourComponents(fGeoData[0].fColor); | 136 out->setKnownFourComponents(fGeoData[0].fColor); |
137 } | 137 } |
138 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 138 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
139 out->setUnknownSingleComponent(); | 139 out->setUnknownSingleComponent(); |
140 } | 140 } |
141 | 141 |
142 void initBatchTracker(const GrPipelineInfo& init) override { | 142 void initBatchTracker(const GrPipelineOptimizations& opt) override { |
143 // Handle any color overrides | 143 // Handle any color overrides |
144 if (!init.readsColor()) { | 144 if (!opt.readsColor()) { |
145 fGeoData[0].fColor = GrColor_ILLEGAL; | 145 fGeoData[0].fColor = GrColor_ILLEGAL; |
146 } | 146 } |
147 init.getOverrideColorIfSet(&fGeoData[0].fColor); | 147 opt.getOverrideColorIfSet(&fGeoData[0].fColor); |
148 | 148 |
149 // setup batch properties | 149 // setup batch properties |
150 fBatch.fColorIgnored = !init.readsColor(); | 150 fBatch.fColorIgnored = !opt.readsColor(); |
151 fBatch.fColor = fGeoData[0].fColor; | 151 fBatch.fColor = fGeoData[0].fColor; |
152 fBatch.fUsesLocalCoords = init.readsLocalCoords(); | 152 fBatch.fUsesLocalCoords = opt.readsLocalCoords(); |
153 fBatch.fCoverageIgnored = !init.readsCoverage(); | 153 fBatch.fCoverageIgnored = !opt.readsCoverage(); |
154 fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSe
gmentMasks(); | 154 fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSe
gmentMasks(); |
155 fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage(); | 155 fBatch.fCanTweakAlphaForCoverage = opt.canTweakAlphaForCoverage(); |
156 } | 156 } |
157 | 157 |
158 void draw(GrBatchTarget* batchTarget, const GrPipeline* pipeline, int vertex
Count, | 158 void draw(GrBatchTarget* batchTarget, const GrPipeline* pipeline, int vertex
Count, |
159 size_t vertexStride, void* vertices, int indexCount, uint16_t* indic
es) { | 159 size_t vertexStride, void* vertices, int indexCount, uint16_t* indic
es) { |
160 if (vertexCount == 0 || indexCount == 0) { | 160 if (vertexCount == 0 || indexCount == 0) { |
161 return; | 161 return; |
162 } | 162 } |
163 const GrVertexBuffer* vertexBuffer; | 163 const GrVertexBuffer* vertexBuffer; |
164 GrVertices info; | 164 GrVertices info; |
165 int firstVertex; | 165 int firstVertex; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { | 333 BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { |
334 AAFlatteningConvexPathBatch::Geometry geometry; | 334 AAFlatteningConvexPathBatch::Geometry geometry; |
335 geometry.fColor = GrRandomColor(random); | 335 geometry.fColor = GrRandomColor(random); |
336 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); | 336 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); |
337 geometry.fPath = GrTest::TestPathConvex(random); | 337 geometry.fPath = GrTest::TestPathConvex(random); |
338 | 338 |
339 return AAFlatteningConvexPathBatch::Create(geometry); | 339 return AAFlatteningConvexPathBatch::Create(geometry); |
340 } | 340 } |
341 | 341 |
342 #endif | 342 #endif |
OLD | NEW |