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

Unified Diff: src/gpu/GrAAHairLinePathRenderer.cpp

Issue 1122673002: Start on simplifying generateGeometry() overrides (Closed) Base URL: https://skia.googlesource.com/skia.git@ibcache
Patch Set: whitespace, remove debug return Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrAADistanceFieldPathRenderer.cpp ('k') | src/gpu/GrAARectRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAAHairLinePathRenderer.cpp
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index f046af871f5ef1dab82218130e02defc63480e67..ba6dcecd43d08340bd57deac5a2dec20219c2a77 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -888,23 +888,14 @@ void AAHairlineBatch::generateGeometry(GrBatchTarget* batchTarget, const GrPipel
}
{
+ int linesLeft = lineCount;
GrDrawTarget::DrawInfo info;
- info.setVertexBuffer(vertexBuffer);
- info.setIndexBuffer(linesIndexBuffer);
- info.setPrimitiveType(kTriangles_GrPrimitiveType);
- info.setStartIndex(0);
-
- int lines = 0;
- while (lines < lineCount) {
- int n = SkTMin(lineCount - lines, kLineSegsNumInIdxBuffer);
-
- info.setStartVertex(kLineSegNumVertices*lines + firstVertex);
- info.setVertexCount(kLineSegNumVertices*n);
- info.setIndexCount(kIdxsPerLineSeg*n);
+ info.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, linesIndexBuffer,
+ firstVertex, kLineSegNumVertices, kIdxsPerLineSeg, &linesLeft,
+ kLineSegsNumInIdxBuffer);
+ do {
batchTarget->draw(info);
-
- lines += n;
- }
+ } while (info.nextInstances(&linesLeft, kLineSegsNumInIdxBuffer));
}
}
@@ -953,23 +944,15 @@ void AAHairlineBatch::generateGeometry(GrBatchTarget* batchTarget, const GrPipel
quadGP->initBatchTracker(batchTarget->currentBatchTracker(), init);
{
- GrDrawTarget::DrawInfo info;
- info.setVertexBuffer(vertexBuffer);
- info.setIndexBuffer(quadsIndexBuffer);
- info.setPrimitiveType(kTriangles_GrPrimitiveType);
- info.setStartIndex(0);
-
- int quads = 0;
- while (quads < quadCount) {
- int n = SkTMin(quadCount - quads, kQuadsNumInIdxBuffer);
-
- info.setStartVertex(kQuadNumVertices*quads + firstVertex);
- info.setVertexCount(kQuadNumVertices*n);
- info.setIndexCount(kIdxsPerQuad*n);
+ int quadsLeft = quadCount;
+ GrDrawTarget::DrawInfo info;
+ info.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, quadsIndexBuffer,
+ firstVertex, kQuadNumVertices, kIdxsPerQuad, &quadsLeft,
+ kQuadsNumInIdxBuffer);
+ do {
batchTarget->draw(info);
-
- quads += n;
- }
+ } while (info.nextInstances(&quadsLeft, kQuadsNumInIdxBuffer));
+ firstVertex += quadCount * kQuadNumVertices;
}
}
@@ -985,23 +968,14 @@ void AAHairlineBatch::generateGeometry(GrBatchTarget* batchTarget, const GrPipel
conicGP->initBatchTracker(batchTarget->currentBatchTracker(), init);
{
+ int conicsLeft = conicCount;
GrDrawTarget::DrawInfo info;
- info.setVertexBuffer(vertexBuffer);
- info.setIndexBuffer(quadsIndexBuffer);
- info.setPrimitiveType(kTriangles_GrPrimitiveType);
- info.setStartIndex(0);
-
- int conics = 0;
- while (conics < conicCount) {
- int n = SkTMin(conicCount - conics, kQuadsNumInIdxBuffer);
-
- info.setStartVertex(kQuadNumVertices*(quadCount + conics) + firstVertex);
- info.setVertexCount(kQuadNumVertices*n);
- info.setIndexCount(kIdxsPerQuad*n);
+ info.initInstanced(kTriangles_GrPrimitiveType, vertexBuffer, quadsIndexBuffer,
+ firstVertex, kQuadNumVertices, kIdxsPerQuad, &conicsLeft,
+ kQuadsNumInIdxBuffer);
+ do {
batchTarget->draw(info);
-
- conics += n;
- }
+ } while (info.nextInstances(&conicsLeft, kQuadsNumInIdxBuffer));
}
}
}
« no previous file with comments | « src/gpu/GrAADistanceFieldPathRenderer.cpp ('k') | src/gpu/GrAARectRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698