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

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

Issue 1131553002: Isolate GrBufferAllocPools inside GrBatchTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: minor cleanup Created 5 years, 7 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
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 "GrDefaultPathRenderer.h" 8 #include "GrDefaultPathRenderer.h"
9 9
10 #include "GrBatch.h" 10 #include "GrBatch.h"
11 #include "GrBatchTarget.h" 11 #include "GrBatchTarget.h"
12 #include "GrBufferAllocPool.h"
13 #include "GrContext.h" 12 #include "GrContext.h"
14 #include "GrDefaultGeoProcFactory.h" 13 #include "GrDefaultGeoProcFactory.h"
15 #include "GrPathUtils.h" 14 #include "GrPathUtils.h"
16 #include "GrPipelineBuilder.h" 15 #include "GrPipelineBuilder.h"
17 #include "GrVertices.h" 16 #include "GrVertices.h"
18 #include "SkGeometry.h" 17 #include "SkGeometry.h"
19 #include "SkString.h" 18 #include "SkString.h"
20 #include "SkStrokeRec.h" 19 #include "SkStrokeRec.h"
21 #include "SkTLazy.h" 20 #include "SkTLazy.h"
22 #include "SkTraceEvent.h" 21 #include "SkTraceEvent.h"
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 primitiveType = kTriangles_GrPrimitiveType; 311 primitiveType = kTriangles_GrPrimitiveType;
313 } else { 312 } else {
314 primitiveType = kTriangleFan_GrPrimitiveType; 313 primitiveType = kTriangleFan_GrPrimitiveType;
315 } 314 }
316 } 315 }
317 316
318 // allocate vertex / index buffers 317 // allocate vertex / index buffers
319 const GrVertexBuffer* vertexBuffer; 318 const GrVertexBuffer* vertexBuffer;
320 int firstVertex; 319 int firstVertex;
321 320
322 void* verts = batchTarget->vertexPool()->makeSpace(vertexStride, 321 void* verts = batchTarget->makeVertSpace(vertexStride, maxVertices,
323 maxVertices, 322 &vertexBuffer, &firstVertex);
324 &vertexBuffer,
325 &firstVertex);
326 323
327 if (!verts) { 324 if (!verts) {
328 SkDebugf("Could not allocate vertices\n"); 325 SkDebugf("Could not allocate vertices\n");
329 return; 326 return;
330 } 327 }
331 328
332 const GrIndexBuffer* indexBuffer = NULL; 329 const GrIndexBuffer* indexBuffer = NULL;
333 int firstIndex = 0; 330 int firstIndex = 0;
334 331
335 void* indices = NULL; 332 void* indices = NULL;
336 if (isIndexed) { 333 if (isIndexed) {
337 indices = batchTarget->indexPool()->makeSpace(maxIndices, 334 indices = batchTarget->makeIndexSpace(maxIndices, &indexBuffer, &fir stIndex);
338 &indexBuffer,
339 &firstIndex);
340 335
341 if (!indices) { 336 if (!indices) {
342 SkDebugf("Could not allocate indices\n"); 337 SkDebugf("Could not allocate indices\n");
343 return; 338 return;
344 } 339 }
345 } 340 }
346 341
347 // fill buffers 342 // fill buffers
348 int vertexOffset = 0; 343 int vertexOffset = 0;
349 int indexOffset = 0; 344 int indexOffset = 0;
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 736
742 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, 737 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target,
743 GrPipelineBuilder* pipelineBuilder, 738 GrPipelineBuilder* pipelineBuilder,
744 const SkMatrix& viewMatrix, 739 const SkMatrix& viewMatrix,
745 const SkPath& path, 740 const SkPath& path,
746 const GrStrokeInfo& stroke) { 741 const GrStrokeInfo& stroke) {
747 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); 742 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType());
748 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); 743 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType());
749 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p ath, stroke, true); 744 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p ath, stroke, true);
750 } 745 }
OLDNEW
« src/gpu/GrBatchTarget.h ('K') | « src/gpu/GrContext.cpp ('k') | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698