From: bsalomon Date: Wed, 4 Mar 2015 19:03:52 +0000 (-0800) Subject: simplify logic in SkPerliNoiseShader for GPU when constant color X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~3330 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ea8b55db889b19786008b7c613d238e7202485e5;p=platform%2Fupstream%2FlibSkiaSharp.git simplify logic in SkPerliNoiseShader for GPU when constant color BUG=skia:3488 Review URL: https://codereview.chromium.org/974183002 --- diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp index 6e53253..3c1bf2f 100644 --- a/src/effects/SkPerlinNoiseShader.cpp +++ b/src/effects/SkPerlinNoiseShader.cpp @@ -961,16 +961,12 @@ bool SkPerlinNoiseShader::asFragmentProcessor(GrContext* context, const SkPaint& matrix.preConcat(localMatrix); if (0 == fNumOctaves) { - SkColor clearColor = 0; if (kFractalNoise_Type == fType) { - clearColor = SkColorSetARGB(paint.getAlpha() / 2, 127, 127, 127); - } - SkAutoTUnref cf(SkColorFilter::CreateModeFilter( - clearColor, SkXfermode::kSrc_Mode)); - SkTDArray array; - if (cf->asFragmentProcessors(context, &array)) { - SkASSERT(1 == array.count()); // modecolorfilter only returns one - *fp = array[0]; // transfer ownership to fp + uint32_t alpha = paint.getAlpha() >> 1; + uint32_t rgb = alpha >> 1; + *paintColor = GrColorPackRGBA(rgb, rgb, rgb, alpha); + } else { + *paintColor = 0; } return true; }