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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // setup batch properties | 43 // setup batch properties |
44 fBatch.fColorIgnored = init.fColorIgnored; | 44 fBatch.fColorIgnored = init.fColorIgnored; |
45 fBatch.fColor = this->geoData(0)->fColor; | 45 fBatch.fColor = this->geoData(0)->fColor; |
46 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; | 46 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; |
47 fBatch.fCoverageIgnored = init.fCoverageIgnored; | 47 fBatch.fCoverageIgnored = init.fCoverageIgnored; |
48 } | 48 } |
49 | 49 |
50 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { | 50 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { |
51 batchTarget->initDraw(fGeometryProcessor, pipeline); | 51 batchTarget->initDraw(fGeometryProcessor, pipeline); |
52 | 52 |
53 // TODO this is hacky, but the only way we have to initialize the GP is
to use the | |
54 // GrPipelineInfo struct so we can generate the correct shader. Once we
have GrBatch | |
55 // everywhere we can remove this nastiness | |
56 GrPipelineInfo init; | |
57 init.fColorIgnored = fBatch.fColorIgnored; | |
58 init.fOverrideColor = GrColor_ILLEGAL; | |
59 init.fCoverageIgnored = fBatch.fCoverageIgnored; | |
60 init.fUsesLocalCoords = fBatch.fUsesLocalCoords; | |
61 fGeometryProcessor->initBatchTracker(batchTarget->currentBatchTracker(),
init); | |
62 | |
63 this->onGenerateGeometry(batchTarget, pipeline); | 53 this->onGenerateGeometry(batchTarget, pipeline); |
64 } | 54 } |
65 | 55 |
66 protected: | 56 protected: |
67 GrTestBatch(const GrGeometryProcessor* gp, const SkRect& bounds) { | 57 GrTestBatch(const GrGeometryProcessor* gp, const SkRect& bounds) { |
68 fGeometryProcessor.reset(SkRef(gp)); | 58 fGeometryProcessor.reset(SkRef(gp)); |
69 | 59 |
70 this->setBounds(bounds); | 60 this->setBounds(bounds); |
71 } | 61 } |
72 | 62 |
(...skipping 14 matching lines...) Expand all Loading... |
87 bool fUsesLocalCoords; | 77 bool fUsesLocalCoords; |
88 bool fColorIgnored; | 78 bool fColorIgnored; |
89 bool fCoverageIgnored; | 79 bool fCoverageIgnored; |
90 }; | 80 }; |
91 | 81 |
92 SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor; | 82 SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor; |
93 BatchTracker fBatch; | 83 BatchTracker fBatch; |
94 }; | 84 }; |
95 | 85 |
96 #endif | 86 #endif |
OLD | NEW |