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.readsColor()) { | 139 if (init.fColorIgnored) { |
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; |
141 } | 143 } |
142 init.getOverrideColorIfSet(&fGeoData[0].fColor); | |
143 | 144 |
144 // setup batch properties | 145 // setup batch properties |
145 fBatch.fColorIgnored = !init.readsColor(); | 146 fBatch.fColorIgnored = init.fColorIgnored; |
146 fBatch.fColor = fGeoData[0].fColor; | 147 fBatch.fColor = fGeoData[0].fColor; |
147 fBatch.fUsesLocalCoords = init.readsLocalCoords(); | 148 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; |
148 fBatch.fCoverageIgnored = !init.readsCoverage(); | 149 fBatch.fCoverageIgnored = init.fCoverageIgnored; |
149 fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSe
gmentMasks(); | 150 fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSe
gmentMasks(); |
150 fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage(); | 151 fBatch.fCanTweakAlphaForCoverage = init.fCanTweakAlphaForCoverage; |
151 } | 152 } |
152 | 153 |
153 void draw(GrBatchTarget* batchTarget, const GrPipeline* pipeline, int vertex
Count, | 154 void draw(GrBatchTarget* batchTarget, const GrPipeline* pipeline, int vertex
Count, |
154 size_t vertexStride, void* vertices, int indexCount, uint16_t* indic
es) { | 155 size_t vertexStride, void* vertices, int indexCount, uint16_t* indic
es) { |
155 if (vertexCount == 0 || indexCount == 0) { | 156 if (vertexCount == 0 || indexCount == 0) { |
156 return; | 157 return; |
157 } | 158 } |
158 const GrVertexBuffer* vertexBuffer; | 159 const GrVertexBuffer* vertexBuffer; |
159 GrVertices info; | 160 GrVertices info; |
160 int firstVertex; | 161 int firstVertex; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { | 331 BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { |
331 AAFlatteningConvexPathBatch::Geometry geometry; | 332 AAFlatteningConvexPathBatch::Geometry geometry; |
332 geometry.fColor = GrRandomColor(random); | 333 geometry.fColor = GrRandomColor(random); |
333 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); | 334 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); |
334 geometry.fPath = GrTest::TestPathConvex(random); | 335 geometry.fPath = GrTest::TestPathConvex(random); |
335 | 336 |
336 return AAFlatteningConvexPathBatch::Create(geometry); | 337 return AAFlatteningConvexPathBatch::Create(geometry); |
337 } | 338 } |
338 | 339 |
339 #endif | 340 #endif |
OLD | NEW |