From 39202f12d37b6ef69ffaddcaa8cc92c621fcda41 Mon Sep 17 00:00:00 2001 From: bsalomon Date: Mon, 4 May 2015 10:36:53 -0700 Subject: Don't attempt to draw path if dashing or stroking fails TBR=egdaniel@google.com Review URL: https://codereview.chromium.org/1119393002 --- src/gpu/GrContext.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'src/gpu/GrContext.cpp') diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 819774a076..b2a1f5b633 100755 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -1325,13 +1325,14 @@ void GrContext::internalDrawPath(GrDrawTarget* target, GrStrokeInfo dashlessStrokeInfo(strokeInfo, false); if (NULL == pr && strokeInfo.isDashed()) { // It didn't work above, so try again with dashed stroke converted to a dashless stroke. - if (strokeInfo.applyDash(tmpPath.init(), &dashlessStrokeInfo, *pathPtr)) { - pathPtr = tmpPath.get(); - if (pathPtr->isEmpty()) { - return; - } - strokeInfoPtr = &dashlessStrokeInfo; + if (!strokeInfo.applyDash(tmpPath.init(), &dashlessStrokeInfo, *pathPtr)) { + return; + } + pathPtr = tmpPath.get(); + if (pathPtr->isEmpty()) { + return; } + strokeInfoPtr = &dashlessStrokeInfo; pr = this->getPathRenderer(target, pipelineBuilder, viewMatrix, *pathPtr, *strokeInfoPtr, false, type); } @@ -1344,14 +1345,15 @@ void GrContext::internalDrawPath(GrDrawTarget* target, } SkStrokeRec* strokeRec = dashlessStrokeInfo.getStrokeRecPtr(); strokeRec->setResScale(SkScalarAbs(viewMatrix.getMaxScale())); - if (strokeRec->applyToPath(tmpPath.get(), *pathPtr)) { - pathPtr = tmpPath.get(); - if (pathPtr->isEmpty()) { - return; - } - strokeRec->setFillStyle(); - strokeInfoPtr = &dashlessStrokeInfo; + if (!strokeRec->applyToPath(tmpPath.get(), *pathPtr)) { + return; + } + pathPtr = tmpPath.get(); + if (pathPtr->isEmpty()) { + return; } + strokeRec->setFillStyle(); + strokeInfoPtr = &dashlessStrokeInfo; } // This time, allow SW renderer -- cgit v1.2.3