| Index: src/gpu/GrContext.cpp
|
| diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
|
| index 3b44b7e7c089ec8400c7efcbd913f413b411fcd5..322ea87dcb88017904d13777aebbeb6d4535230a 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);
|
|
|
| @@ -935,11 +936,17 @@ extern const GrVertexAttrib gPosUVColorAttribs[] = {
|
| {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,
|
| const GrColor* colors,
|
| @@ -951,15 +958,15 @@ static void set_vertex_attributes(GrDrawState* drawState,
|
| if (NULL != texCoords && NULL != colors) {
|
| *texOffset = sizeof(SkPoint);
|
| *colorOffset = 2*sizeof(SkPoint);
|
| - drawState->setVertexAttribs<gPosUVColorAttribs>(3);
|
| + drawState->setVertexAttribs<gPosUVColorAttribs>(3, kPosUVColorAttribsSize);
|
| } else if (NULL != texCoords) {
|
| *texOffset = sizeof(SkPoint);
|
| - drawState->setVertexAttribs<gPosUVColorAttribs>(2);
|
| + drawState->setVertexAttribs<gPosUVColorAttribs>(2, kPosUVAttribsSize);
|
| } else if (NULL != colors) {
|
| *colorOffset = sizeof(SkPoint);
|
| - drawState->setVertexAttribs<gPosColorAttribs>(2);
|
| + drawState->setVertexAttribs<gPosColorAttribs>(2, kPosColorAttribsSize);
|
| } else {
|
| - drawState->setVertexAttribs<gPosColorAttribs>(1);
|
| + drawState->setVertexAttribs<gPosColorAttribs>(1, kPosAttribsSize);
|
| }
|
| }
|
|
|
| @@ -988,8 +995,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 +1012,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);
|
|
|