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.fColorIgnored) { | 37 if (!init.readsColor()) { |
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; | |
41 } | 39 } |
| 40 init.getOverrideColorIfSet(&this->geoData(0)->fColor); |
42 | 41 |
43 // setup batch properties | 42 // setup batch properties |
44 fBatch.fColorIgnored = init.fColorIgnored; | 43 fBatch.fColorIgnored = !init.readsColor(); |
45 fBatch.fColor = this->geoData(0)->fColor; | 44 fBatch.fColor = this->geoData(0)->fColor; |
46 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; | 45 fBatch.fUsesLocalCoords = init.readsLocalCoords(); |
47 fBatch.fCoverageIgnored = init.fCoverageIgnored; | 46 fBatch.fCoverageIgnored = !init.readsCoverage(); |
48 } | 47 } |
49 | 48 |
50 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { | 49 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { |
51 batchTarget->initDraw(fGeometryProcessor, pipeline); | 50 batchTarget->initDraw(fGeometryProcessor, pipeline); |
52 | 51 |
53 this->onGenerateGeometry(batchTarget, pipeline); | 52 this->onGenerateGeometry(batchTarget, pipeline); |
54 } | 53 } |
55 | 54 |
56 protected: | 55 protected: |
57 GrTestBatch(const GrGeometryProcessor* gp, const SkRect& bounds) { | 56 GrTestBatch(const GrGeometryProcessor* gp, const SkRect& bounds) { |
(...skipping 19 matching lines...) Expand all Loading... |
77 bool fUsesLocalCoords; | 76 bool fUsesLocalCoords; |
78 bool fColorIgnored; | 77 bool fColorIgnored; |
79 bool fCoverageIgnored; | 78 bool fCoverageIgnored; |
80 }; | 79 }; |
81 | 80 |
82 SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor; | 81 SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor; |
83 BatchTracker fBatch; | 82 BatchTracker fBatch; |
84 }; | 83 }; |
85 | 84 |
86 #endif | 85 #endif |
OLD | NEW |