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 "GrBatchTarget.h" | 10 #include "GrBatchTarget.h" |
(...skipping 165 matching lines...) Loading... |
176 if (this->hasIndices()) { | 176 if (this->hasIndices()) { |
177 vertices.initIndexed(this->primitiveType(), vertexBuffer, indexBuffer, f
irstVertex, | 177 vertices.initIndexed(this->primitiveType(), vertexBuffer, indexBuffer, f
irstVertex, |
178 firstIndex, this->vertexCount(), this->indexCount()
); | 178 firstIndex, this->vertexCount(), this->indexCount()
); |
179 | 179 |
180 } else { | 180 } else { |
181 vertices.init(this->primitiveType(), vertexBuffer, firstVertex, this->ve
rtexCount()); | 181 vertices.init(this->primitiveType(), vertexBuffer, firstVertex, this->ve
rtexCount()); |
182 } | 182 } |
183 batchTarget->draw(vertices); | 183 batchTarget->draw(vertices); |
184 } | 184 } |
185 | 185 |
186 bool GrDrawVerticesBatch::onCombineIfPossible(GrBatch* t) { | 186 bool GrDrawVerticesBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) { |
187 if (!this->pipeline()->isEqual(*t->pipeline())) { | 187 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(
), t->bounds(), |
| 188 caps)) { |
188 return false; | 189 return false; |
189 } | 190 } |
190 | 191 |
191 GrDrawVerticesBatch* that = t->cast<GrDrawVerticesBatch>(); | 192 GrDrawVerticesBatch* that = t->cast<GrDrawVerticesBatch>(); |
192 | 193 |
193 if (!this->batchablePrimitiveType() || this->primitiveType() != that->primit
iveType()) { | 194 if (!this->batchablePrimitiveType() || this->primitiveType() != that->primit
iveType()) { |
194 return false; | 195 return false; |
195 } | 196 } |
196 | 197 |
197 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); | 198 SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); |
(...skipping 141 matching lines...) Loading... |
339 geometry.fColor = GrRandomColor(random); | 340 geometry.fColor = GrRandomColor(random); |
340 return GrDrawVerticesBatch::Create(geometry, type, viewMatrix, | 341 return GrDrawVerticesBatch::Create(geometry, type, viewMatrix, |
341 positions.begin(), vertexCount, | 342 positions.begin(), vertexCount, |
342 indices.begin(), hasIndices ? vertexCount
: 0, | 343 indices.begin(), hasIndices ? vertexCount
: 0, |
343 colors.begin(), | 344 colors.begin(), |
344 texCoords.begin(), | 345 texCoords.begin(), |
345 bounds); | 346 bounds); |
346 } | 347 } |
347 | 348 |
348 #endif | 349 #endif |
OLD | NEW |