| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrInOrderDrawBuffer.h" | 8 #include "GrInOrderDrawBuffer.h" |
| 9 | 9 |
| 10 #include "GrDefaultGeoProcFactory.h" | 10 #include "GrDefaultGeoProcFactory.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 int vertexCount = kVertsPerRect * instanceCount; | 140 int vertexCount = kVertsPerRect * instanceCount; |
| 141 | 141 |
| 142 const GrVertexBuffer* vertexBuffer; | 142 const GrVertexBuffer* vertexBuffer; |
| 143 int firstVertex; | 143 int firstVertex; |
| 144 | 144 |
| 145 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, | 145 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, |
| 146 vertexCount, | 146 vertexCount, |
| 147 &vertexBuffer, | 147 &vertexBuffer, |
| 148 &firstVertex); | 148 &firstVertex); |
| 149 | 149 |
| 150 if (!vertices || !batchTarget->quadIndexBuffer()) { |
| 151 SkDebugf("Could not allocate buffers\n"); |
| 152 return; |
| 153 } |
| 154 |
| 150 for (int i = 0; i < instanceCount; i++) { | 155 for (int i = 0; i < instanceCount; i++) { |
| 151 const Geometry& args = fGeoData[i]; | 156 const Geometry& args = fGeoData[i]; |
| 152 | 157 |
| 153 intptr_t offset = GrTCast<intptr_t>(vertices) + kVertsPerRect * i *
vertexStride; | 158 intptr_t offset = GrTCast<intptr_t>(vertices) + kVertsPerRect * i *
vertexStride; |
| 154 SkPoint* positions = GrTCast<SkPoint*>(offset); | 159 SkPoint* positions = GrTCast<SkPoint*>(offset); |
| 155 | 160 |
| 156 positions->setRectFan(args.fRect.fLeft, args.fRect.fTop, | 161 positions->setRectFan(args.fRect.fLeft, args.fRect.fTop, |
| 157 args.fRect.fRight, args.fRect.fBottom, vertexS
tride); | 162 args.fRect.fRight, args.fRect.fBottom, vertexS
tride); |
| 158 args.fViewMatrix.mapPointsWithStride(positions, vertexStride, kVerts
PerRect); | 163 args.fViewMatrix.mapPointsWithStride(positions, vertexStride, kVerts
PerRect); |
| 159 | 164 |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 } | 408 } |
| 404 } | 409 } |
| 405 | 410 |
| 406 void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace(int vertexCount, | 411 void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace(int vertexCount, |
| 407 size_t vertexStride, | 412 size_t vertexStride, |
| 408 int indexCount) { | 413 int indexCount) { |
| 409 fCommands.closeBatch(); | 414 fCommands.closeBatch(); |
| 410 | 415 |
| 411 this->INHERITED::willReserveVertexAndIndexSpace(vertexCount, vertexStride, i
ndexCount); | 416 this->INHERITED::willReserveVertexAndIndexSpace(vertexCount, vertexStride, i
ndexCount); |
| 412 } | 417 } |
| OLD | NEW |