OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrRectBatch.h" | 8 #include "GrRectBatch.h" |
9 | 9 |
10 #include "GrBatch.h" | 10 #include "GrBatch.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // When this is called on a batch, there is only one geometry bundle | 63 // When this is called on a batch, there is only one geometry bundle |
64 out->setKnownFourComponents(fGeoData[0].fColor); | 64 out->setKnownFourComponents(fGeoData[0].fColor); |
65 } | 65 } |
66 | 66 |
67 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 67 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
68 out->setKnownSingleComponent(0xff); | 68 out->setKnownSingleComponent(0xff); |
69 } | 69 } |
70 | 70 |
71 void initBatchTracker(const GrPipelineInfo& init) override { | 71 void initBatchTracker(const GrPipelineInfo& init) override { |
72 // Handle any color overrides | 72 // Handle any color overrides |
73 if (!init.readsColor()) { | 73 if (init.fColorIgnored) { |
74 fGeoData[0].fColor = GrColor_ILLEGAL; | 74 fGeoData[0].fColor = GrColor_ILLEGAL; |
| 75 } else if (GrColor_ILLEGAL != init.fOverrideColor) { |
| 76 fGeoData[0].fColor = init.fOverrideColor; |
75 } | 77 } |
76 init.getOverrideColorIfSet(&fGeoData[0].fColor); | |
77 | 78 |
78 // setup batch properties | 79 // setup batch properties |
79 fBatch.fColorIgnored = !init.readsColor(); | 80 fBatch.fColorIgnored = init.fColorIgnored; |
80 fBatch.fColor = fGeoData[0].fColor; | 81 fBatch.fColor = fGeoData[0].fColor; |
81 fBatch.fUsesLocalCoords = init.readsLocalCoords(); | 82 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; |
82 fBatch.fCoverageIgnored = !init.readsCoverage(); | 83 fBatch.fCoverageIgnored = init.fCoverageIgnored; |
83 } | 84 } |
84 | 85 |
85 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { | 86 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { |
86 // Go to device coords to allow batching across matrix changes | 87 // Go to device coords to allow batching across matrix changes |
87 SkMatrix invert = SkMatrix::I(); | 88 SkMatrix invert = SkMatrix::I(); |
88 | 89 |
89 // if we have a local rect, then we apply the localMatrix directly to th
e localRect to | 90 // if we have a local rect, then we apply the localMatrix directly to th
e localRect to |
90 // generate vertex local coords | 91 // generate vertex local coords |
91 bool hasExplicitLocalCoords = this->hasLocalRect(); | 92 bool hasExplicitLocalCoords = this->hasLocalRect(); |
92 if (!hasExplicitLocalCoords) { | 93 if (!hasExplicitLocalCoords) { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 if (hasLocalMatrix) { | 269 if (hasLocalMatrix) { |
269 localMatrix = GrTest::TestMatrix(random); | 270 localMatrix = GrTest::TestMatrix(random); |
270 } | 271 } |
271 | 272 |
272 return GrRectBatch::Create(color, viewMatrix, rect, | 273 return GrRectBatch::Create(color, viewMatrix, rect, |
273 hasLocalRect ? &localRect : NULL, | 274 hasLocalRect ? &localRect : NULL, |
274 hasLocalMatrix ? &localMatrix : NULL); | 275 hasLocalMatrix ? &localMatrix : NULL); |
275 } | 276 } |
276 | 277 |
277 #endif | 278 #endif |
OLD | NEW |