Only assert that conic/quad effects get created if they are to be used.

R=jvanverth@google.com

Author: bsalomon@google.com

Review URL: https://chromiumcodereview.appspot.com/22891023

git-svn-id: http://skia.googlecode.com/svn/trunk@10900 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2013-08-23 21:01:52 +00:00
parent 726e621000
commit 884624764c

View File

@ -956,21 +956,18 @@ bool GrAAHairLinePathRenderer::onDrawPath(const SkPath& path,
static const int kEdgeAttrIndex = 1;
GrEffectRef* hairQuadEffect = GrQuadEffect::Create(kHairAA_GrBezierEdgeType,
*target->caps());
GrEffectRef* hairConicEffect = GrConicEffect::Create(kHairAA_GrBezierEdgeType,
*target->caps());
SkASSERT(hairQuadEffect && hairConicEffect);
// Check devBounds
SkASSERT(check_bounds<BezierVertex>(drawState, devBounds, arg.vertices(),
kVertsPerQuad * quadCnt + kVertsPerQuad * conicCnt));
{
if (quadCnt > 0) {
GrEffectRef* hairQuadEffect = GrQuadEffect::Create(kHairAA_GrBezierEdgeType,
*target->caps());
SkASSERT(NULL != hairQuadEffect);
GrDrawState::AutoRestoreEffects are(drawState);
target->setIndexSourceToBuffer(fQuadsIndexBuffer);
int quads = 0;
drawState->addCoverageEffect(hairQuadEffect, kEdgeAttrIndex)->unref();
int quads = 0;
while (quads < quadCnt) {
int n = GrMin(quadCnt - quads, kNumQuadsInIdxBuffer);
target->drawIndexed(kTriangles_GrPrimitiveType,
@ -983,10 +980,13 @@ bool GrAAHairLinePathRenderer::onDrawPath(const SkPath& path,
}
}
{
if (conicCnt > 0) {
GrDrawState::AutoRestoreEffects are(drawState);
int conics = 0;
GrEffectRef* hairConicEffect = GrConicEffect::Create(kHairAA_GrBezierEdgeType,
*target->caps());
SkASSERT(NULL != hairConicEffect);
drawState->addCoverageEffect(hairConicEffect, 1, 2)->unref();
int conics = 0;
while (conics < conicCnt) {
int n = GrMin(conicCnt - conics, kNumQuadsInIdxBuffer);
target->drawIndexed(kTriangles_GrPrimitiveType,