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 #ifndef GrTestBatch_DEFINED | 8 #ifndef GrTestBatch_DEFINED |
9 #define GrTestBatch_DEFINED | 9 #define GrTestBatch_DEFINED |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 // When this is called on a batch, there is only one geometry bundle | 27 // When this is called on a batch, there is only one geometry bundle |
28 out->setKnownFourComponents(this->geoData(0)->fColor); | 28 out->setKnownFourComponents(this->geoData(0)->fColor); |
29 } | 29 } |
30 | 30 |
31 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 31 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
32 out->setUnknownSingleComponent(); | 32 out->setUnknownSingleComponent(); |
33 } | 33 } |
34 | 34 |
35 void initBatchTracker(const GrPipelineInfo& init) override { | 35 void initBatchTracker(const GrPipelineInfo& init) override { |
36 // Handle any color overrides | 36 // Handle any color overrides |
37 if (!init.readsColor()) { | 37 if (init.fColorIgnored) { |
38 this->geoData(0)->fColor = GrColor_ILLEGAL; | 38 this->geoData(0)->fColor = GrColor_ILLEGAL; |
| 39 } else if (GrColor_ILLEGAL != init.fOverrideColor) { |
| 40 this->geoData(0)->fColor = init.fOverrideColor; |
39 } | 41 } |
40 init.getOverrideColorIfSet(&this->geoData(0)->fColor); | |
41 | 42 |
42 // setup batch properties | 43 // setup batch properties |
43 fBatch.fColorIgnored = !init.readsColor(); | 44 fBatch.fColorIgnored = init.fColorIgnored; |
44 fBatch.fColor = this->geoData(0)->fColor; | 45 fBatch.fColor = this->geoData(0)->fColor; |
45 fBatch.fUsesLocalCoords = init.readsLocalCoords(); | 46 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; |
46 fBatch.fCoverageIgnored = !init.readsCoverage(); | 47 fBatch.fCoverageIgnored = init.fCoverageIgnored; |
47 } | 48 } |
48 | 49 |
49 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { | 50 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { |
50 batchTarget->initDraw(fGeometryProcessor, pipeline); | 51 batchTarget->initDraw(fGeometryProcessor, pipeline); |
51 | 52 |
52 this->onGenerateGeometry(batchTarget, pipeline); | 53 this->onGenerateGeometry(batchTarget, pipeline); |
53 } | 54 } |
54 | 55 |
55 protected: | 56 protected: |
56 GrTestBatch(const GrGeometryProcessor* gp, const SkRect& bounds) { | 57 GrTestBatch(const GrGeometryProcessor* gp, const SkRect& bounds) { |
(...skipping 19 matching lines...) Expand all Loading... |
76 bool fUsesLocalCoords; | 77 bool fUsesLocalCoords; |
77 bool fColorIgnored; | 78 bool fColorIgnored; |
78 bool fCoverageIgnored; | 79 bool fCoverageIgnored; |
79 }; | 80 }; |
80 | 81 |
81 SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor; | 82 SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor; |
82 BatchTracker fBatch; | 83 BatchTracker fBatch; |
83 }; | 84 }; |
84 | 85 |
85 #endif | 86 #endif |
OLD | NEW |