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