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 virtual void onDraw(SkCanvas* canvas) { | 62 virtual void onDraw(SkCanvas* canvas) { |
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 | 77 |
78 SkPoint3 pointLocation(0, 0, SkIntToScalar(10)); | 78 SkPoint3 pointLocation(0, 0, SkIntToScalar(10)); |
79 SkPoint3 spotLocation(SkIntToScalar(-10), SkIntToScalar(-10), SkIntToSca
lar(20)); | 79 SkPoint3 spotLocation(SkIntToScalar(-10), SkIntToScalar(-10), SkIntToSca
lar(20)); |
80 SkPoint3 spotTarget(SkIntToScalar(40), SkIntToScalar(40), 0); | 80 SkPoint3 spotTarget(SkIntToScalar(40), SkIntToScalar(40), 0); |
81 SkScalar spotExponent = SK_Scalar1; | 81 SkScalar spotExponent = SK_Scalar1; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 SkBitmap fGradientCircle; | 154 SkBitmap fGradientCircle; |
155 typedef GM INHERITED; | 155 typedef GM INHERITED; |
156 }; | 156 }; |
157 | 157 |
158 ////////////////////////////////////////////////////////////////////////////// | 158 ////////////////////////////////////////////////////////////////////////////// |
159 | 159 |
160 static GM* MyFactory(void*) { return new ImageFiltersScaledGM; } | 160 static GM* MyFactory(void*) { return new ImageFiltersScaledGM; } |
161 static GMRegistry reg(MyFactory); | 161 static GMRegistry reg(MyFactory); |
162 | 162 |
163 } | 163 } |
OLD | NEW |