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 |
11 #include "GrBatchFlushState.h" | 11 #include "GrBatchFlushState.h" |
12 #include "GrGeometryProcessor.h" | 12 #include "GrGeometryProcessor.h" |
13 | 13 |
14 #include "batches/GrVertexBatch.h" | 14 #include "batches/GrVertexBatch.h" |
15 | 15 |
16 /* | 16 /* |
17 * A simple batch only for testing purposes which actually doesn't batch at all,
but can fit into | 17 * A simple batch only for testing purposes which actually doesn't batch at all,
but can fit into |
18 * the batch pipeline and generate arbitrary geometry | 18 * the batch pipeline and generate arbitrary geometry |
19 */ | 19 */ |
20 class GrTestBatch : public GrVertexBatch { | 20 class GrTestBatch : public GrVertexBatch { |
21 public: | 21 public: |
22 struct Geometry { | 22 struct Geometry { |
23 GrColor fColor; | 23 GrColor fColor; |
24 }; | 24 }; |
25 | 25 |
26 virtual const char* name() const override = 0; | 26 virtual const char* name() const override = 0; |
27 | 27 |
28 void computePipelineOptimizations(GrInitInvariantOutput* color, | 28 void computePipelineOptimizations(GrInitInvariantOutput* color, |
29 GrInitInvariantOutput* coverage, | 29 GrInitInvariantOutput* coverage, |
30 GrBatchToXPOverrides* overrides) const ove
rride { | 30 GrBatchToXPOverrides* overrides) const ove
rride { |
31 // When this is called on a batch, there is only one geometry bundle | 31 // When this is called on a batch, there is only one geometry bundle |
32 color->setKnownFourComponents(this->geoData(0)->fColor); | 32 color->setKnownFourComponents(this->geoData(0)->fColor); |
33 coverage->setUnknownSingleComponent(); | 33 coverage->setUnknownSingleComponent(); |
34 } | 34 } |
35 | 35 |
36 void initBatchTracker(const GrXPOverridesForBatch& overrides) override { | 36 void initBatchTracker(const GrXPOverridesForBatch& overrides) override { |
37 // Handle any color overrides | 37 // Handle any color overrides |
38 if (!overrides.readsColor()) { | 38 if (!overrides.readsColor()) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 typedef GrVertexBatch INHERITED; | 85 typedef GrVertexBatch INHERITED; |
86 }; | 86 }; |
87 | 87 |
88 #endif | 88 #endif |
OLD | NEW |