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

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

Issue 1835283002: Simplify GrDrawBatch uploads and token uage. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 8 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/batches/GrAtlasTextBatch.cpp ('k') | src/gpu/batches/GrDrawAtlasBatch.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 "GrDefaultPathRenderer.h" 8 #include "GrDefaultPathRenderer.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 } 262 }
263 LocalCoords localCoords(this->usesLocalCoords() ? LocalCoords::kUseP osition_Type : 263 LocalCoords localCoords(this->usesLocalCoords() ? LocalCoords::kUseP osition_Type :
264 LocalCoords::kUnus ed_Type); 264 LocalCoords::kUnus ed_Type);
265 gp.reset(GrDefaultGeoProcFactory::Create(color, coverage, localCoord s, 265 gp.reset(GrDefaultGeoProcFactory::Create(color, coverage, localCoord s,
266 this->viewMatrix())); 266 this->viewMatrix()));
267 } 267 }
268 268
269 size_t vertexStride = gp->getVertexStride(); 269 size_t vertexStride = gp->getVertexStride();
270 SkASSERT(vertexStride == sizeof(SkPoint)); 270 SkASSERT(vertexStride == sizeof(SkPoint));
271 271
272 target->initDraw(gp);
273
274 int instanceCount = fGeoData.count(); 272 int instanceCount = fGeoData.count();
275 273
276 // compute number of vertices 274 // compute number of vertices
277 int maxVertices = 0; 275 int maxVertices = 0;
278 276
279 // We will use index buffers if we have multiple paths or one path with multiple contours 277 // We will use index buffers if we have multiple paths or one path with multiple contours
280 bool isIndexed = instanceCount > 1; 278 bool isIndexed = instanceCount > 1;
281 for (int i = 0; i < instanceCount; i++) { 279 for (int i = 0; i < instanceCount; i++) {
282 const Geometry& args = fGeoData[i]; 280 const Geometry& args = fGeoData[i];
283 281
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 SkASSERT(vertexOffset <= maxVertices && indexOffset <= maxIndices); 360 SkASSERT(vertexOffset <= maxVertices && indexOffset <= maxIndices);
363 } 361 }
364 362
365 GrMesh mesh; 363 GrMesh mesh;
366 if (isIndexed) { 364 if (isIndexed) {
367 mesh.initIndexed(primitiveType, vertexBuffer, indexBuffer, firstVert ex, firstIndex, 365 mesh.initIndexed(primitiveType, vertexBuffer, indexBuffer, firstVert ex, firstIndex,
368 vertexOffset, indexOffset); 366 vertexOffset, indexOffset);
369 } else { 367 } else {
370 mesh.init(primitiveType, vertexBuffer, firstVertex, vertexOffset); 368 mesh.init(primitiveType, vertexBuffer, firstVertex, vertexOffset);
371 } 369 }
372 target->draw(mesh); 370 target->draw(gp, mesh);
373 371
374 // put back reserves 372 // put back reserves
375 target->putBackIndices((size_t)(maxIndices - indexOffset)); 373 target->putBackIndices((size_t)(maxIndices - indexOffset));
376 target->putBackVertices((size_t)(maxVertices - vertexOffset), (size_t)ve rtexStride); 374 target->putBackVertices((size_t)(maxVertices - vertexOffset), (size_t)ve rtexStride);
377 } 375 }
378 376
379 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } 377 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
380 378
381 DefaultPathBatch(const Geometry& geometry, uint8_t coverage, const SkMatrix& viewMatrix, 379 DefaultPathBatch(const Geometry& geometry, uint8_t coverage, const SkMatrix& viewMatrix,
382 bool isHairline, const SkRect& devBounds) 380 bool isHairline, const SkRect& devBounds)
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 geometry.fColor = color; 767 geometry.fColor = color;
770 geometry.fPath = path; 768 geometry.fPath = path;
771 geometry.fTolerance = srcSpaceTol; 769 geometry.fTolerance = srcSpaceTol;
772 770
773 viewMatrix.mapRect(&bounds); 771 viewMatrix.mapRect(&bounds);
774 uint8_t coverage = GrRandomCoverage(random); 772 uint8_t coverage = GrRandomCoverage(random);
775 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds ); 773 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds );
776 } 774 }
777 775
778 #endif 776 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrAtlasTextBatch.cpp ('k') | src/gpu/batches/GrDrawAtlasBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698