aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2014-08-27 12:17:24 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-08-27 12:17:24 -0700
commitaf013bf8afc4c77ab8ff230f536e2ade973427fa (patch)
tree1b10644cf38a3fd9a5a4d2acdcd7c3252d41daa0 /src
parentd72094d1c1062a9daa6fa92682ef29f02ba59335 (diff)
Make setVertexAttribs in GrDrawState take a stride parameter.
BUG=skia: R=bsalomon@google.com Author: egdaniel@google.com Review URL: https://codereview.chromium.org/511593004
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrAAConvexPathRenderer.cpp3
-rw-r--r--src/gpu/GrAAHairLinePathRenderer.cpp8
-rw-r--r--src/gpu/GrAARectRenderer.cpp116
-rwxr-xr-xsrc/gpu/GrBitmapTextContext.cpp12
-rwxr-xr-xsrc/gpu/GrContext.cpp23
-rwxr-xr-xsrc/gpu/GrDistanceFieldTextContext.cpp12
-rw-r--r--src/gpu/GrDrawState.cpp24
-rw-r--r--src/gpu/GrDrawState.h18
-rw-r--r--src/gpu/GrDrawTarget.cpp20
-rw-r--r--src/gpu/GrInOrderDrawBuffer.cpp28
-rw-r--r--src/gpu/GrOvalRenderer.cpp20
-rw-r--r--src/gpu/GrRODrawState.cpp2
-rw-r--r--src/gpu/GrRODrawState.h6
-rw-r--r--src/gpu/effects/GrDashingEffect.cpp3
-rw-r--r--src/gpu/gl/GrGpuGL_program.cpp2
15 files changed, 156 insertions, 141 deletions
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index b29c7c80a3..c260382dbb 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -674,7 +674,7 @@ bool GrAAConvexPathRenderer::onDrawPath(const SkPath& origPath,
// Our computed verts should all be within one pixel of the segment control points.
devBounds.outset(SK_Scalar1, SK_Scalar1);
- drawState->setVertexAttribs<gPathAttribs>(SK_ARRAY_COUNT(gPathAttribs));
+ drawState->setVertexAttribs<gPathAttribs>(SK_ARRAY_COUNT(gPathAttribs), sizeof(QuadVertex));
static const int kEdgeAttrIndex = 1;
GrEffect* quadEffect = QuadEdgeEffect::Create();
@@ -684,7 +684,6 @@ bool GrAAConvexPathRenderer::onDrawPath(const SkPath& origPath,
if (!arg.succeeded()) {
return false;
}
- SkASSERT(sizeof(QuadVertex) == drawState->getVertexSize());
verts = reinterpret_cast<QuadVertex*>(arg.vertices());
idxs = reinterpret_cast<uint16_t*>(arg.indices());
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index d5ff40d955..2114720f34 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -731,8 +731,8 @@ bool GrAAHairLinePathRenderer::createLineGeom(const SkPath& path,
int vertCnt = kVertsPerLineSeg * lineCnt;
- drawState->setVertexAttribs<gHairlineLineAttribs>(SK_ARRAY_COUNT(gHairlineLineAttribs));
- SkASSERT(sizeof(LineVertex) == drawState->getVertexSize());
+ drawState->setVertexAttribs<gHairlineLineAttribs>(SK_ARRAY_COUNT(gHairlineLineAttribs),
+ sizeof(LineVertex));
if (!arg->set(target, vertCnt, 0)) {
return false;
@@ -778,8 +778,8 @@ bool GrAAHairLinePathRenderer::createBezierGeom(
int vertCnt = kVertsPerQuad * quadCnt + kVertsPerQuad * conicCnt;
- target->drawState()->setVertexAttribs<gHairlineBezierAttribs>(SK_ARRAY_COUNT(gHairlineBezierAttribs));
- SkASSERT(sizeof(BezierVertex) == target->getDrawState().getVertexSize());
+ int vAttribCnt = SK_ARRAY_COUNT(gHairlineBezierAttribs);
+ target->drawState()->setVertexAttribs<gHairlineBezierAttribs>(vAttribCnt, sizeof(BezierVertex));
if (!arg->set(target, vertCnt, 0)) {
return false;
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index b4790bb99d..a7ddfde7cc 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -276,10 +276,10 @@ enum CoverageAttribType {
static CoverageAttribType set_rect_attribs(GrDrawState* drawState) {
if (drawState->canTweakAlphaForCoverage()) {
- drawState->setVertexAttribs<gAARectAttribs>(2);
+ drawState->setVertexAttribs<gAARectAttribs>(2, sizeof(SkPoint) + sizeof(SkColor));
return kUseColor_CoverageAttribType;
} else {
- drawState->setVertexAttribs<gAARectAttribs>(3);
+ drawState->setVertexAttribs<gAARectAttribs>(3, sizeof(SkPoint) + 2 * sizeof(SkColor));
return kUseCoverage_CoverageAttribType;
}
}
@@ -482,10 +482,10 @@ void GrAARectRenderer::geometryFillAARect(GrGpu* gpu,
}
intptr_t verts = reinterpret_cast<intptr_t>(geo.vertices());
- size_t vsize = drawState->getVertexSize();
+ size_t vstride = drawState->getVertexStride();
SkPoint* fan0Pos = reinterpret_cast<SkPoint*>(verts);
- SkPoint* fan1Pos = reinterpret_cast<SkPoint*>(verts + 4 * vsize);
+ SkPoint* fan1Pos = reinterpret_cast<SkPoint*>(verts + 4 * vstride);
SkScalar inset = SkMinScalar(devRect.width(), SK_Scalar1);
inset = SK_ScalarHalf * SkMinScalar(inset, devRect.height());
@@ -499,8 +499,8 @@ void GrAARectRenderer::geometryFillAARect(GrGpu* gpu,
combinedMatrix.mapRect(&devRect, rect);
#endif
- set_inset_fan(fan0Pos, vsize, devRect, -SK_ScalarHalf, -SK_ScalarHalf);
- set_inset_fan(fan1Pos, vsize, devRect, inset, inset);
+ set_inset_fan(fan0Pos, vstride, devRect, -SK_ScalarHalf, -SK_ScalarHalf);
+ set_inset_fan(fan1Pos, vstride, devRect, inset, inset);
} else {
// compute transformed (1, 0) and (0, 1) vectors
SkVector vec[2] = {
@@ -515,38 +515,38 @@ void GrAARectRenderer::geometryFillAARect(GrGpu* gpu,
// create the rotated rect
fan0Pos->setRectFan(rect.fLeft, rect.fTop,
- rect.fRight, rect.fBottom, vsize);
- combinedMatrix.mapPointsWithStride(fan0Pos, vsize, 4);
+ rect.fRight, rect.fBottom, vstride);
+ combinedMatrix.mapPointsWithStride(fan0Pos, vstride, 4);
// Now create the inset points and then outset the original
// rotated points
// TL
- *((SkPoint*)((intptr_t)fan1Pos + 0 * vsize)) =
- *((SkPoint*)((intptr_t)fan0Pos + 0 * vsize)) + vec[0] + vec[1];
- *((SkPoint*)((intptr_t)fan0Pos + 0 * vsize)) -= vec[0] + vec[1];
+ *((SkPoint*)((intptr_t)fan1Pos + 0 * vstride)) =
+ *((SkPoint*)((intptr_t)fan0Pos + 0 * vstride)) + vec[0] + vec[1];
+ *((SkPoint*)((intptr_t)fan0Pos + 0 * vstride)) -= vec[0] + vec[1];
// BL
- *((SkPoint*)((intptr_t)fan1Pos + 1 * vsize)) =
- *((SkPoint*)((intptr_t)fan0Pos + 1 * vsize)) + vec[0] - vec[1];
- *((SkPoint*)((intptr_t)fan0Pos + 1 * vsize)) -= vec[0] - vec[1];
+ *((SkPoint*)((intptr_t)fan1Pos + 1 * vstride)) =
+ *((SkPoint*)((intptr_t)fan0Pos + 1 * vstride)) + vec[0] - vec[1];
+ *((SkPoint*)((intptr_t)fan0Pos + 1 * vstride)) -= vec[0] - vec[1];
// BR
- *((SkPoint*)((intptr_t)fan1Pos + 2 * vsize)) =
- *((SkPoint*)((intptr_t)fan0Pos + 2 * vsize)) - vec[0] - vec[1];
- *((SkPoint*)((intptr_t)fan0Pos + 2 * vsize)) += vec[0] + vec[1];
+ *((SkPoint*)((intptr_t)fan1Pos + 2 * vstride)) =
+ *((SkPoint*)((intptr_t)fan0Pos + 2 * vstride)) - vec[0] - vec[1];
+ *((SkPoint*)((intptr_t)fan0Pos + 2 * vstride)) += vec[0] + vec[1];
// TR
- *((SkPoint*)((intptr_t)fan1Pos + 3 * vsize)) =
- *((SkPoint*)((intptr_t)fan0Pos + 3 * vsize)) - vec[0] + vec[1];
- *((SkPoint*)((intptr_t)fan0Pos + 3 * vsize)) += vec[0] - vec[1];
+ *((SkPoint*)((intptr_t)fan1Pos + 3 * vstride)) =
+ *((SkPoint*)((intptr_t)fan0Pos + 3 * vstride)) - vec[0] + vec[1];
+ *((SkPoint*)((intptr_t)fan0Pos + 3 * vstride)) += vec[0] - vec[1];
}
// Make verts point to vertex color and then set all the color and coverage vertex attrs values.
verts += sizeof(SkPoint);
for (int i = 0; i < 4; ++i) {
if (kUseCoverage_CoverageAttribType == covAttribType) {
- *reinterpret_cast<GrColor*>(verts + i * vsize) = color;
- *reinterpret_cast<GrColor*>(verts + i * vsize + sizeof(GrColor)) = 0;
+ *reinterpret_cast<GrColor*>(verts + i * vstride) = color;
+ *reinterpret_cast<GrColor*>(verts + i * vstride + sizeof(GrColor)) = 0;
} else {
- *reinterpret_cast<GrColor*>(verts + i * vsize) = 0;
+ *reinterpret_cast<GrColor*>(verts + i * vstride) = 0;
}
}
@@ -564,13 +564,13 @@ void GrAARectRenderer::geometryFillAARect(GrGpu* gpu,
} else {
innerCoverage = (0xff == scale) ? color : SkAlphaMulQ(color, scale);
}
- verts += 4 * vsize;
+ verts += 4 * vstride;
for (int i = 0; i < 4; ++i) {
if (kUseCoverage_CoverageAttribType == covAttribType) {
- *reinterpret_cast<GrColor*>(verts + i * vsize) = color;
- *reinterpret_cast<GrColor*>(verts + i * vsize + sizeof(GrColor)) = innerCoverage;
+ *reinterpret_cast<GrColor*>(verts + i * vstride) = color;
+ *reinterpret_cast<GrColor*>(verts + i * vstride + sizeof(GrColor)) = innerCoverage;
} else {
- *reinterpret_cast<GrColor*>(verts + i * vsize) = innerCoverage;
+ *reinterpret_cast<GrColor*>(verts + i * vstride) = innerCoverage;
}
}
@@ -634,8 +634,8 @@ void GrAARectRenderer::shaderFillAARect(GrGpu* gpu,
SkScalar newWidth = SkScalarHalf(rect.width() * vec[0].length()) + SK_ScalarHalf;
SkScalar newHeight = SkScalarHalf(rect.height() * vec[1].length()) + SK_ScalarHalf;
- drawState->setVertexAttribs<gAARectVertexAttribs>(SK_ARRAY_COUNT(gAARectVertexAttribs));
- SkASSERT(sizeof(RectVertex) == drawState->getVertexSize());
+ drawState->setVertexAttribs<gAARectVertexAttribs>(SK_ARRAY_COUNT(gAARectVertexAttribs),
+ sizeof(RectVertex));
GrDrawTarget::AutoReleaseGeometry geo(target, 4, 0);
if (!geo.succeeded()) {
@@ -684,8 +684,8 @@ void GrAARectRenderer::shaderFillAlignedAARect(GrGpu* gpu,
GrDrawState* drawState = target->drawState();
SkASSERT(combinedMatrix.rectStaysRect());
- drawState->setVertexAttribs<gAAAARectVertexAttribs>(SK_ARRAY_COUNT(gAAAARectVertexAttribs));
- SkASSERT(sizeof(AARectVertex) == drawState->getVertexSize());
+ drawState->setVertexAttribs<gAAAARectVertexAttribs>(SK_ARRAY_COUNT(gAAAARectVertexAttribs),
+ sizeof(AARectVertex));
GrDrawTarget::AutoReleaseGeometry geo(target, 4, 0);
if (!geo.succeeded()) {
@@ -834,15 +834,15 @@ void GrAARectRenderer::geometryStrokeAARect(GrGpu* gpu,
}
intptr_t verts = reinterpret_cast<intptr_t>(geo.vertices());
- size_t vsize = drawState->getVertexSize();
+ size_t vstride = drawState->getVertexStride();
// We create vertices for four nested rectangles. There are two ramps from 0 to full
// coverage, one on the exterior of the stroke and the other on the interior.
// The following pointers refer to the four rects, from outermost to innermost.
SkPoint* fan0Pos = reinterpret_cast<SkPoint*>(verts);
- SkPoint* fan1Pos = reinterpret_cast<SkPoint*>(verts + outerVertexNum * vsize);
- SkPoint* fan2Pos = reinterpret_cast<SkPoint*>(verts + 2 * outerVertexNum * vsize);
- SkPoint* fan3Pos = reinterpret_cast<SkPoint*>(verts + (2 * outerVertexNum + innerVertexNum) * vsize);
+ SkPoint* fan1Pos = reinterpret_cast<SkPoint*>(verts + outerVertexNum * vstride);
+ SkPoint* fan2Pos = reinterpret_cast<SkPoint*>(verts + 2 * outerVertexNum * vstride);
+ SkPoint* fan3Pos = reinterpret_cast<SkPoint*>(verts + (2 * outerVertexNum + innerVertexNum) * vstride);
#ifndef SK_IGNORE_THIN_STROKED_RECT_FIX
// TODO: this only really works if the X & Y margins are the same all around
@@ -862,25 +862,25 @@ void GrAARectRenderer::geometryStrokeAARect(GrGpu* gpu,
if (miterStroke) {
// outermost
- set_inset_fan(fan0Pos, vsize, devOutside, -SK_ScalarHalf, -SK_ScalarHalf);
+ set_inset_fan(fan0Pos, vstride, devOutside, -SK_ScalarHalf, -SK_ScalarHalf);
// inner two
- set_inset_fan(fan1Pos, vsize, devOutside, inset, inset);
- set_inset_fan(fan2Pos, vsize, devInside, -inset, -inset);
+ set_inset_fan(fan1Pos, vstride, devOutside, inset, inset);
+ set_inset_fan(fan2Pos, vstride, devInside, -inset, -inset);
// innermost
- set_inset_fan(fan3Pos, vsize, devInside, SK_ScalarHalf, SK_ScalarHalf);
+ set_inset_fan(fan3Pos, vstride, devInside, SK_ScalarHalf, SK_ScalarHalf);
} else {
- SkPoint* fan0AssistPos = reinterpret_cast<SkPoint*>(verts + 4 * vsize);
- SkPoint* fan1AssistPos = reinterpret_cast<SkPoint*>(verts + (outerVertexNum + 4) * vsize);
+ SkPoint* fan0AssistPos = reinterpret_cast<SkPoint*>(verts + 4 * vstride);
+ SkPoint* fan1AssistPos = reinterpret_cast<SkPoint*>(verts + (outerVertexNum + 4) * vstride);
// outermost
- set_inset_fan(fan0Pos, vsize, devOutside, -SK_ScalarHalf, -SK_ScalarHalf);
- set_inset_fan(fan0AssistPos, vsize, devOutsideAssist, -SK_ScalarHalf, -SK_ScalarHalf);
+ set_inset_fan(fan0Pos, vstride, devOutside, -SK_ScalarHalf, -SK_ScalarHalf);
+ set_inset_fan(fan0AssistPos, vstride, devOutsideAssist, -SK_ScalarHalf, -SK_ScalarHalf);
// outer one of the inner two
- set_inset_fan(fan1Pos, vsize, devOutside, inset, inset);
- set_inset_fan(fan1AssistPos, vsize, devOutsideAssist, inset, inset);
+ set_inset_fan(fan1Pos, vstride, devOutside, inset, inset);
+ set_inset_fan(fan1AssistPos, vstride, devOutsideAssist, inset, inset);
// inner one of the inner two
- set_inset_fan(fan2Pos, vsize, devInside, -inset, -inset);
+ set_inset_fan(fan2Pos, vstride, devInside, -inset, -inset);
// innermost
- set_inset_fan(fan3Pos, vsize, devInside, SK_ScalarHalf, SK_ScalarHalf);
+ set_inset_fan(fan3Pos, vstride, devInside, SK_ScalarHalf, SK_ScalarHalf);
}
// Make verts point to vertex color and then set all the color and coverage vertex attrs values.
@@ -888,10 +888,10 @@ void GrAARectRenderer::geometryStrokeAARect(GrGpu* gpu,
verts += sizeof(SkPoint);
for (int i = 0; i < outerVertexNum; ++i) {
if (kUseCoverage_CoverageAttribType == covAttribType) {
- *reinterpret_cast<GrColor*>(verts + i * vsize) = color;
- *reinterpret_cast<GrColor*>(verts + i * vsize + sizeof(GrColor)) = 0;
+ *reinterpret_cast<GrColor*>(verts + i * vstride) = color;
+ *reinterpret_cast<GrColor*>(verts + i * vstride + sizeof(GrColor)) = 0;
} else {
- *reinterpret_cast<GrColor*>(verts + i * vsize) = 0;
+ *reinterpret_cast<GrColor*>(verts + i * vstride) = 0;
}
}
@@ -904,7 +904,7 @@ void GrAARectRenderer::geometryStrokeAARect(GrGpu* gpu,
scale = 0xff;
}
- verts += outerVertexNum * vsize;
+ verts += outerVertexNum * vstride;
GrColor innerCoverage;
if (kUseCoverage_CoverageAttribType == covAttribType) {
innerCoverage = GrColorPackRGBA(scale, scale, scale, scale);
@@ -914,21 +914,21 @@ void GrAARectRenderer::geometryStrokeAARect(GrGpu* gpu,
for (int i = 0; i < outerVertexNum + innerVertexNum; ++i) {
if (kUseCoverage_CoverageAttribType == covAttribType) {
- *reinterpret_cast<GrColor*>(verts + i * vsize) = color;
- *reinterpret_cast<GrColor*>(verts + i * vsize + sizeof(GrColor)) = innerCoverage;
+ *reinterpret_cast<GrColor*>(verts + i * vstride) = color;
+ *reinterpret_cast<GrColor*>(verts + i * vstride + sizeof(GrColor)) = innerCoverage;
} else {
- *reinterpret_cast<GrColor*>(verts + i * vsize) = innerCoverage;
+ *reinterpret_cast<GrColor*>(verts + i * vstride) = innerCoverage;
}
}
// The innermost rect has 0 coverage
- verts += (outerVertexNum + innerVertexNum) * vsize;
+ verts += (outerVertexNum + innerVertexNum) * vstride;
for (int i = 0; i < innerVertexNum; ++i) {
if (kUseCoverage_CoverageAttribType == covAttribType) {
- *reinterpret_cast<GrColor*>(verts + i * vsize) = color;
- *reinterpret_cast<GrColor*>(verts + i * vsize + sizeof(GrColor)) = 0;
+ *reinterpret_cast<GrColor*>(verts + i * vstride) = color;
+ *reinterpret_cast<GrColor*>(verts + i * vstride + sizeof(GrColor)) = 0;
} else {
- *reinterpret_cast<GrColor*>(verts + i * vsize) = 0;
+ *reinterpret_cast<GrColor*>(verts + i * vstride) = 0;
}
}
diff --git a/src/gpu/GrBitmapTextContext.cpp b/src/gpu/GrBitmapTextContext.cpp
index c992b9527f..17439b5672 100755
--- a/src/gpu/GrBitmapTextContext.cpp
+++ b/src/gpu/GrBitmapTextContext.cpp
@@ -40,6 +40,8 @@ extern const GrVertexAttrib gTextVertexAttribs[] = {
{kVec2f_GrVertexAttribType, sizeof(SkPoint) , kEffect_GrVertexAttribBinding}
};
+static const size_t kTextVASize = 2 * sizeof(SkPoint);
+
// position + color + texture coord
extern const GrVertexAttrib gTextVertexWithColorAttribs[] = {
{kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding},
@@ -47,6 +49,8 @@ extern const GrVertexAttrib gTextVertexWithColorAttribs[] = {
{kVec2f_GrVertexAttribType, sizeof(SkPoint) + sizeof(GrColor), kEffect_GrVertexAttribBinding}
};
+static const size_t kTextVAColorSize = 2 * sizeof(SkPoint) + sizeof(GrColor);
+
};
GrBitmapTextContext::GrBitmapTextContext(GrContext* context,
@@ -176,10 +180,12 @@ void GrBitmapTextContext::allocateVertices(const char text[], size_t byteLength)
bool useColorVerts = kA8_GrMaskFormat == fStrike->getMaskFormat();
if (useColorVerts) {
fDrawTarget->drawState()->setVertexAttribs<gTextVertexWithColorAttribs>(
- SK_ARRAY_COUNT(gTextVertexWithColorAttribs));
+ SK_ARRAY_COUNT(gTextVertexWithColorAttribs),
+ kTextVAColorSize);
} else {
fDrawTarget->drawState()->setVertexAttribs<gTextVertexAttribs>(
- SK_ARRAY_COUNT(gTextVertexAttribs));
+ SK_ARRAY_COUNT(gTextVertexAttribs),
+ kTextVASize);
}
fVertexCount = 4*fSkPaint.textToGlyphs(text, byteLength, NULL);
bool success = fDrawTarget->reserveVertexAndIndexSpace(fVertexCount,
@@ -559,7 +565,7 @@ HAS_ATLAS:
size_t vertSize = useColorVerts ? (2 * sizeof(SkPoint) + sizeof(GrColor)) :
(2 * sizeof(SkPoint));
- SkASSERT(vertSize == fDrawTarget->getDrawState().getVertexSize());
+ SkASSERT(vertSize == fDrawTarget->getDrawState().getVertexStride());
SkPoint* positions = reinterpret_cast<SkPoint*>(
reinterpret_cast<intptr_t>(fVertices) + vertSize * fCurrVertex);
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 3b44b7e7c0..322ea87dcb 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);
diff --git a/src/gpu/GrDistanceFieldTextContext.cpp b/src/gpu/GrDistanceFieldTextContext.cpp
index 9cf53ce410..6c51d01421 100755
--- a/src/gpu/GrDistanceFieldTextContext.cpp
+++ b/src/gpu/GrDistanceFieldTextContext.cpp
@@ -44,6 +44,8 @@ extern const GrVertexAttrib gTextVertexAttribs[] = {
{kVec2f_GrVertexAttribType, sizeof(SkPoint) , kEffect_GrVertexAttribBinding}
};
+static const size_t kTextVASize = 2 * sizeof(SkPoint);
+
// position + color + texture coord
extern const GrVertexAttrib gTextVertexWithColorAttribs[] = {
{kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding},
@@ -51,6 +53,8 @@ extern const GrVertexAttrib gTextVertexWithColorAttribs[] = {
{kVec2f_GrVertexAttribType, sizeof(SkPoint) + sizeof(GrColor), kEffect_GrVertexAttribBinding}
};
+static const size_t kTextVAColorSize = 2 * sizeof(SkPoint) + sizeof(GrColor);
+
};
GrDistanceFieldTextContext::GrDistanceFieldTextContext(GrContext* context,
@@ -355,7 +359,7 @@ HAS_ATLAS:
size_t vertSize = fUseLCDText ? (2 * sizeof(SkPoint))
: (2 * sizeof(SkPoint) + sizeof(GrColor));
- SkASSERT(vertSize == fDrawTarget->getDrawState().getVertexSize());
+ SkASSERT(vertSize == fDrawTarget->getDrawState().getVertexStride());
SkPoint* positions = reinterpret_cast<SkPoint*>(
reinterpret_cast<intptr_t>(fVertices) + vertSize * fCurrVertex);
@@ -463,10 +467,12 @@ void GrDistanceFieldTextContext::allocateVertices(const char text[], size_t byte
SkASSERT(NULL == fVertices);
if (!fUseLCDText) {
fDrawTarget->drawState()->setVertexAttribs<gTextVertexWithColorAttribs>(
- SK_ARRAY_COUNT(gTextVertexWithColorAttribs));
+ SK_ARRAY_COUNT(gTextVertexWithColorAttribs),
+ kTextVAColorSize);
} else {
fDrawTarget->drawState()->setVertexAttribs<gTextVertexAttribs>(
- SK_ARRAY_COUNT(gTextVertexAttribs));
+ SK_ARRAY_COUNT(gTextVertexAttribs),
+ kTextVASize);
}
fVertexCount = 4*fSkPaint.textToGlyphs(text, byteLength, NULL);
bool success = fDrawTarget->reserveVertexAndIndexSpace(fVertexCount,
diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp
index a6b3d68238..0c2b1c3684 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -75,7 +75,7 @@ GrDrawState& GrDrawState::operator=(const GrDrawState& that) {
fFlagBits = that.fFlagBits;
fVACount = that.fVACount;
fVAPtr = that.fVAPtr;
- fVertexSize = that.fVertexSize;
+ fVAStride = that.fVAStride;
fStencilSettings = that.fStencilSettings;
fCoverage = that.fCoverage;
fDrawFace = that.fDrawFace;
@@ -178,35 +178,34 @@ void GrDrawState::setFromPaint(const GrPaint& paint, const SkMatrix& vm, GrRende
////////////////////////////////////////////////////////////////////////////////
-static size_t vertex_size(const GrVertexAttrib* attribs, int count) {
+static void validate_vertex_attribs(const GrVertexAttrib* attribs, int count, size_t stride) {
// this works as long as we're 4 byte-aligned
#ifdef SK_DEBUG
uint32_t overlapCheck = 0;
-#endif
SkASSERT(count <= GrRODrawState::kMaxVertexAttribCnt);
- size_t size = 0;
for (int index = 0; index < count; ++index) {
size_t attribSize = GrVertexAttribTypeSize(attribs[index].fType);
- size += attribSize;
-#ifdef SK_DEBUG
+ size_t attribOffset = attribs[index].fOffset;
+ SkASSERT(attribOffset + attribSize <= stride);
size_t dwordCount = attribSize >> 2;
uint32_t mask = (1 << dwordCount)-1;
- size_t offsetShift = attribs[index].fOffset >> 2;
+ size_t offsetShift = attribOffset >> 2;
SkASSERT(!(overlapCheck & (mask << offsetShift)));
overlapCheck |= (mask << offsetShift);
-#endif
}
- return size;
+#endif
}
////////////////////////////////////////////////////////////////////////////////
-void GrDrawState::setVertexAttribs(const GrVertexAttrib* attribs, int count) {
+void GrDrawState::internalSetVertexAttribs(const GrVertexAttrib* attribs, int count,
+ size_t stride) {
SkASSERT(count <= kMaxVertexAttribCnt);
fVAPtr = attribs;
fVACount = count;
- fVertexSize = vertex_size(fVAPtr, fVACount);
+ fVAStride = stride;
+ validate_vertex_attribs(fVAPtr, fVACount, fVAStride);
// Set all the indices to -1
memset(fFixedFunctionVertexAttribIndices,
@@ -244,7 +243,7 @@ void GrDrawState::setDefaultVertexAttribs() {
fVAPtr = &kPositionAttrib;
fVACount = 1;
- fVertexSize = GrVertexAttribTypeSize(kVec2f_GrVertexAttribType);
+ fVAStride = GrVertexAttribTypeSize(kVec2f_GrVertexAttribType);
// set all the fixed function indices to -1 except position.
memset(fFixedFunctionVertexAttribIndices,
@@ -279,6 +278,7 @@ GrDrawState::AutoVertexAttribRestore::AutoVertexAttribRestore(
fDrawState = drawState;
fVAPtr = drawState->fVAPtr;
fVACount = drawState->fVACount;
+ fVAStride = drawState->fVAStride;
fDrawState->setDefaultVertexAttribs();
}
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index dcd6ff9aaf..ec0ccade37 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -79,9 +79,12 @@ public:
/**
* Sets vertex attributes for next draw. The object driving the templatization
* should be a global GrVertexAttrib array that is never changed.
+ *
+ * @param count the number of attributes being set, limited to kMaxVertexAttribCnt.
+ * @param stride the number of bytes between successive vertex data.
*/
- template <const GrVertexAttrib A[]> void setVertexAttribs(int count) {
- this->setVertexAttribs(A, count);
+ template <const GrVertexAttrib A[]> void setVertexAttribs(int count, size_t stride) {
+ this->internalSetVertexAttribs(A, count, stride);
}
/**
@@ -97,12 +100,13 @@ public:
public:
AutoVertexAttribRestore(GrDrawState* drawState);
- ~AutoVertexAttribRestore() { fDrawState->setVertexAttribs(fVAPtr, fVACount); }
+ ~AutoVertexAttribRestore() { fDrawState->internalSetVertexAttribs(fVAPtr, fVACount, fVAStride); }
private:
GrDrawState* fDrawState;
const GrVertexAttrib* fVAPtr;
int fVACount;
+ size_t fVAStride;
};
/// @}
@@ -559,13 +563,7 @@ private:
// This is used to assert that this condition holds.
SkDEBUGCODE(int fBlockEffectRemovalCnt;)
- /**
- * Sets vertex attributes for next draw.
- *
- * @param attribs the array of vertex attributes to set.
- * @param count the number of attributes being set, limited to kMaxVertexAttribCnt.
- */
- void setVertexAttribs(const GrVertexAttrib attribs[], int count);
+ void internalSetVertexAttribs(const GrVertexAttrib attribs[], int count, size_t stride);
typedef GrRODrawState INHERITED;
};
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 2d27859c3e..9605781d34 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -195,10 +195,10 @@ bool GrDrawTarget::reserveVertexAndIndexSpace(int vertexCount,
int indexCount,
void** vertices,
void** indices) {
- size_t vertexSize = this->drawState()->getVertexSize();
+ size_t vertexStride = this->drawState()->getVertexStride();
this->willReserveVertexAndIndexSpace(vertexCount, indexCount);
if (vertexCount) {
- if (!this->reserveVertexSpace(vertexSize, vertexCount, vertices)) {
+ if (!this->reserveVertexSpace(vertexStride, vertexCount, vertices)) {
if (indexCount) {
this->resetIndexSource();
}
@@ -278,7 +278,7 @@ void GrDrawTarget::setVertexSourceToArray(const void* vertexArray,
this->releasePreviousVertexSource();
GeometrySrcState& geoSrc = fGeoSrcStateStack.back();
geoSrc.fVertexSrc = kArray_GeometrySrcType;
- geoSrc.fVertexSize = this->drawState()->getVertexSize();
+ geoSrc.fVertexSize = this->drawState()->getVertexStride();
geoSrc.fVertexCount = vertexCount;
this->onSetVertexSourceToArray(vertexArray, vertexCount);
}
@@ -298,7 +298,7 @@ void GrDrawTarget::setVertexSourceToBuffer(const GrVertexBuffer* buffer) {
geoSrc.fVertexSrc = kBuffer_GeometrySrcType;
geoSrc.fVertexBuffer = buffer;
buffer->ref();
- geoSrc.fVertexSize = this->drawState()->getVertexSize();
+ geoSrc.fVertexSize = this->drawState()->getVertexStride();
}
void GrDrawTarget::setIndexSourceToBuffer(const GrIndexBuffer* buffer) {
@@ -673,9 +673,9 @@ extern const GrVertexAttrib gBWRectPosUVAttribs[] = {
void set_vertex_attributes(GrDrawState* drawState, bool hasUVs) {
if (hasUVs) {
- drawState->setVertexAttribs<gBWRectPosUVAttribs>(2);
+ drawState->setVertexAttribs<gBWRectPosUVAttribs>(2, 2 * sizeof(SkPoint));
} else {
- drawState->setVertexAttribs<gBWRectPosUVAttribs>(1);
+ drawState->setVertexAttribs<gBWRectPosUVAttribs>(1, sizeof(SkPoint));
}
}
@@ -693,16 +693,16 @@ void GrDrawTarget::onDrawRect(const SkRect& rect,
return;
}
- size_t vsize = this->drawState()->getVertexSize();
- geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, vsize);
+ size_t vstride = this->drawState()->getVertexStride();
+ geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, vstride);
if (NULL != localRect) {
SkPoint* coords = GrTCast<SkPoint*>(GrTCast<intptr_t>(geo.vertices()) +
sizeof(SkPoint));
coords->setRectFan(localRect->fLeft, localRect->fTop,
localRect->fRight, localRect->fBottom,
- vsize);
+ vstride);
if (NULL != localMatrix) {
- localMatrix->mapPointsWithStride(coords, vsize, 4);
+ localMatrix->mapPointsWithStride(coords, vstride, 4);
}
}
SkRect bounds;
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 9df54a8076..4fd6b4e331 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -97,9 +97,9 @@ extern const GrVertexAttrib kRectAttribs[] = {
*/
static void set_vertex_attributes(GrDrawState* drawState, bool hasLocalCoords, GrColor color) {
if (hasLocalCoords) {
- drawState->setVertexAttribs<kRectAttribs>(3);
+ drawState->setVertexAttribs<kRectAttribs>(3, 2 * sizeof(SkPoint) + sizeof(SkColor));
} else {
- drawState->setVertexAttribs<kRectAttribs>(2);
+ drawState->setVertexAttribs<kRectAttribs>(2, sizeof(SkPoint) + sizeof(SkColor));
}
if (0xFF == GrColorUnpackA(color)) {
drawState->setHint(GrDrawState::kVertexColorsAreOpaque_Hint, true);
@@ -143,24 +143,24 @@ void GrInOrderDrawBuffer::onDrawRect(const SkRect& rect,
return;
}
- size_t vsize = drawState->getVertexSize();
+ size_t vstride = drawState->getVertexStride();
- geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, vsize);
- matrix.mapPointsWithStride(geo.positions(), vsize, 4);
+ geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, vstride);
+ matrix.mapPointsWithStride(geo.positions(), vstride, 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(), vsize, 4, &devBounds);
+ get_vertex_bounds(geo.vertices(), vstride, 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,
- vsize);
+ vstride);
if (NULL != localMatrix) {
- localMatrix->mapPointsWithStride(coords, vsize, 4);
+ localMatrix->mapPointsWithStride(coords, vstride, 4);
}
}
@@ -168,7 +168,7 @@ void GrInOrderDrawBuffer::onDrawRect(const SkRect& rect,
GrColor* vertColor = GrTCast<GrColor*>(GrTCast<intptr_t>(geo.vertices()) + kColorOffset);
for (int i = 0; i < 4; ++i) {
*vertColor = color;
- vertColor = (GrColor*) ((intptr_t) vertColor + vsize);
+ vertColor = (GrColor*) ((intptr_t) vertColor + vstride);
}
this->setIndexSourceToBuffer(this->getContext()->getQuadIndexBuffer());
@@ -266,7 +266,7 @@ int GrInOrderDrawBuffer::concatInstancedDraw(const DrawInfo& info) {
// update the amount of reserved vertex data actually referenced in draws
size_t vertexBytes = instancesToConcat * info.verticesPerInstance() *
- drawState.getVertexSize();
+ drawState.getVertexStride();
poolState.fUsedPoolVertexBytes = SkTMax(poolState.fUsedPoolVertexBytes, vertexBytes);
draw->adjustInstanceCount(instancesToConcat);
@@ -339,7 +339,7 @@ void GrInOrderDrawBuffer::onDraw(const DrawInfo& info) {
case kReserved_GeometrySrcType: // fallthrough
case kArray_GeometrySrcType: {
size_t vertexBytes = (info.vertexCount() + info.startVertex()) *
- drawState.getVertexSize();
+ drawState.getVertexStride();
poolState.fUsedPoolVertexBytes = SkTMax(poolState.fUsedPoolVertexBytes, vertexBytes);
draw->fVertexBuffer = poolState.fPoolVertexBuffer;
draw->adjustStartVertex(poolState.fPoolStartVertex);
@@ -726,11 +726,11 @@ bool GrInOrderDrawBuffer::geometryHints(int* vertexCount,
*indexCount = currIndices;
}
if (NULL != vertexCount) {
- size_t vertexSize = this->getDrawState().getVertexSize();
- int32_t currVertices = fVertexPool.currentBufferVertices(vertexSize);
+ size_t vertexStride = this->getDrawState().getVertexStride();
+ int32_t currVertices = fVertexPool.currentBufferVertices(vertexStride);
if (*vertexCount > currVertices &&
(!fVertexPool.preallocatedBuffersRemaining() &&
- *vertexCount <= fVertexPool.preallocatedBufferVertices(vertexSize))) {
+ *vertexCount <= fVertexPool.preallocatedBufferVertices(vertexStride))) {
flush = true;
}
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index dcce889559..f368dc8d89 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -519,8 +519,8 @@ void GrOvalRenderer::drawCircle(GrDrawTarget* target,
return;
}
- drawState->setVertexAttribs<gCircleVertexAttribs>(SK_ARRAY_COUNT(gCircleVertexAttribs));
- SkASSERT(sizeof(CircleVertex) == drawState->getVertexSize());
+ drawState->setVertexAttribs<gCircleVertexAttribs>(SK_ARRAY_COUNT(gCircleVertexAttribs),
+ sizeof(CircleVertex));
GrDrawTarget::AutoReleaseGeometry geo(target, 4, 0);
if (!geo.succeeded()) {
@@ -680,8 +680,8 @@ bool GrOvalRenderer::drawEllipse(GrDrawTarget* target,
return false;
}
- drawState->setVertexAttribs<gEllipseVertexAttribs>(SK_ARRAY_COUNT(gEllipseVertexAttribs));
- SkASSERT(sizeof(EllipseVertex) == drawState->getVertexSize());
+ drawState->setVertexAttribs<gEllipseVertexAttribs>(SK_ARRAY_COUNT(gEllipseVertexAttribs),
+ sizeof(EllipseVertex));
GrDrawTarget::AutoReleaseGeometry geo(target, 4, 0);
if (!geo.succeeded()) {
@@ -799,8 +799,8 @@ bool GrOvalRenderer::drawDIEllipse(GrDrawTarget* target,
SkScalar innerRatioX = SkScalarDiv(xRadius, innerXRadius);
SkScalar innerRatioY = SkScalarDiv(yRadius, innerYRadius);
- drawState->setVertexAttribs<gDIEllipseVertexAttribs>(SK_ARRAY_COUNT(gDIEllipseVertexAttribs));
- SkASSERT(sizeof(DIEllipseVertex) == drawState->getVertexSize());
+ drawState->setVertexAttribs<gDIEllipseVertexAttribs>(SK_ARRAY_COUNT(gDIEllipseVertexAttribs),
+ sizeof(DIEllipseVertex));
GrDrawTarget::AutoReleaseGeometry geo(target, 4, 0);
if (!geo.succeeded()) {
@@ -1032,8 +1032,8 @@ bool GrOvalRenderer::drawRRect(GrDrawTarget* target, GrContext* context, bool us
// if the corners are circles, use the circle renderer
if ((!hasStroke || scaledStroke.fX == scaledStroke.fY) && xRadius == yRadius) {
- drawState->setVertexAttribs<gCircleVertexAttribs>(SK_ARRAY_COUNT(gCircleVertexAttribs));
- SkASSERT(sizeof(CircleVertex) == drawState->getVertexSize());
+ drawState->setVertexAttribs<gCircleVertexAttribs>(SK_ARRAY_COUNT(gCircleVertexAttribs),
+ sizeof(CircleVertex));
GrDrawTarget::AutoReleaseGeometry geo(target, 16, 0);
if (!geo.succeeded()) {
@@ -1121,8 +1121,8 @@ bool GrOvalRenderer::drawRRect(GrDrawTarget* target, GrContext* context, bool us
// otherwise we use the ellipse renderer
} else {
- drawState->setVertexAttribs<gEllipseVertexAttribs>(SK_ARRAY_COUNT(gEllipseVertexAttribs));
- SkASSERT(sizeof(EllipseVertex) == drawState->getVertexSize());
+ drawState->setVertexAttribs<gEllipseVertexAttribs>(SK_ARRAY_COUNT(gEllipseVertexAttribs),
+ sizeof(EllipseVertex));
SkScalar innerXRadius = 0.0f;
SkScalar innerYRadius = 0.0f;
diff --git a/src/gpu/GrRODrawState.cpp b/src/gpu/GrRODrawState.cpp
index 1460f57320..9118d0dc8d 100644
--- a/src/gpu/GrRODrawState.cpp
+++ b/src/gpu/GrRODrawState.cpp
@@ -25,6 +25,7 @@ bool GrRODrawState::isEqual(const GrRODrawState& that) const {
this->fBlendConstant != that.fBlendConstant ||
this->fFlagBits != that.fFlagBits ||
this->fVACount != that.fVACount ||
+ this->fVAStride != that.fVAStride ||
memcmp(this->fVAPtr, that.fVAPtr, this->fVACount * sizeof(GrVertexAttrib)) ||
this->fStencilSettings != that.fStencilSettings ||
this->fDrawFace != that.fDrawFace) {
@@ -50,7 +51,6 @@ bool GrRODrawState::isEqual(const GrRODrawState& that) const {
}
}
- SkASSERT(this->fVertexSize == that.fVertexSize);
SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices,
that.fFixedFunctionVertexAttribIndices,
sizeof(this->fFixedFunctionVertexAttribIndices)));
diff --git a/src/gpu/GrRODrawState.h b/src/gpu/GrRODrawState.h
index 231560854f..0abd4a6aa5 100644
--- a/src/gpu/GrRODrawState.h
+++ b/src/gpu/GrRODrawState.h
@@ -37,7 +37,7 @@ public:
const GrVertexAttrib* getVertexAttribs() const { return fVAPtr; }
int getVertexAttribCount() const { return fVACount; }
- size_t getVertexSize() const { return fVertexSize; }
+ size_t getVertexStride() const { return fVAStride; }
/**
* Getters for index into getVertexAttribs() for particular bindings. -1 is returned if the
@@ -340,8 +340,6 @@ public:
kB_CombinedState,
};
- GrRODrawState& operator= (const GrRODrawState& that);
-
protected:
bool isEqual(const GrRODrawState& that) const;
@@ -353,7 +351,7 @@ protected:
uint32_t fFlagBits;
const GrVertexAttrib* fVAPtr;
int fVACount;
- size_t fVertexSize;
+ size_t fVAStride;
GrStencilSettings fStencilSettings;
uint8_t fCoverage;
DrawFace fDrawFace;
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index 4b2bafefdb..adee4aec96 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -350,7 +350,8 @@ bool GrDashingEffect::DrawDashLine(const SkPoint pts[2], const GrPaint& paint,
}
// Set up the vertex data for the line and start/end dashes
- drawState->setVertexAttribs<gDashLineVertexAttribs>(SK_ARRAY_COUNT(gDashLineVertexAttribs));
+ drawState->setVertexAttribs<gDashLineVertexAttribs>(SK_ARRAY_COUNT(gDashLineVertexAttribs),
+ sizeof(DashLineVertex));
int totalRectCnt = 0;
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
index b19676adb9..beef93e96b 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -284,7 +284,7 @@ bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstC
void GrGpuGL::setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes) {
- GrGLsizei stride = static_cast<GrGLsizei>(this->getDrawState().getVertexSize());
+ GrGLsizei stride = static_cast<GrGLsizei>(this->getDrawState().getVertexStride());
size_t vertexOffsetInBytes = stride * info.startVertex();