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 "SkBitmapSource.h" | 9 #include "SkBitmapSource.h" |
10 #include "SkBlurImageFilter.h" | 10 #include "SkBlurImageFilter.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 SkScalar x = SkIntToScalar(width / 2); | 46 SkScalar x = SkIntToScalar(width / 2); |
47 SkScalar y = SkIntToScalar(height / 2); | 47 SkScalar y = SkIntToScalar(height / 2); |
48 SkScalar radius = SkMinScalar(x, y) * 0.8f; | 48 SkScalar radius = SkMinScalar(x, y) * 0.8f; |
49 fGradientCircle.allocN32Pixels(width, height); | 49 fGradientCircle.allocN32Pixels(width, height); |
50 SkCanvas canvas(fGradientCircle); | 50 SkCanvas canvas(fGradientCircle); |
51 canvas.clear(0x00000000); | 51 canvas.clear(0x00000000); |
52 SkColor colors[2]; | 52 SkColor colors[2]; |
53 colors[0] = SK_ColorWHITE; | 53 colors[0] = SK_ColorWHITE; |
54 colors[1] = SK_ColorBLACK; | 54 colors[1] = SK_ColorBLACK; |
55 SkAutoTUnref<SkShader> shader( | 55 SkAutoTUnref<SkShader> shader( |
56 SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors,
NULL, 2, | 56 SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors,
nullptr, 2, |
57 SkShader::kClamp_TileMode) | 57 SkShader::kClamp_TileMode) |
58 ); | 58 ); |
59 SkPaint paint; | 59 SkPaint paint; |
60 paint.setShader(shader); | 60 paint.setShader(shader); |
61 canvas.drawCircle(x, y, radius, paint); | 61 canvas.drawCircle(x, y, radius, paint); |
62 } | 62 } |
63 | 63 |
64 static void draw_clipped_filter(SkCanvas* canvas, SkImageFilter* filter, siz
e_t i, | 64 static void draw_clipped_filter(SkCanvas* canvas, SkImageFilter* filter, siz
e_t i, |
65 const SkRect& primBounds, const SkRect& clip
Bounds) { | 65 const SkRect& primBounds, const SkRect& clip
Bounds) { |
66 SkPaint paint; | 66 SkPaint paint; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 SkBitmap fGradientCircle; | 155 SkBitmap fGradientCircle; |
156 typedef GM INHERITED; | 156 typedef GM INHERITED; |
157 }; | 157 }; |
158 | 158 |
159 ////////////////////////////////////////////////////////////////////////////// | 159 ////////////////////////////////////////////////////////////////////////////// |
160 | 160 |
161 static GM* MyFactory(void*) { return new ImageFiltersClippedGM; } | 161 static GM* MyFactory(void*) { return new ImageFiltersClippedGM; } |
162 static GMRegistry reg(MyFactory); | 162 static GMRegistry reg(MyFactory); |
163 | 163 |
164 } | 164 } |
OLD | NEW |