OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 27 matching lines...) Expand all Loading... |
38 SkScalar x = SkIntToScalar(width / 2); | 38 SkScalar x = SkIntToScalar(width / 2); |
39 SkScalar y = SkIntToScalar(height / 2); | 39 SkScalar y = SkIntToScalar(height / 2); |
40 SkScalar radius = SkMinScalar(x, y) * 0.8f; | 40 SkScalar radius = SkMinScalar(x, y) * 0.8f; |
41 fGradientCircle.allocN32Pixels(width, height); | 41 fGradientCircle.allocN32Pixels(width, height); |
42 SkCanvas canvas(fGradientCircle); | 42 SkCanvas canvas(fGradientCircle); |
43 canvas.clear(0x00000000); | 43 canvas.clear(0x00000000); |
44 SkColor colors[2]; | 44 SkColor colors[2]; |
45 colors[0] = SK_ColorWHITE; | 45 colors[0] = SK_ColorWHITE; |
46 colors[1] = SK_ColorBLACK; | 46 colors[1] = SK_ColorBLACK; |
47 SkAutoTUnref<SkShader> shader( | 47 SkAutoTUnref<SkShader> shader( |
48 SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors,
NULL, 2, | 48 SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors,
nullptr, 2, |
49 SkShader::kClamp_TileMode) | 49 SkShader::kClamp_TileMode) |
50 ); | 50 ); |
51 SkPaint paint; | 51 SkPaint paint; |
52 paint.setShader(shader); | 52 paint.setShader(shader); |
53 canvas.drawCircle(x, y, radius, paint); | 53 canvas.drawCircle(x, y, radius, paint); |
54 } | 54 } |
55 | 55 |
56 void onOnceBeforeDraw() override { | 56 void onOnceBeforeDraw() override { |
57 fCheckerboard.allocN32Pixels(64, 64); | 57 fCheckerboard.allocN32Pixels(64, 64); |
58 SkCanvas checkerboardCanvas(fCheckerboard); | 58 SkCanvas checkerboardCanvas(fCheckerboard); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 SkBitmap fCheckerboard; | 115 SkBitmap fCheckerboard; |
116 SkBitmap fGradientCircle; | 116 SkBitmap fGradientCircle; |
117 typedef GM INHERITED; | 117 typedef GM INHERITED; |
118 }; | 118 }; |
119 | 119 |
120 ////////////////////////////////////////////////////////////////////////////// | 120 ////////////////////////////////////////////////////////////////////////////// |
121 | 121 |
122 DEF_GM( return new ImageFiltersTransformedGM; ) | 122 DEF_GM( return new ImageFiltersTransformedGM; ) |
123 | 123 |
124 } | 124 } |
OLD | NEW |