Index: src/effects/SkPerlinNoiseShader.cpp |
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp |
index 6e53253f292a5d55fb5911e3142ffd411c23a2be..e40dc8e1be72e1bd04a4c4e3f9f2f74b29c0dcde 100644 |
--- a/src/effects/SkPerlinNoiseShader.cpp |
+++ b/src/effects/SkPerlinNoiseShader.cpp |
@@ -961,16 +961,16 @@ 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<SkColorFilter> cf(SkColorFilter::CreateModeFilter( |
- clearColor, SkXfermode::kSrc_Mode)); |
- SkTDArray<GrFragmentProcessor*> 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; |
+#if 1 |
+ uint32_t rgb = SkMulDiv255Round(alpha, 127); |
+#else |
+ uint32_t rgb = alpha >> 1; |
bsalomon
2015/03/04 04:57:23
Can I get away with this?
sugoi1
2015/03/04 15:53:53
I don't see why not, this should be fine.
|
+#endif |
+ *paintColor = GrColorPackRGBA(rgb, rgb, rgb, alpha); |
+ } else { |
+ *paintColor = 0; |
} |
return true; |
} |