aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/imagefiltersscaled.cpp
diff options
context:
space:
mode:
authorGravatar ajuma <ajuma@chromium.org>2016-01-08 14:58:35 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-08 14:58:35 -0800
commit77b6ba3b6e23b84a3a4f3a62812e4a9eb6de4c23 (patch)
treee567bf7da5cadf68009bbd21d2e65fb01895663a /gm/imagefiltersscaled.cpp
parentc146aa6fd45dffe29b4f565aafd4ec3a16d9f73b (diff)
Implement an SkPaint-based image filter
This implements SkPaintImageFilter, and is intended to replace SkRectShaderImageFilter. By allowing a paint and not just a shader as input, this allows consumers to control dithering. BUG=skia:4780 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1556553002 Review URL: https://codereview.chromium.org/1556553002
Diffstat (limited to 'gm/imagefiltersscaled.cpp')
-rw-r--r--gm/imagefiltersscaled.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/gm/imagefiltersscaled.cpp b/gm/imagefiltersscaled.cpp
index 3221c88cae..7576ee1375 100644
--- a/gm/imagefiltersscaled.cpp
+++ b/gm/imagefiltersscaled.cpp
@@ -16,9 +16,9 @@
#include "SkLightingImageFilter.h"
#include "SkMorphologyImageFilter.h"
#include "SkOffsetImageFilter.h"
+#include "SkPaintImageFilter.h"
#include "SkPerlinNoiseShader.h"
#include "SkPoint3.h"
-#include "SkRectShaderImageFilter.h"
#include "SkScalar.h"
#include "SkSurface.h"
#include "gm.h"
@@ -56,6 +56,8 @@ protected:
SkAutoTUnref<SkImageFilter> checkerboard(SkImageSource::Create(fCheckerboard));
SkAutoTUnref<SkShader> noise(SkPerlinNoiseShader::CreateFractalNoise(
SkDoubleToScalar(0.1), SkDoubleToScalar(0.05), 1, 0));
+ SkPaint noisePaint;
+ noisePaint.setShader(noise);
SkPoint3 pointLocation = SkPoint3::Make(0, 0, SkIntToScalar(10));
SkPoint3 spotLocation = SkPoint3::Make(SkIntToScalar(-10),
@@ -84,7 +86,7 @@ protected:
SkErodeImageFilter::Create(1, 1, checkerboard.get()),
SkOffsetImageFilter::Create(SkIntToScalar(32), 0),
SkImageFilter::CreateMatrixFilter(resizeMatrix, kNone_SkFilterQuality),
- SkRectShaderImageFilter::Create(noise),
+ SkPaintImageFilter::Create(noisePaint),
SkLightingImageFilter::CreatePointLitDiffuse(pointLocation, white, surfaceScale, kd),
SkLightingImageFilter::CreateSpotLitDiffuse(spotLocation, spotTarget, spotExponent,
cutoffAngle, white, surfaceScale, kd),