Index: src/gpu/GrAAHairLinePathRenderer.cpp |
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp |
index 98e69657b344b1a543377f65fe1116fca26b12e9..319228e146a4f42a408298acebce968f5bea788b 100644 |
--- a/src/gpu/GrAAHairLinePathRenderer.cpp |
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp |
@@ -832,18 +832,30 @@ bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target, |
lineCnt = lines.count() / 2; |
conicCnt = conics.count() / 3; |
+ // createGeom transforms the geometry to device space when the matrix does not have |
+ // perspective. |
+ GrDrawState::AutoViewMatrixRestore avmr; |
+ SkMatrix invert = SkMatrix::I(); |
+ if (!drawState->getViewMatrix().hasPerspective()) { |
+ avmr.setIdentity(drawState); |
+ if (!drawState->getViewMatrix().invert(&invert)) { |
+ return false; |
+ } |
+ } |
+ |
// do lines first |
if (lineCnt) { |
GrDrawTarget::AutoReleaseGeometry arg; |
SkRect devBounds; |
+ GrDrawState::AutoRestoreEffects are(drawState); |
uint32_t gpFlags = GrDefaultGeoProcFactory::kPosition_GPType | |
GrDefaultGeoProcFactory::kCoverage_GPType; |
- GrDrawState::AutoRestoreEffects are(drawState); |
SkAutoTUnref<const GrGeometryProcessor> gp(GrDefaultGeoProcFactory::Create(color, |
gpFlags, |
false, |
- newCoverage)); |
+ newCoverage, |
+ invert)); |
if (!this->createLineGeom(target, |
drawState, |
@@ -857,13 +869,6 @@ bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target, |
return false; |
} |
- // createLineGeom transforms the geometry to device space when the matrix does not have |
- // perspective. |
- GrDrawState::AutoViewMatrixRestore avmr; |
- if (!drawState->getViewMatrix().hasPerspective() && !avmr.setIdentity(drawState)) { |
- return false; |
- } |
- |
// Check devBounds |
SkASSERT(check_bounds<LineVertex>(drawState, devBounds, arg.vertices(), |
kLineSegNumVertices * lineCnt)); |
@@ -906,14 +911,6 @@ bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target, |
return false; |
} |
- // createGeom transforms the geometry to device space when the matrix does not have |
- // perspective. |
- GrDrawState::AutoViewMatrixRestore avmr; |
- if (!drawState->getViewMatrix().hasPerspective() && !avmr.setIdentity(drawState)) { |
- return false; |
- } |
- |
- |
// Check devBounds |
SkASSERT(check_bounds<BezierVertex>(drawState, devBounds, arg.vertices(), |
kQuadNumVertices * quadCnt + kQuadNumVertices * conicCnt)); |
@@ -923,6 +920,7 @@ bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target, |
GrQuadEffect::Create(color, |
kHairlineAA_GrProcessorEdgeType, |
*target->caps(), |
+ invert, |
newCoverage)); |
SkASSERT(hairQuadProcessor); |
GrDrawState::AutoRestoreEffects are(drawState); |
@@ -946,7 +944,7 @@ bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target, |
if (conicCnt > 0) { |
SkAutoTUnref<GrGeometryProcessor> hairConicProcessor( |
GrConicEffect::Create(color, kHairlineAA_GrProcessorEdgeType, *target->caps(), |
- newCoverage)); |
+ invert, newCoverage)); |
SkASSERT(hairConicProcessor); |
GrDrawState::AutoRestoreEffects are(drawState); |
target->setIndexSourceToBuffer(fQuadsIndexBuffer); |