| 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 GrTInstanceBatch_DEFINED | 8 #ifndef GrTInstanceBatch_DEFINED |
| 9 #define GrTInstanceBatch_DEFINED | 9 #define GrTInstanceBatch_DEFINED |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * void SetBounds(const Geometry& seedGeometry, SkRect* outBounds) | 27 * void SetBounds(const Geometry& seedGeometry, SkRect* outBounds) |
| 28 * | 28 * |
| 29 * void UpdateBoundsAfterAppend(const Geometry& lastGeometry, SkRect* curren
tBounds) | 29 * void UpdateBoundsAfterAppend(const Geometry& lastGeometry, SkRect* curren
tBounds) |
| 30 * | 30 * |
| 31 * bool CanCombine(const Geometry& mine, const Geometry& theirs, | 31 * bool CanCombine(const Geometry& mine, const Geometry& theirs, |
| 32 * const GrXPOverridesForBatch&) | 32 * const GrXPOverridesForBatch&) |
| 33 * | 33 * |
| 34 * const GrGeometryProcessor* CreateGP(const Geometry& seedGeometry, | 34 * const GrGeometryProcessor* CreateGP(const Geometry& seedGeometry, |
| 35 * const GrXPOverridesForBatch& override
s) | 35 * const GrXPOverridesForBatch& override
s) |
| 36 * | 36 * |
| 37 * const GrBuffer* GetIndexBuffer(GrResourceProvider*) | 37 * const GrIndexBuffer* GetIndexBuffer(GrResourceProvider*) |
| 38 * | 38 * |
| 39 * Tesselate(intptr_t vertices, size_t vertexStride, const Geometry& geo, | 39 * Tesselate(intptr_t vertices, size_t vertexStride, const Geometry& geo, |
| 40 * const GrXPOverridesForBatch& overrides) | 40 * const GrXPOverridesForBatch& overrides) |
| 41 */ | 41 */ |
| 42 template <typename Impl> | 42 template <typename Impl> |
| 43 class GrTInstanceBatch : public GrVertexBatch { | 43 class GrTInstanceBatch : public GrVertexBatch { |
| 44 public: | 44 public: |
| 45 DEFINE_BATCH_CLASS_ID | 45 DEFINE_BATCH_CLASS_ID |
| 46 | 46 |
| 47 typedef typename Impl::Geometry Geometry; | 47 typedef typename Impl::Geometry Geometry; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 if (!gp) { | 94 if (!gp) { |
| 95 SkDebugf("Couldn't create GrGeometryProcessor\n"); | 95 SkDebugf("Couldn't create GrGeometryProcessor\n"); |
| 96 return; | 96 return; |
| 97 } | 97 } |
| 98 | 98 |
| 99 target->initDraw(gp); | 99 target->initDraw(gp); |
| 100 | 100 |
| 101 size_t vertexStride = gp->getVertexStride(); | 101 size_t vertexStride = gp->getVertexStride(); |
| 102 int instanceCount = fGeoData.count(); | 102 int instanceCount = fGeoData.count(); |
| 103 | 103 |
| 104 SkAutoTUnref<const GrBuffer> indexBuffer( | 104 SkAutoTUnref<const GrIndexBuffer> indexBuffer( |
| 105 Impl::GetIndexBuffer(target->resourceProvider())); | 105 Impl::GetIndexBuffer(target->resourceProvider())); |
| 106 InstancedHelper helper; | 106 InstancedHelper helper; |
| 107 void* vertices = helper.init(target, kTriangles_GrPrimitiveType, vertexS
tride, | 107 void* vertices = helper.init(target, kTriangles_GrPrimitiveType, vertexS
tride, |
| 108 indexBuffer, Impl::kVertsPerInstance, | 108 indexBuffer, Impl::kVertsPerInstance, |
| 109 Impl::kIndicesPerInstance, instanceCount); | 109 Impl::kIndicesPerInstance, instanceCount); |
| 110 if (!vertices || !indexBuffer) { | 110 if (!vertices || !indexBuffer) { |
| 111 SkDebugf("Could not allocate vertices\n"); | 111 SkDebugf("Could not allocate vertices\n"); |
| 112 return; | 112 return; |
| 113 } | 113 } |
| 114 | 114 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 144 return true; | 144 return true; |
| 145 } | 145 } |
| 146 | 146 |
| 147 GrXPOverridesForBatch fOverrides; | 147 GrXPOverridesForBatch fOverrides; |
| 148 SkSTArray<1, Geometry, true> fGeoData; | 148 SkSTArray<1, Geometry, true> fGeoData; |
| 149 | 149 |
| 150 typedef GrVertexBatch INHERITED; | 150 typedef GrVertexBatch INHERITED; |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 #endif | 153 #endif |
| OLD | NEW |