OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "gm.h" | 8 #include "gm.h" |
9 | 9 |
10 #include "Resources.h" | 10 #include "Resources.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 SkShader::kClamp_TileMode); | 27 SkShader::kClamp_TileMode); |
28 } | 28 } |
29 | 29 |
30 static SkImageFilter* make_grayscale(SkImageFilter* input = nullptr) { | 30 static SkImageFilter* make_grayscale(SkImageFilter* input = nullptr) { |
31 SkScalar matrix[20]; | 31 SkScalar matrix[20]; |
32 memset(matrix, 0, 20 * sizeof(SkScalar)); | 32 memset(matrix, 0, 20 * sizeof(SkScalar)); |
33 matrix[0] = matrix[5] = matrix[10] = 0.2126f; | 33 matrix[0] = matrix[5] = matrix[10] = 0.2126f; |
34 matrix[1] = matrix[6] = matrix[11] = 0.7152f; | 34 matrix[1] = matrix[6] = matrix[11] = 0.7152f; |
35 matrix[2] = matrix[7] = matrix[12] = 0.0722f; | 35 matrix[2] = matrix[7] = matrix[12] = 0.0722f; |
36 matrix[18] = 1.0f; | 36 matrix[18] = 1.0f; |
37 auto filter(SkColorFilter::MakeMatrixFilterRowMajor255(matrix)); | 37 SkAutoTUnref<SkColorFilter> filter(SkColorMatrixFilter::Create(matrix)); |
38 return SkColorFilterImageFilter::Create(filter.get(), input); | 38 return SkColorFilterImageFilter::Create(filter, input); |
39 } | 39 } |
40 | 40 |
41 static SkImageFilter* make_blur(float amount, SkImageFilter* input = nullptr) { | 41 static SkImageFilter* make_blur(float amount, SkImageFilter* input = nullptr) { |
42 return SkBlurImageFilter::Create(amount, amount, input); | 42 return SkBlurImageFilter::Create(amount, amount, input); |
43 } | 43 } |
44 | 44 |
45 namespace skiagm { | 45 namespace skiagm { |
46 | 46 |
47 class ColorEmojiGM : public GM { | 47 class ColorEmojiGM : public GM { |
48 public: | 48 public: |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 typedef GM INHERITED; | 158 typedef GM INHERITED; |
159 }; | 159 }; |
160 | 160 |
161 ////////////////////////////////////////////////////////////////////////////// | 161 ////////////////////////////////////////////////////////////////////////////// |
162 | 162 |
163 static GM* MyFactory(void*) { return new ColorEmojiGM; } | 163 static GM* MyFactory(void*) { return new ColorEmojiGM; } |
164 static GMRegistry reg(MyFactory); | 164 static GMRegistry reg(MyFactory); |
165 | 165 |
166 } | 166 } |
OLD | NEW |