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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 SkScalar x = SkIntToScalar(width / 2); | 45 SkScalar x = SkIntToScalar(width / 2); |
46 SkScalar y = SkIntToScalar(height / 2); | 46 SkScalar y = SkIntToScalar(height / 2); |
47 SkScalar radius = SkScalarMul(SkMinScalar(x, y), SkIntToScalar(4) / SkIn
tToScalar(5)); | 47 SkScalar radius = SkScalarMul(SkMinScalar(x, y), SkIntToScalar(4) / SkIn
tToScalar(5)); |
48 fGradientCircle.allocN32Pixels(width, height); | 48 fGradientCircle.allocN32Pixels(width, height); |
49 SkCanvas canvas(fGradientCircle); | 49 SkCanvas canvas(fGradientCircle); |
50 canvas.clear(0x00000000); | 50 canvas.clear(0x00000000); |
51 SkColor colors[2]; | 51 SkColor colors[2]; |
52 colors[0] = SK_ColorWHITE; | 52 colors[0] = SK_ColorWHITE; |
53 colors[1] = SK_ColorBLACK; | 53 colors[1] = SK_ColorBLACK; |
54 SkAutoTUnref<SkShader> shader( | 54 SkAutoTUnref<SkShader> shader( |
55 SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors,
NULL, 2, | 55 SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors,
nullptr, 2, |
56 SkShader::kClamp_TileMode) | 56 SkShader::kClamp_TileMode) |
57 ); | 57 ); |
58 SkPaint paint; | 58 SkPaint paint; |
59 paint.setShader(shader); | 59 paint.setShader(shader); |
60 canvas.drawCircle(x, y, radius, paint); | 60 canvas.drawCircle(x, y, radius, paint); |
61 } | 61 } |
62 | 62 |
63 virtual void onDraw(SkCanvas* canvas) { | 63 virtual void onDraw(SkCanvas* canvas) { |
64 if (!fInitialized) { | 64 if (!fInitialized) { |
65 fCheckerboard.allocN32Pixels(64, 64); | 65 fCheckerboard.allocN32Pixels(64, 64); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 SkBitmap fGradientCircle; | 157 SkBitmap fGradientCircle; |
158 typedef GM INHERITED; | 158 typedef GM INHERITED; |
159 }; | 159 }; |
160 | 160 |
161 ////////////////////////////////////////////////////////////////////////////// | 161 ////////////////////////////////////////////////////////////////////////////// |
162 | 162 |
163 static GM* MyFactory(void*) { return new ImageFiltersScaledGM; } | 163 static GM* MyFactory(void*) { return new ImageFiltersScaledGM; } |
164 static GMRegistry reg(MyFactory); | 164 static GMRegistry reg(MyFactory); |
165 | 165 |
166 } | 166 } |
OLD | NEW |