Index: src/gpu/GrContext.cpp |
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp |
index 63beb7de22645a9c191e36b287f1fb2f60c60e7a..874453aca42c73f41f6e1fd710bb7536209adaf6 100755 |
--- a/src/gpu/GrContext.cpp |
+++ b/src/gpu/GrContext.cpp |
@@ -365,7 +365,8 @@ GrTexture* GrContext::createResizedTexture(const GrTextureDesc& desc, |
GrTextureParams::kNone_FilterMode); |
drawState->addColorTextureEffect(clampedTexture, SkMatrix::I(), params); |
- drawState->setVertexAttribs<gVertexAttribs>(SK_ARRAY_COUNT(gVertexAttribs)); |
+ drawState->setVertexAttribs<gVertexAttribs>(SK_ARRAY_COUNT(gVertexAttribs), |
+ 2 * sizeof(SkPoint)); |
GrDrawTarget::AutoReleaseGeometry arg(fGpu, 4, 0); |
@@ -951,15 +952,15 @@ static void set_vertex_attributes(GrDrawState* drawState, |
if (NULL != texCoords && NULL != colors) { |
*texOffset = sizeof(SkPoint); |
*colorOffset = 2*sizeof(SkPoint); |
bsalomon
2014/08/27 17:46:27
static consts?
egdaniel
2014/08/27 18:33:55
Done.
|
- drawState->setVertexAttribs<gPosUVColorAttribs>(3); |
+ drawState->setVertexAttribs<gPosUVColorAttribs>(3, 2 * sizeof(SkPoint) + sizeof(SkColor)); |
} else if (NULL != texCoords) { |
*texOffset = sizeof(SkPoint); |
- drawState->setVertexAttribs<gPosUVColorAttribs>(2); |
+ drawState->setVertexAttribs<gPosUVColorAttribs>(2, 2 * sizeof(SkPoint)); |
} else if (NULL != colors) { |
*colorOffset = sizeof(SkPoint); |
- drawState->setVertexAttribs<gPosColorAttribs>(2); |
+ drawState->setVertexAttribs<gPosColorAttribs>(2, sizeof(SkPoint) + sizeof(SkColor)); |
} else { |
- drawState->setVertexAttribs<gPosColorAttribs>(1); |
+ drawState->setVertexAttribs<gPosColorAttribs>(1, sizeof(SkPoint)); |
} |
} |
@@ -988,8 +989,8 @@ void GrContext::drawVertices(const GrPaint& paint, |
int colorOffset = -1, texOffset = -1; |
set_vertex_attributes(drawState, texCoords, colors, &colorOffset, &texOffset); |
- size_t vertexSize = drawState->getVertexSize(); |
- if (sizeof(SkPoint) != vertexSize) { |
+ size_t VertexStride = drawState->getVertexStride(); |
+ if (sizeof(SkPoint) != VertexStride) { |
if (!geo.set(target, vertexCount, 0)) { |
GrPrintf("Failed to get space for vertices!\n"); |
return; |
@@ -1005,7 +1006,7 @@ void GrContext::drawVertices(const GrPaint& paint, |
if (colorOffset >= 0) { |
*(GrColor*)((intptr_t)curVertex + colorOffset) = colors[i]; |
} |
- curVertex = (void*)((intptr_t)curVertex + vertexSize); |
+ curVertex = (void*)((intptr_t)curVertex + VertexStride); |
} |
} else { |
target->setVertexSourceToArray(positions, vertexCount); |