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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 GrTestBatch(uint32_t classID, const GrGeometryProcessor* gp, const SkRect& b
ounds) | 53 GrTestBatch(uint32_t classID, const GrGeometryProcessor* gp, const SkRect& b
ounds) |
54 : INHERITED(classID) { | 54 : INHERITED(classID) { |
55 fGeometryProcessor.reset(SkRef(gp)); | 55 fGeometryProcessor.reset(SkRef(gp)); |
56 | 56 |
57 this->setBounds(bounds); | 57 this->setBounds(bounds); |
58 } | 58 } |
59 | 59 |
60 const GrGeometryProcessor* geometryProcessor() const { return fGeometryProce
ssor; } | 60 const GrGeometryProcessor* geometryProcessor() const { return fGeometryProce
ssor; } |
61 | 61 |
62 private: | 62 private: |
63 void onPrepareDraws(Target* target) override { | 63 void onPrepareDraws(Target* target) const override { |
64 target->initDraw(fGeometryProcessor, this->pipeline()); | 64 target->initDraw(fGeometryProcessor, this->pipeline()); |
65 this->generateGeometry(target); | 65 this->generateGeometry(target); |
66 } | 66 } |
67 | 67 |
68 virtual Geometry* geoData(int index) = 0; | 68 virtual Geometry* geoData(int index) = 0; |
69 virtual const Geometry* geoData(int index) const = 0; | 69 virtual const Geometry* geoData(int index) const = 0; |
70 | 70 |
71 bool onCombineIfPossible(GrBatch* t, const GrCaps&) override { | 71 bool onCombineIfPossible(GrBatch* t, const GrCaps&) override { |
72 return false; | 72 return false; |
73 } | 73 } |
74 | 74 |
75 virtual void generateGeometry(Target*) = 0; | 75 virtual void generateGeometry(Target*) const = 0; |
76 | 76 |
77 struct BatchTracker { | 77 struct BatchTracker { |
78 GrColor fColor; | 78 GrColor fColor; |
79 bool fUsesLocalCoords; | 79 bool fUsesLocalCoords; |
80 bool fColorIgnored; | 80 bool fColorIgnored; |
81 bool fCoverageIgnored; | 81 bool fCoverageIgnored; |
82 }; | 82 }; |
83 | 83 |
84 SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor; | 84 SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor; |
85 BatchTracker fBatch; | 85 BatchTracker fBatch; |
86 | 86 |
87 typedef GrVertexBatch INHERITED; | 87 typedef GrVertexBatch INHERITED; |
88 }; | 88 }; |
89 | 89 |
90 #endif | 90 #endif |
OLD | NEW |