Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1649)

Unified Diff: src/effects/SkPerlinNoiseShader.cpp

Issue 974183002: simplify logic in SkPerliNoiseShader for GPU when constant color (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use >> Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkPerlinNoiseShader.cpp
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 6e53253f292a5d55fb5911e3142ffd411c23a2be..3c1bf2fd0342e44ab3ecb74532d49b7efd198c9c 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<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;
+ uint32_t rgb = alpha >> 1;
+ *paintColor = GrColorPackRGBA(rgb, rgb, rgb, alpha);
+ } else {
+ *paintColor = 0;
}
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698