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

Unified Diff: src/gpu/GrInOrderDrawBuffer.cpp

Issue 502533004: Revert of Make setVertexAttribs in GrDrawState take a stride parameter. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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/GrDrawTarget.cpp ('k') | src/gpu/GrOvalRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrInOrderDrawBuffer.cpp
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 4fd6b4e331785b5e3cbdbd4390745c3581a61132..9df54a807609719911ed4f3929ddfdb81c5fe687 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -97,9 +97,9 @@
*/
static void set_vertex_attributes(GrDrawState* drawState, bool hasLocalCoords, GrColor color) {
if (hasLocalCoords) {
- drawState->setVertexAttribs<kRectAttribs>(3, 2 * sizeof(SkPoint) + sizeof(SkColor));
+ drawState->setVertexAttribs<kRectAttribs>(3);
} else {
- drawState->setVertexAttribs<kRectAttribs>(2, sizeof(SkPoint) + sizeof(SkColor));
+ drawState->setVertexAttribs<kRectAttribs>(2);
}
if (0xFF == GrColorUnpackA(color)) {
drawState->setHint(GrDrawState::kVertexColorsAreOpaque_Hint, true);
@@ -143,24 +143,24 @@
return;
}
- size_t vstride = drawState->getVertexStride();
-
- geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, vstride);
- matrix.mapPointsWithStride(geo.positions(), vstride, 4);
+ size_t vsize = drawState->getVertexSize();
+
+ geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, vsize);
+ matrix.mapPointsWithStride(geo.positions(), vsize, 4);
SkRect devBounds;
// since we already computed the dev verts, set the bounds hint. This will help us avoid
// unnecessary clipping in our onDraw().
- get_vertex_bounds(geo.vertices(), vstride, 4, &devBounds);
+ get_vertex_bounds(geo.vertices(), vsize, 4, &devBounds);
if (NULL != localRect) {
static const int kLocalOffset = sizeof(SkPoint) + sizeof(GrColor);
SkPoint* coords = GrTCast<SkPoint*>(GrTCast<intptr_t>(geo.vertices()) + kLocalOffset);
coords->setRectFan(localRect->fLeft, localRect->fTop,
localRect->fRight, localRect->fBottom,
- vstride);
+ vsize);
if (NULL != localMatrix) {
- localMatrix->mapPointsWithStride(coords, vstride, 4);
+ localMatrix->mapPointsWithStride(coords, vsize, 4);
}
}
@@ -168,7 +168,7 @@
GrColor* vertColor = GrTCast<GrColor*>(GrTCast<intptr_t>(geo.vertices()) + kColorOffset);
for (int i = 0; i < 4; ++i) {
*vertColor = color;
- vertColor = (GrColor*) ((intptr_t) vertColor + vstride);
+ vertColor = (GrColor*) ((intptr_t) vertColor + vsize);
}
this->setIndexSourceToBuffer(this->getContext()->getQuadIndexBuffer());
@@ -266,7 +266,7 @@
// update the amount of reserved vertex data actually referenced in draws
size_t vertexBytes = instancesToConcat * info.verticesPerInstance() *
- drawState.getVertexStride();
+ drawState.getVertexSize();
poolState.fUsedPoolVertexBytes = SkTMax(poolState.fUsedPoolVertexBytes, vertexBytes);
draw->adjustInstanceCount(instancesToConcat);
@@ -339,7 +339,7 @@
case kReserved_GeometrySrcType: // fallthrough
case kArray_GeometrySrcType: {
size_t vertexBytes = (info.vertexCount() + info.startVertex()) *
- drawState.getVertexStride();
+ drawState.getVertexSize();
poolState.fUsedPoolVertexBytes = SkTMax(poolState.fUsedPoolVertexBytes, vertexBytes);
draw->fVertexBuffer = poolState.fPoolVertexBuffer;
draw->adjustStartVertex(poolState.fPoolStartVertex);
@@ -726,11 +726,11 @@
*indexCount = currIndices;
}
if (NULL != vertexCount) {
- size_t vertexStride = this->getDrawState().getVertexStride();
- int32_t currVertices = fVertexPool.currentBufferVertices(vertexStride);
+ size_t vertexSize = this->getDrawState().getVertexSize();
+ int32_t currVertices = fVertexPool.currentBufferVertices(vertexSize);
if (*vertexCount > currVertices &&
(!fVertexPool.preallocatedBuffersRemaining() &&
- *vertexCount <= fVertexPool.preallocatedBufferVertices(vertexStride))) {
+ *vertexCount <= fVertexPool.preallocatedBufferVertices(vertexSize))) {
flush = true;
}
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrOvalRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698