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

Side by Side Diff: gm/imagefiltersclipped.cpp

Issue 1556553002: Implement an SkPaint-based image filter (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: More randomness for paths and for rasterizer's paint Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | gm/imagefiltersscaled.cpp » ('j') | samplecode/SampleFilterFuzz.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "sk_tool_utils.h" 8 #include "sk_tool_utils.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkColor.h" 10 #include "SkColor.h"
11 #include "SkDisplacementMapEffect.h" 11 #include "SkDisplacementMapEffect.h"
12 #include "SkDropShadowImageFilter.h" 12 #include "SkDropShadowImageFilter.h"
13 #include "SkGradientShader.h" 13 #include "SkGradientShader.h"
14 #include "SkImage.h" 14 #include "SkImage.h"
15 #include "SkImageSource.h" 15 #include "SkImageSource.h"
16 #include "SkLightingImageFilter.h" 16 #include "SkLightingImageFilter.h"
17 #include "SkMorphologyImageFilter.h" 17 #include "SkMorphologyImageFilter.h"
18 #include "SkOffsetImageFilter.h" 18 #include "SkOffsetImageFilter.h"
19 #include "SkPaintImageFilter.h"
19 #include "SkPerlinNoiseShader.h" 20 #include "SkPerlinNoiseShader.h"
20 #include "SkPoint3.h" 21 #include "SkPoint3.h"
21 #include "SkRectShaderImageFilter.h"
22 #include "SkScalar.h" 22 #include "SkScalar.h"
23 #include "SkSurface.h" 23 #include "SkSurface.h"
24 #include "gm.h" 24 #include "gm.h"
25 25
26 #define RESIZE_FACTOR_X SkIntToScalar(2) 26 #define RESIZE_FACTOR_X SkIntToScalar(2)
27 #define RESIZE_FACTOR_Y SkIntToScalar(5) 27 #define RESIZE_FACTOR_Y SkIntToScalar(5)
28 28
29 namespace skiagm { 29 namespace skiagm {
30 30
31 class ImageFiltersClippedGM : public GM { 31 class ImageFiltersClippedGM : public GM {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 132 }
133 canvas->restore(); 133 canvas->restore();
134 canvas->translate(0, r.height() + margin); 134 canvas->translate(0, r.height() + margin);
135 } 135 }
136 canvas->restore(); 136 canvas->restore();
137 137
138 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { 138 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) {
139 SkSafeUnref(filters[i]); 139 SkSafeUnref(filters[i]);
140 } 140 }
141 141
142 SkAutoTUnref<SkImageFilter> rectFilter(SkRectShaderImageFilter::Create(n oise)); 142 SkPaint noisePaint;
143 noisePaint.setShader(noise);
144 SkAutoTUnref<SkImageFilter> rectFilter(SkPaintImageFilter::Create(noiseP aint));
143 canvas->translate(SK_ARRAY_COUNT(filters)*(r.width() + margin), 0); 145 canvas->translate(SK_ARRAY_COUNT(filters)*(r.width() + margin), 0);
144 for (int xOffset = 0; xOffset < 80; xOffset += 16) { 146 for (int xOffset = 0; xOffset < 80; xOffset += 16) {
145 bounds.fLeft = SkIntToScalar(xOffset); 147 bounds.fLeft = SkIntToScalar(xOffset);
146 draw_clipped_filter(canvas, rectFilter, 0, r, bounds); 148 draw_clipped_filter(canvas, rectFilter, 0, r, bounds);
147 canvas->translate(0, r.height() + margin); 149 canvas->translate(0, r.height() + margin);
148 } 150 }
149 } 151 }
150 152
151 private: 153 private:
152 SkAutoTUnref<SkImage> fCheckerboard, fGradientCircle; 154 SkAutoTUnref<SkImage> fCheckerboard, fGradientCircle;
153 155
154 typedef GM INHERITED; 156 typedef GM INHERITED;
155 }; 157 };
156 158
157 ////////////////////////////////////////////////////////////////////////////// 159 //////////////////////////////////////////////////////////////////////////////
158 160
159 DEF_GM(return new ImageFiltersClippedGM;) 161 DEF_GM(return new ImageFiltersClippedGM;)
160 } 162 }
OLDNEW
« no previous file with comments | « no previous file | gm/imagefiltersscaled.cpp » ('j') | samplecode/SampleFilterFuzz.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698