Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(697)

Side by Side Diff: src/gpu/GrInOrderDrawBuffer.cpp

Issue 979343002: handle null vertex or index buffers in batch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrDefaultPathRenderer.cpp ('k') | src/gpu/GrOvalRenderer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/gpu/GrDefaultPathRenderer.cpp ('k') | src/gpu/GrOvalRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698