Perlin issue fixed
BUG=skia:1799
R=sugoi@chromium.org, sugoi@google.com, senorblanco@chromium.org
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/59173005
git-svn-id: http://skia.googlecode.com/svn/trunk@12150 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index af51afc..f2ce679 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -7,6 +7,7 @@
#include "SkDither.h"
#include "SkPerlinNoiseShader.h"
+#include "SkColorFilter.h"
#include "SkFlattenableBuffers.h"
#include "SkShader.h"
#include "SkUnPreMultiply.h"
@@ -1295,6 +1296,16 @@
GrEffectRef* SkPerlinNoiseShader::asNewEffect(GrContext* context, const SkPaint& paint) const {
SkASSERT(NULL != context);
+ 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));
+ return cf->asNewEffect(context);
+ }
+
// Either we don't stitch tiles, either we have a valid tile size
SkASSERT(!fStitchTiles || !fTileSize.isEmpty());