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" |
11 #include "SkColor.h" | 11 #include "SkColor.h" |
12 #include "SkDisplacementMapEffect.h" | 12 #include "SkDisplacementMapEffect.h" |
13 #include "SkDropShadowImageFilter.h" | 13 #include "SkDropShadowImageFilter.h" |
14 #include "SkGradientShader.h" | 14 #include "SkGradientShader.h" |
15 #include "SkLightingImageFilter.h" | 15 #include "SkLightingImageFilter.h" |
16 #include "SkMorphologyImageFilter.h" | 16 #include "SkMorphologyImageFilter.h" |
17 #include "SkOffsetImageFilter.h" | 17 #include "SkOffsetImageFilter.h" |
18 #include "SkPerlinNoiseShader.h" | 18 #include "SkPerlinNoiseShader.h" |
| 19 #include "SkPoint3.h" |
19 #include "SkRectShaderImageFilter.h" | 20 #include "SkRectShaderImageFilter.h" |
20 #include "SkScalar.h" | 21 #include "SkScalar.h" |
21 #include "gm.h" | 22 #include "gm.h" |
22 | 23 |
23 #define RESIZE_FACTOR SkIntToScalar(4) | 24 #define RESIZE_FACTOR SkIntToScalar(4) |
24 | 25 |
25 namespace skiagm { | 26 namespace skiagm { |
26 | 27 |
27 class ImageFiltersScaledGM : public GM { | 28 class ImageFiltersScaledGM : public GM { |
28 public: | 29 public: |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 this->make_gradient_circle(64, 64); | 69 this->make_gradient_circle(64, 64); |
69 fInitialized = true; | 70 fInitialized = true; |
70 } | 71 } |
71 canvas->clear(SK_ColorBLACK); | 72 canvas->clear(SK_ColorBLACK); |
72 | 73 |
73 SkAutoTUnref<SkImageFilter> gradient(SkBitmapSource::Create(fGradientCir
cle)); | 74 SkAutoTUnref<SkImageFilter> gradient(SkBitmapSource::Create(fGradientCir
cle)); |
74 SkAutoTUnref<SkImageFilter> checkerboard(SkBitmapSource::Create(fChecker
board)); | 75 SkAutoTUnref<SkImageFilter> checkerboard(SkBitmapSource::Create(fChecker
board)); |
75 SkAutoTUnref<SkShader> noise(SkPerlinNoiseShader::CreateFractalNoise( | 76 SkAutoTUnref<SkShader> noise(SkPerlinNoiseShader::CreateFractalNoise( |
76 SkDoubleToScalar(0.1), SkDoubleToScalar(0.05), 1, 0)); | 77 SkDoubleToScalar(0.1), SkDoubleToScalar(0.05), 1, 0)); |
77 | 78 |
78 SkPoint3 pointLocation(0, 0, SkIntToScalar(10)); | 79 SkPoint3 pointLocation = SkPoint3::Make(0, 0, SkIntToScalar(10)); |
79 SkPoint3 spotLocation(SkIntToScalar(-10), SkIntToScalar(-10), SkIntToSca
lar(20)); | 80 SkPoint3 spotLocation = SkPoint3::Make(SkIntToScalar(-10), |
80 SkPoint3 spotTarget(SkIntToScalar(40), SkIntToScalar(40), 0); | 81 SkIntToScalar(-10), |
| 82 SkIntToScalar(20)); |
| 83 SkPoint3 spotTarget = SkPoint3::Make(SkIntToScalar(40), SkIntToScalar(40
), 0); |
81 SkScalar spotExponent = SK_Scalar1; | 84 SkScalar spotExponent = SK_Scalar1; |
82 SkScalar cutoffAngle = SkIntToScalar(15); | 85 SkScalar cutoffAngle = SkIntToScalar(15); |
83 SkScalar kd = SkIntToScalar(2); | 86 SkScalar kd = SkIntToScalar(2); |
84 SkScalar surfaceScale = SkIntToScalar(1); | 87 SkScalar surfaceScale = SkIntToScalar(1); |
85 SkColor white(0xFFFFFFFF); | 88 SkColor white(0xFFFFFFFF); |
86 SkMatrix resizeMatrix; | 89 SkMatrix resizeMatrix; |
87 resizeMatrix.setScale(RESIZE_FACTOR, RESIZE_FACTOR); | 90 resizeMatrix.setScale(RESIZE_FACTOR, RESIZE_FACTOR); |
88 | 91 |
89 SkImageFilter* filters[] = { | 92 SkImageFilter* filters[] = { |
90 SkBlurImageFilter::Create(SkIntToScalar(4), SkIntToScalar(4)), | 93 SkBlurImageFilter::Create(SkIntToScalar(4), SkIntToScalar(4)), |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 SkBitmap fGradientCircle; | 156 SkBitmap fGradientCircle; |
154 typedef GM INHERITED; | 157 typedef GM INHERITED; |
155 }; | 158 }; |
156 | 159 |
157 ////////////////////////////////////////////////////////////////////////////// | 160 ////////////////////////////////////////////////////////////////////////////// |
158 | 161 |
159 static GM* MyFactory(void*) { return new ImageFiltersScaledGM; } | 162 static GM* MyFactory(void*) { return new ImageFiltersScaledGM; } |
160 static GMRegistry reg(MyFactory); | 163 static GMRegistry reg(MyFactory); |
161 | 164 |
162 } | 165 } |
OLD | NEW |