| 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.fColorIgnored) { | 73 if (!init.readsColor()) { |
| 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; | |
| 77 } | 75 } |
| 76 init.getOverrideColorIfSet(&fGeoData[0].fColor); |
| 78 | 77 |
| 79 // setup batch properties | 78 // setup batch properties |
| 80 fBatch.fColorIgnored = init.fColorIgnored; | 79 fBatch.fColorIgnored = !init.readsColor(); |
| 81 fBatch.fColor = fGeoData[0].fColor; | 80 fBatch.fColor = fGeoData[0].fColor; |
| 82 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; | 81 fBatch.fUsesLocalCoords = init.readsLocalCoords(); |
| 83 fBatch.fCoverageIgnored = init.fCoverageIgnored; | 82 fBatch.fCoverageIgnored = !init.readsCoverage(); |
| 84 } | 83 } |
| 85 | 84 |
| 86 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { | 85 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { |
| 87 // Go to device coords to allow batching across matrix changes | 86 // Go to device coords to allow batching across matrix changes |
| 88 SkMatrix invert = SkMatrix::I(); | 87 SkMatrix invert = SkMatrix::I(); |
| 89 | 88 |
| 90 // if we have a local rect, then we apply the localMatrix directly to th
e localRect to | 89 // if we have a local rect, then we apply the localMatrix directly to th
e localRect to |
| 91 // generate vertex local coords | 90 // generate vertex local coords |
| 92 bool hasExplicitLocalCoords = this->hasLocalRect(); | 91 bool hasExplicitLocalCoords = this->hasLocalRect(); |
| 93 if (!hasExplicitLocalCoords) { | 92 if (!hasExplicitLocalCoords) { |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 if (hasLocalMatrix) { | 268 if (hasLocalMatrix) { |
| 270 localMatrix = GrTest::TestMatrix(random); | 269 localMatrix = GrTest::TestMatrix(random); |
| 271 } | 270 } |
| 272 | 271 |
| 273 return GrRectBatch::Create(color, viewMatrix, rect, | 272 return GrRectBatch::Create(color, viewMatrix, rect, |
| 274 hasLocalRect ? &localRect : NULL, | 273 hasLocalRect ? &localRect : NULL, |
| 275 hasLocalMatrix ? &localMatrix : NULL); | 274 hasLocalMatrix ? &localMatrix : NULL); |
| 276 } | 275 } |
| 277 | 276 |
| 278 #endif | 277 #endif |
| OLD | NEW |