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