OLD | NEW |
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" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 canvas->translate(0, r.height() + margin); | 131 canvas->translate(0, r.height() + margin); |
132 } | 132 } |
133 canvas->restore(); | 133 canvas->restore(); |
134 | 134 |
135 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { | 135 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { |
136 SkSafeUnref(filters[i]); | 136 SkSafeUnref(filters[i]); |
137 } | 137 } |
138 | 138 |
139 SkPaint noisePaint; | 139 SkPaint noisePaint; |
140 noisePaint.setShader(noise); | 140 noisePaint.setShader(noise); |
141 sk_sp<SkImageFilter> rectFilter(SkPaintImageFilter::Make(noisePaint)); | 141 SkAutoTUnref<SkImageFilter> rectFilter(SkPaintImageFilter::Create(noiseP
aint)); |
142 canvas->translate(SK_ARRAY_COUNT(filters)*(r.width() + margin), 0); | 142 canvas->translate(SK_ARRAY_COUNT(filters)*(r.width() + margin), 0); |
143 for (int xOffset = 0; xOffset < 80; xOffset += 16) { | 143 for (int xOffset = 0; xOffset < 80; xOffset += 16) { |
144 bounds.fLeft = SkIntToScalar(xOffset); | 144 bounds.fLeft = SkIntToScalar(xOffset); |
145 draw_clipped_filter(canvas, rectFilter.get(), 0, r, bounds); | 145 draw_clipped_filter(canvas, rectFilter, 0, r, bounds); |
146 canvas->translate(0, r.height() + margin); | 146 canvas->translate(0, r.height() + margin); |
147 } | 147 } |
148 } | 148 } |
149 | 149 |
150 private: | 150 private: |
151 sk_sp<SkImage> fCheckerboard, fGradientCircle; | 151 sk_sp<SkImage> fCheckerboard, fGradientCircle; |
152 | 152 |
153 typedef GM INHERITED; | 153 typedef GM INHERITED; |
154 }; | 154 }; |
155 | 155 |
156 ////////////////////////////////////////////////////////////////////////////// | 156 ////////////////////////////////////////////////////////////////////////////// |
157 | 157 |
158 DEF_GM(return new ImageFiltersClippedGM;) | 158 DEF_GM(return new ImageFiltersClippedGM;) |
159 } | 159 } |
OLD | NEW |