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 "SkBlurImageFilter.h" | 9 #include "SkBlurImageFilter.h" |
10 #include "SkColor.h" | 10 #include "SkColor.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 fCheckerboard = SkImage::MakeFromBitmap | 83 fCheckerboard = SkImage::MakeFromBitmap |
84 (sk_tool_utils::create_checkerboard_bitmap(64, 64, 0xFFA0A0A0, 0xFF4
04040, 8)); | 84 (sk_tool_utils::create_checkerboard_bitmap(64, 64, 0xFFA0A0A0, 0xFF4
04040, 8)); |
85 this->makeGradientCircle(64, 64); | 85 this->makeGradientCircle(64, 64); |
86 } | 86 } |
87 | 87 |
88 void onDraw(SkCanvas* canvas) override { | 88 void onDraw(SkCanvas* canvas) override { |
89 canvas->clear(SK_ColorBLACK); | 89 canvas->clear(SK_ColorBLACK); |
90 | 90 |
91 SkAutoTUnref<SkImageFilter> gradient(SkImageSource::Create(fGradientCirc
le.get())); | 91 SkAutoTUnref<SkImageFilter> gradient(SkImageSource::Create(fGradientCirc
le.get())); |
92 SkAutoTUnref<SkImageFilter> checkerboard(SkImageSource::Create(fCheckerb
oard.get())); | 92 SkAutoTUnref<SkImageFilter> checkerboard(SkImageSource::Create(fCheckerb
oard.get())); |
93 SkAutoTUnref<SkShader> noise(SkPerlinNoiseShader::CreateFractalNoise( | 93 sk_sp<SkShader> noise(SkPerlinNoiseShader::MakeFractalNoise( |
94 SkDoubleToScalar(0.1), SkDoubleToScalar(0.05), 1, 0)); | 94 SkDoubleToScalar(0.1), SkDoubleToScalar(0.05), 1, 0)); |
95 SkMatrix resizeMatrix; | 95 SkMatrix resizeMatrix; |
96 resizeMatrix.setScale(RESIZE_FACTOR_X, RESIZE_FACTOR_Y); | 96 resizeMatrix.setScale(RESIZE_FACTOR_X, RESIZE_FACTOR_Y); |
97 SkPoint3 pointLocation = SkPoint3::Make(32, 32, SkIntToScalar(10)); | 97 SkPoint3 pointLocation = SkPoint3::Make(32, 32, SkIntToScalar(10)); |
98 | 98 |
99 SkImageFilter* filters[] = { | 99 SkImageFilter* filters[] = { |
100 SkBlurImageFilter::Create(SkIntToScalar(12), SkIntToScalar(12)), | 100 SkBlurImageFilter::Create(SkIntToScalar(12), SkIntToScalar(12)), |
101 SkDropShadowImageFilter::Create(SkIntToScalar(10), SkIntToScalar(10)
, | 101 SkDropShadowImageFilter::Create(SkIntToScalar(10), SkIntToScalar(10)
, |
102 SkIntToScalar(3), SkIntToScalar(3), SK_ColorGREEN, | 102 SkIntToScalar(3), SkIntToScalar(3), SK_ColorGREEN, |
103 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode), | 103 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode), |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 private: | 150 private: |
151 sk_sp<SkImage> fCheckerboard, fGradientCircle; | 151 sk_sp<SkImage> fCheckerboard, fGradientCircle; |
152 | 152 |
153 typedef GM INHERITED; | 153 typedef GM INHERITED; |
154 }; | 154 }; |
155 | 155 |
156 ////////////////////////////////////////////////////////////////////////////// | 156 ////////////////////////////////////////////////////////////////////////////// |
157 | 157 |
158 DEF_GM(return new ImageFiltersClippedGM;) | 158 DEF_GM(return new ImageFiltersClippedGM;) |
159 } | 159 } |
OLD | NEW |