| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 GrDrawPathBatch(const SkMatrix& viewMatrix, GrColor color, GrPathRendering::
FillType fill, | 77 GrDrawPathBatch(const SkMatrix& viewMatrix, GrColor color, GrPathRendering::
FillType fill, |
| 78 const GrPath* path) | 78 const GrPath* path) |
| 79 : INHERITED(ClassID(), viewMatrix, color, fill) | 79 : INHERITED(ClassID(), viewMatrix, color, fill) |
| 80 , fPath(path) { | 80 , fPath(path) { |
| 81 fBounds = path->getBounds(); | 81 fBounds = path->getBounds(); |
| 82 viewMatrix.mapRect(&fBounds); | 82 viewMatrix.mapRect(&fBounds); |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f
alse; } | 85 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { return f
alse; } |
| 86 | 86 |
| 87 void onDraw(GrBatchFlushState* state) override; | 87 void onDraw(GrBatchFlushState* state, GrGpuCommandBuffer* buffer) override; |
| 88 | 88 |
| 89 GrPendingIOResource<const GrPath, kRead_GrIOType> fPath; | 89 GrPendingIOResource<const GrPath, kRead_GrIOType> fPath; |
| 90 | 90 |
| 91 typedef GrDrawPathBatchBase INHERITED; | 91 typedef GrDrawPathBatchBase INHERITED; |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 // Template this if we decide to support index types other than 16bit | 94 // Template this if we decide to support index types other than 16bit |
| 95 class GrDrawPathRangeBatch final : public GrDrawPathBatchBase { | 95 class GrDrawPathRangeBatch final : public GrDrawPathBatchBase { |
| 96 public: | 96 public: |
| 97 typedef GrPathRendering::PathTransformType TransformType; | 97 typedef GrPathRendering::PathTransformType TransformType; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 private: | 171 private: |
| 172 GrDrawPathRangeBatch(const SkMatrix& viewMatrix, SkScalar scale, SkScalar x,
SkScalar y, | 172 GrDrawPathRangeBatch(const SkMatrix& viewMatrix, SkScalar scale, SkScalar x,
SkScalar y, |
| 173 GrColor color, GrPathRendering::FillType fill, GrPathRa
nge* range, | 173 GrColor color, GrPathRendering::FillType fill, GrPathRa
nge* range, |
| 174 const InstanceData* instanceData, const SkRect& bounds)
; | 174 const InstanceData* instanceData, const SkRect& bounds)
; |
| 175 | 175 |
| 176 TransformType transformType() const { return fDraws.head()->fInstanceData->t
ransformType(); } | 176 TransformType transformType() const { return fDraws.head()->fInstanceData->t
ransformType(); } |
| 177 | 177 |
| 178 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override; | 178 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override; |
| 179 | 179 |
| 180 void onDraw(GrBatchFlushState* state) override; | 180 void onDraw(GrBatchFlushState* state, GrGpuCommandBuffer* buffer) override; |
| 181 | 181 |
| 182 struct Draw { | 182 struct Draw { |
| 183 void set(const InstanceData* instanceData, SkScalar x, SkScalar y) { | 183 void set(const InstanceData* instanceData, SkScalar x, SkScalar y) { |
| 184 fInstanceData.reset(SkRef(instanceData)); | 184 fInstanceData.reset(SkRef(instanceData)); |
| 185 fX = x; | 185 fX = x; |
| 186 fY = y; | 186 fY = y; |
| 187 } | 187 } |
| 188 | 188 |
| 189 SkAutoTUnref<const InstanceData> fInstanceData; | 189 SkAutoTUnref<const InstanceData> fInstanceData; |
| 190 SkScalar fX, fY; | 190 SkScalar fX, fY; |
| 191 }; | 191 }; |
| 192 | 192 |
| 193 typedef GrPendingIOResource<const GrPathRange, kRead_GrIOType> PendingPathRa
nge; | 193 typedef GrPendingIOResource<const GrPathRange, kRead_GrIOType> PendingPathRa
nge; |
| 194 typedef SkTLList<Draw, 4> DrawList; | 194 typedef SkTLList<Draw, 4> DrawList; |
| 195 | 195 |
| 196 PendingPathRange fPathRange; | 196 PendingPathRange fPathRange; |
| 197 DrawList fDraws; | 197 DrawList fDraws; |
| 198 int fTotalPathCount; | 198 int fTotalPathCount; |
| 199 SkScalar fScale; | 199 SkScalar fScale; |
| 200 | 200 |
| 201 typedef GrDrawPathBatchBase INHERITED; | 201 typedef GrDrawPathBatchBase INHERITED; |
| 202 }; | 202 }; |
| 203 | 203 |
| 204 #endif | 204 #endif |
| OLD | NEW |