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 #include "GrDrawVerticesBatch.h" | 8 #include "GrDrawVerticesBatch.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 fCoverageIgnored)); | 99 fCoverageIgnored)); |
100 target->initDraw(gp); | 100 target->initDraw(gp); |
101 | 101 |
102 size_t vertexStride = gp->getVertexStride(); | 102 size_t vertexStride = gp->getVertexStride(); |
103 | 103 |
104 SkASSERT(vertexStride == sizeof(SkPoint) + (hasLocalCoords ? sizeof(SkPoint)
: 0) | 104 SkASSERT(vertexStride == sizeof(SkPoint) + (hasLocalCoords ? sizeof(SkPoint)
: 0) |
105 + sizeof(GrColor)); | 105 + sizeof(GrColor)); |
106 | 106 |
107 int instanceCount = fGeoData.count(); | 107 int instanceCount = fGeoData.count(); |
108 | 108 |
109 const GrBuffer* vertexBuffer; | 109 const GrVertexBuffer* vertexBuffer; |
110 int firstVertex; | 110 int firstVertex; |
111 | 111 |
112 void* verts = target->makeVertexSpace(vertexStride, fVertexCount, &vertexBuf
fer, &firstVertex); | 112 void* verts = target->makeVertexSpace(vertexStride, fVertexCount, &vertexBuf
fer, &firstVertex); |
113 | 113 |
114 if (!verts) { | 114 if (!verts) { |
115 SkDebugf("Could not allocate vertices\n"); | 115 SkDebugf("Could not allocate vertices\n"); |
116 return; | 116 return; |
117 } | 117 } |
118 | 118 |
119 const GrBuffer* indexBuffer = nullptr; | 119 const GrIndexBuffer* indexBuffer = nullptr; |
120 int firstIndex = 0; | 120 int firstIndex = 0; |
121 | 121 |
122 uint16_t* indices = nullptr; | 122 uint16_t* indices = nullptr; |
123 if (!fGeoData[0].fIndices.isEmpty()) { | 123 if (!fGeoData[0].fIndices.isEmpty()) { |
124 indices = target->makeIndexSpace(fIndexCount, &indexBuffer, &firstIndex)
; | 124 indices = target->makeIndexSpace(fIndexCount, &indexBuffer, &firstIndex)
; |
125 | 125 |
126 if (!indices) { | 126 if (!indices) { |
127 SkDebugf("Could not allocate indices\n"); | 127 SkDebugf("Could not allocate indices\n"); |
128 return; | 128 return; |
129 } | 129 } |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 geometry.fColor = GrRandomColor(random); | 317 geometry.fColor = GrRandomColor(random); |
318 return GrDrawVerticesBatch::Create(geometry, type, viewMatrix, | 318 return GrDrawVerticesBatch::Create(geometry, type, viewMatrix, |
319 positions.begin(), vertexCount, | 319 positions.begin(), vertexCount, |
320 indices.begin(), hasIndices ? vertexCount
: 0, | 320 indices.begin(), hasIndices ? vertexCount
: 0, |
321 colors.begin(), | 321 colors.begin(), |
322 texCoords.begin(), | 322 texCoords.begin(), |
323 bounds); | 323 bounds); |
324 } | 324 } |
325 | 325 |
326 #endif | 326 #endif |
OLD | NEW |