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 |
11 #include "GrBatchFlushState.h" | 11 #include "GrBatchFlushState.h" |
12 #include "GrDrawBatch.h" | 12 #include "GrDrawBatch.h" |
13 #include "GrGpu.h" | 13 #include "GrGpu.h" |
14 #include "GrPath.h" | 14 #include "GrPath.h" |
15 #include "GrPathRendering.h" | 15 #include "GrPathRendering.h" |
16 #include "GrPathProcessor.h" | 16 #include "GrPathProcessor.h" |
17 | 17 |
18 #include "SkTLList.h" | 18 #include "SkTLList.h" |
19 | 19 |
20 class GrDrawPathBatchBase : public GrDrawBatch { | 20 class GrDrawPathBatchBase : public GrDrawBatch { |
21 public: | 21 public: |
| 22 BATCH_CLASS_ID |
| 23 |
22 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 24 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
23 out->setKnownFourComponents(fColor); | 25 out->setKnownFourComponents(fColor); |
24 } | 26 } |
25 | 27 |
26 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 28 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
27 out->setKnownSingleComponent(0xff); | 29 out->setKnownSingleComponent(0xff); |
28 } | 30 } |
29 | 31 |
30 void setStencilSettings(const GrStencilSettings& stencil) { fStencilSettings
= stencil; } | 32 void setStencilSettings(const GrStencilSettings& stencil) { fStencilSettings
= stencil; } |
31 | 33 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 148 |
147 // 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 |
148 class GrDrawPathRangeBatch final : public GrDrawPathBatchBase { | 150 class GrDrawPathRangeBatch final : public GrDrawPathBatchBase { |
149 public: | 151 public: |
150 // This can't return a more abstracet type because we install the stencil se
ttings late :( | 152 // This can't return a more abstracet type because we install the stencil se
ttings late :( |
151 static GrDrawPathBatchBase* Create(const SkMatrix& viewMatrix, const SkMatri
x& localMatrix, | 153 static GrDrawPathBatchBase* Create(const SkMatrix& viewMatrix, const SkMatri
x& localMatrix, |
152 GrColor color, GrPathRangeDraw* pathRange
Draw) { | 154 GrColor color, GrPathRangeDraw* pathRange
Draw) { |
153 return SkNEW_ARGS(GrDrawPathRangeBatch, (viewMatrix, localMatrix, color,
pathRangeDraw)); | 155 return SkNEW_ARGS(GrDrawPathRangeBatch, (viewMatrix, localMatrix, color,
pathRangeDraw)); |
154 } | 156 } |
155 | 157 |
| 158 BATCH_CLASS_ID |
| 159 |
156 ~GrDrawPathRangeBatch() override; | 160 ~GrDrawPathRangeBatch() override; |
157 | 161 |
158 const char* name() const override { return "DrawPathRange"; } | 162 const char* name() const override { return "DrawPathRange"; } |
159 | 163 |
160 SkString dumpInfo() const override; | 164 SkString dumpInfo() const override; |
161 | 165 |
162 private: | 166 private: |
163 inline bool isWinding() const; | 167 inline bool isWinding() const; |
164 | 168 |
165 GrDrawPathRangeBatch(const SkMatrix& viewMatrix, const SkMatrix& localMatrix
, GrColor color, | 169 GrDrawPathRangeBatch(const SkMatrix& viewMatrix, const SkMatrix& localMatrix
, GrColor color, |
166 GrPathRangeDraw* pathRangeDraw); | 170 GrPathRangeDraw* pathRangeDraw); |
167 | 171 |
168 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override; | 172 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override; |
169 | 173 |
170 void onPrepare(GrBatchFlushState*) override {} | 174 void onPrepare(GrBatchFlushState*) override {} |
171 | 175 |
172 void onDraw(GrBatchFlushState* state) override; | 176 void onDraw(GrBatchFlushState* state) override; |
173 | 177 |
174 typedef SkTLList<GrPathRangeDraw*> DrawList; | 178 typedef SkTLList<GrPathRangeDraw*> DrawList; |
175 DrawList fDraws; | 179 DrawList fDraws; |
176 int fTotalPathCount; | 180 int fTotalPathCount; |
177 SkMatrix fLocalMatrix; | 181 SkMatrix fLocalMatrix; |
178 | 182 |
179 typedef GrDrawPathBatchBase INHERITED; | 183 typedef GrDrawPathBatchBase INHERITED; |
180 }; | 184 }; |
181 | 185 |
182 #endif | 186 #endif |
OLD | NEW |