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 GrDrawPathBatch_DEFINED | 8 #ifndef GrDrawPathBatch_DEFINED |
9 #define GrDrawPathBatch_DEFINED | 9 #define GrDrawPathBatch_DEFINED |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 /** | 90 /** |
91 * This could be nested inside the batch class, but for now it must be declarabl
e in a public | 91 * This could be nested inside the batch class, but for now it must be declarabl
e in a public |
92 * header (GrDrawContext) | 92 * header (GrDrawContext) |
93 */ | 93 */ |
94 class GrPathRangeDraw : public GrNonAtomicRef { | 94 class GrPathRangeDraw : public GrNonAtomicRef { |
95 public: | 95 public: |
96 typedef GrPathRendering::PathTransformType TransformType; | 96 typedef GrPathRendering::PathTransformType TransformType; |
97 | 97 |
98 static GrPathRangeDraw* Create(GrPathRange* range, TransformType transformTy
pe, | 98 static GrPathRangeDraw* Create(GrPathRange* range, TransformType transformTy
pe, |
99 int reserveCnt) { | 99 int reserveCnt) { |
100 return SkNEW_ARGS(GrPathRangeDraw, (range, transformType, reserveCnt)); | 100 return new GrPathRangeDraw(range, transformType, reserveCnt); |
101 } | 101 } |
102 | 102 |
103 void append(uint16_t index, float transform[]) { | 103 void append(uint16_t index, float transform[]) { |
104 fTransforms.push_back_n(GrPathRendering::PathTransformSize(fTransformTyp
e), transform); | 104 fTransforms.push_back_n(GrPathRendering::PathTransformSize(fTransformTyp
e), transform); |
105 fIndices.push_back(index); | 105 fIndices.push_back(index); |
106 } | 106 } |
107 | 107 |
108 int count() const { return fIndices.count(); } | 108 int count() const { return fIndices.count(); } |
109 | 109 |
110 TransformType transformType() const { return fTransformType; } | 110 TransformType transformType() const { return fTransformType; } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 }; | 147 }; |
148 | 148 |
149 // Template this if we decide to support index types other than 16bit | 149 // Template this if we decide to support index types other than 16bit |
150 class GrDrawPathRangeBatch final : public GrDrawPathBatchBase { | 150 class GrDrawPathRangeBatch final : public GrDrawPathBatchBase { |
151 public: | 151 public: |
152 DEFINE_BATCH_CLASS_ID | 152 DEFINE_BATCH_CLASS_ID |
153 | 153 |
154 // This can't return a more abstract type because we install the stencil set
tings late :( | 154 // This can't return a more abstract type because we install the stencil set
tings late :( |
155 static GrDrawPathBatchBase* Create(const SkMatrix& viewMatrix, const SkMatri
x& localMatrix, | 155 static GrDrawPathBatchBase* Create(const SkMatrix& viewMatrix, const SkMatri
x& localMatrix, |
156 GrColor color, GrPathRangeDraw* pathRange
Draw) { | 156 GrColor color, GrPathRangeDraw* pathRange
Draw) { |
157 return SkNEW_ARGS(GrDrawPathRangeBatch, (viewMatrix, localMatrix, color,
pathRangeDraw)); | 157 return new GrDrawPathRangeBatch(viewMatrix, localMatrix, color, pathRang
eDraw); |
158 } | 158 } |
159 | 159 |
160 ~GrDrawPathRangeBatch() override; | 160 ~GrDrawPathRangeBatch() override; |
161 | 161 |
162 const char* name() const override { return "DrawPathRange"; } | 162 const char* name() const override { return "DrawPathRange"; } |
163 | 163 |
164 SkString dumpInfo() const override; | 164 SkString dumpInfo() const override; |
165 | 165 |
166 private: | 166 private: |
167 inline bool isWinding() const; | 167 inline bool isWinding() const; |
168 | 168 |
169 GrDrawPathRangeBatch(const SkMatrix& viewMatrix, const SkMatrix& localMatrix
, GrColor color, | 169 GrDrawPathRangeBatch(const SkMatrix& viewMatrix, const SkMatrix& localMatrix
, GrColor color, |
170 GrPathRangeDraw* pathRangeDraw); | 170 GrPathRangeDraw* pathRangeDraw); |
171 | 171 |
172 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override; | 172 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override; |
173 | 173 |
174 void onPrepare(GrBatchFlushState*) override {} | 174 void onPrepare(GrBatchFlushState*) override {} |
175 | 175 |
176 void onDraw(GrBatchFlushState* state) override; | 176 void onDraw(GrBatchFlushState* state) override; |
177 | 177 |
178 typedef SkTLList<GrPathRangeDraw*> DrawList; | 178 typedef SkTLList<GrPathRangeDraw*> DrawList; |
179 DrawList fDraws; | 179 DrawList fDraws; |
180 int fTotalPathCount; | 180 int fTotalPathCount; |
181 SkMatrix fLocalMatrix; | 181 SkMatrix fLocalMatrix; |
182 | 182 |
183 typedef GrDrawPathBatchBase INHERITED; | 183 typedef GrDrawPathBatchBase INHERITED; |
184 }; | 184 }; |
185 | 185 |
186 #endif | 186 #endif |
OLD | NEW |