Index: src/gpu/GrAAHairLinePathRenderer.cpp |
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp |
index 37150bd9a592317cffba51c34199a8900d326f95..b8c44c72d57cd53ff3e6a8c6ab61175cb71dc3c8 100644 |
--- a/src/gpu/GrAAHairLinePathRenderer.cpp |
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp |
@@ -644,6 +644,7 @@ void add_line(const SkPoint p[2], |
bool GrAAHairLinePathRenderer::createLineGeom(GrDrawTarget* target, |
GrDrawState* drawState, |
uint8_t coverage, |
+ size_t vertexStride, |
GrDrawTarget::AutoReleaseGeometry* arg, |
SkRect* devBounds, |
const SkPath& path, |
@@ -653,9 +654,8 @@ bool GrAAHairLinePathRenderer::createLineGeom(GrDrawTarget* target, |
int vertCnt = kLineSegNumVertices * lineCnt; |
- size_t vstride = drawState->getGeometryProcessor()->getVertexStride(); |
- SkASSERT(vstride == sizeof(LineVertex)); |
- if (!arg->set(target, vertCnt, vstride, 0)) { |
+ SkASSERT(vertexStride == sizeof(LineVertex)); |
+ if (!arg->set(target, vertCnt, vertexStride, 0)) { |
return false; |
} |
@@ -839,13 +839,15 @@ bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target, |
uint32_t gpFlags = GrDefaultGeoProcFactory::kPosition_GPType | |
GrDefaultGeoProcFactory::kCoverage_GPType; |
GrDrawState::AutoRestoreEffects are(drawState); |
- drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create(color, |
- gpFlags, |
- newCoverage))->unref(); |
+ SkAutoTUnref<const GrGeometryProcessor> gp(GrDefaultGeoProcFactory::Create(color, |
+ gpFlags, |
+ false, |
+ newCoverage)); |
if (!this->createLineGeom(target, |
drawState, |
newCoverage, |
+ gp->getVertexStride(), |
&arg, |
&devBounds, |
path, |
@@ -871,6 +873,7 @@ bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target, |
while (lines < lineCnt) { |
int n = SkTMin(lineCnt - lines, kLineSegsNumInIdxBuffer); |
target->drawIndexed(drawState, |
+ gp, |
kTriangles_GrPrimitiveType, |
kLineSegNumVertices*lines, // startV |
0, // startI |
@@ -915,20 +918,20 @@ bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target, |
kQuadNumVertices * quadCnt + kQuadNumVertices * conicCnt)); |
if (quadCnt > 0) { |
- GrGeometryProcessor* hairQuadProcessor = |
+ SkAutoTUnref<GrGeometryProcessor> hairQuadProcessor( |
GrQuadEffect::Create(color, |
kHairlineAA_GrProcessorEdgeType, |
*target->caps(), |
- newCoverage); |
+ newCoverage)); |
SkASSERT(hairQuadProcessor); |
GrDrawState::AutoRestoreEffects are(drawState); |
target->setIndexSourceToBuffer(fQuadsIndexBuffer); |
- drawState->setGeometryProcessor(hairQuadProcessor)->unref(); |
int quads = 0; |
while (quads < quadCnt) { |
int n = SkTMin(quadCnt - quads, kQuadsNumInIdxBuffer); |
target->drawIndexed(drawState, |
+ hairQuadProcessor, |
kTriangles_GrPrimitiveType, |
kQuadNumVertices*quads, // startV |
0, // startI |
@@ -941,15 +944,16 @@ bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target, |
if (conicCnt > 0) { |
GrDrawState::AutoRestoreEffects are(drawState); |
- GrGeometryProcessor* hairConicProcessor = GrConicEffect::Create( |
- color, kHairlineAA_GrProcessorEdgeType, *target->caps(), newCoverage); |
+ SkAutoTUnref<GrGeometryProcessor> hairConicProcessor( |
+ GrConicEffect::Create(color, kHairlineAA_GrProcessorEdgeType, *target->caps(), |
+ newCoverage)); |
SkASSERT(hairConicProcessor); |
- drawState->setGeometryProcessor(hairConicProcessor)->unref(); |
int conics = 0; |
while (conics < conicCnt) { |
int n = SkTMin(conicCnt - conics, kQuadsNumInIdxBuffer); |
target->drawIndexed(drawState, |
+ hairConicProcessor, |
kTriangles_GrPrimitiveType, |
kQuadNumVertices*(quadCnt + conics), // startV |
0, // startI |