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

Unified Diff: src/gpu/GrContext.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/GrBitmapTextContext.cpp ('k') | src/gpu/GrDistanceFieldTextContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 322ea87dcb88017904d13777aebbeb6d4535230a..3b44b7e7c089ec8400c7efcbd913f413b411fcd5 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -365,8 +365,7 @@
GrTextureParams::kNone_FilterMode);
drawState->addColorTextureEffect(clampedTexture, SkMatrix::I(), params);
- drawState->setVertexAttribs<gVertexAttribs>(SK_ARRAY_COUNT(gVertexAttribs),
- 2 * sizeof(SkPoint));
+ drawState->setVertexAttribs<gVertexAttribs>(SK_ARRAY_COUNT(gVertexAttribs));
GrDrawTarget::AutoReleaseGeometry arg(fGpu, 4, 0);
@@ -936,16 +935,10 @@
{kVec4ub_GrVertexAttribType, 2*sizeof(SkPoint), kColor_GrVertexAttribBinding}
};
-static const size_t kPosUVAttribsSize = 2 * sizeof(SkPoint);
-static const size_t kPosUVColorAttribsSize = 2 * sizeof(SkPoint) + sizeof(GrColor);
-
extern const GrVertexAttrib gPosColorAttribs[] = {
{kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding},
{kVec4ub_GrVertexAttribType, sizeof(SkPoint), kColor_GrVertexAttribBinding},
};
-
-static const size_t kPosAttribsSize = sizeof(SkPoint);
-static const size_t kPosColorAttribsSize = sizeof(SkPoint) + sizeof(GrColor);
static void set_vertex_attributes(GrDrawState* drawState,
const SkPoint* texCoords,
@@ -958,15 +951,15 @@
if (NULL != texCoords && NULL != colors) {
*texOffset = sizeof(SkPoint);
*colorOffset = 2*sizeof(SkPoint);
- drawState->setVertexAttribs<gPosUVColorAttribs>(3, kPosUVColorAttribsSize);
+ drawState->setVertexAttribs<gPosUVColorAttribs>(3);
} else if (NULL != texCoords) {
*texOffset = sizeof(SkPoint);
- drawState->setVertexAttribs<gPosUVColorAttribs>(2, kPosUVAttribsSize);
+ drawState->setVertexAttribs<gPosUVColorAttribs>(2);
} else if (NULL != colors) {
*colorOffset = sizeof(SkPoint);
- drawState->setVertexAttribs<gPosColorAttribs>(2, kPosColorAttribsSize);
+ drawState->setVertexAttribs<gPosColorAttribs>(2);
} else {
- drawState->setVertexAttribs<gPosColorAttribs>(1, kPosAttribsSize);
+ drawState->setVertexAttribs<gPosColorAttribs>(1);
}
}
@@ -995,8 +988,8 @@
int colorOffset = -1, texOffset = -1;
set_vertex_attributes(drawState, texCoords, colors, &colorOffset, &texOffset);
- size_t VertexStride = drawState->getVertexStride();
- if (sizeof(SkPoint) != VertexStride) {
+ size_t vertexSize = drawState->getVertexSize();
+ if (sizeof(SkPoint) != vertexSize) {
if (!geo.set(target, vertexCount, 0)) {
GrPrintf("Failed to get space for vertices!\n");
return;
@@ -1012,7 +1005,7 @@
if (colorOffset >= 0) {
*(GrColor*)((intptr_t)curVertex + colorOffset) = colors[i];
}
- curVertex = (void*)((intptr_t)curVertex + VertexStride);
+ curVertex = (void*)((intptr_t)curVertex + vertexSize);
}
} else {
target->setVertexSourceToArray(positions, vertexCount);
« no previous file with comments | « src/gpu/GrBitmapTextContext.cpp ('k') | src/gpu/GrDistanceFieldTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698