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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 void onDraw(SkCanvas* canvas) override { | 62 void onDraw(SkCanvas* canvas) override { |
63 if (!fInitialized) { | 63 if (!fInitialized) { |
64 fCheckerboard.allocN32Pixels(64, 64); | 64 fCheckerboard.allocN32Pixels(64, 64); |
65 SkCanvas checkerboardCanvas(fCheckerboard); | 65 SkCanvas checkerboardCanvas(fCheckerboard); |
66 sk_tool_utils::draw_checkerboard(&checkerboardCanvas, 0xFFA0A0A0, 0x
FF404040, 8); | 66 sk_tool_utils::draw_checkerboard(&checkerboardCanvas, 0xFFA0A0A0, 0x
FF404040, 8); |
67 | 67 |
68 this->make_gradient_circle(64, 64); | 68 this->make_gradient_circle(64, 64); |
69 fInitialized = true; | 69 fInitialized = true; |
70 } | 70 } |
71 canvas->clear(0x00000000); | 71 canvas->clear(SK_ColorBLACK); |
72 | 72 |
73 SkAutoTUnref<SkImageFilter> gradient(SkBitmapSource::Create(fGradientCir
cle)); | 73 SkAutoTUnref<SkImageFilter> gradient(SkBitmapSource::Create(fGradientCir
cle)); |
74 SkAutoTUnref<SkImageFilter> checkerboard(SkBitmapSource::Create(fChecker
board)); | 74 SkAutoTUnref<SkImageFilter> checkerboard(SkBitmapSource::Create(fChecker
board)); |
75 SkAutoTUnref<SkShader> noise(SkPerlinNoiseShader::CreateFractalNoise( | 75 SkAutoTUnref<SkShader> noise(SkPerlinNoiseShader::CreateFractalNoise( |
76 SkDoubleToScalar(0.1), SkDoubleToScalar(0.05), 1, 0)); | 76 SkDoubleToScalar(0.1), SkDoubleToScalar(0.05), 1, 0)); |
77 SkMatrix resizeMatrix; | 77 SkMatrix resizeMatrix; |
78 resizeMatrix.setScale(RESIZE_FACTOR_X, RESIZE_FACTOR_Y); | 78 resizeMatrix.setScale(RESIZE_FACTOR_X, RESIZE_FACTOR_Y); |
79 | 79 |
80 SkImageFilter* filters[] = { | 80 SkImageFilter* filters[] = { |
81 SkBlurImageFilter::Create(SkIntToScalar(12), SkIntToScalar(12)), | 81 SkBlurImageFilter::Create(SkIntToScalar(12), SkIntToScalar(12)), |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 SkBitmap fGradientCircle; | 135 SkBitmap fGradientCircle; |
136 typedef GM INHERITED; | 136 typedef GM INHERITED; |
137 }; | 137 }; |
138 | 138 |
139 ////////////////////////////////////////////////////////////////////////////// | 139 ////////////////////////////////////////////////////////////////////////////// |
140 | 140 |
141 static GM* MyFactory(void*) { return new ImageFiltersClippedGM; } | 141 static GM* MyFactory(void*) { return new ImageFiltersClippedGM; } |
142 static GMRegistry reg(MyFactory); | 142 static GMRegistry reg(MyFactory); |
143 | 143 |
144 } | 144 } |
OLD | NEW |