OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
11 #include "SkColorPriv.h" | 11 #include "SkColorPriv.h" |
12 #include "SkShader.h" | 12 #include "SkShader.h" |
13 | 13 |
14 #include "SkBlurImageFilter.h" | 14 #include "SkBlurImageFilter.h" |
15 #include "SkColorFilterImageFilter.h" | 15 #include "SkColorFilterImageFilter.h" |
16 #include "SkDropShadowImageFilter.h" | 16 #include "SkDropShadowImageFilter.h" |
17 #include "SkSpecialImage.h" | 17 #include "SkSpecialImage.h" |
18 #include "SkTestImageFilters.h" | 18 #include "SkTestImageFilters.h" |
19 | 19 |
20 class FailImageFilter : public SkImageFilter { | 20 class FailImageFilter : public SkImageFilter { |
21 public: | 21 public: |
22 class Registrar { | 22 class Registrar { |
23 public: | 23 public: |
24 Registrar() { | 24 Registrar() { |
25 SkFlattenable::Register("FailImageFilter", | 25 SkFlattenable::Register("FailImageFilter", |
26 FailImageFilter::CreateProc, | 26 FailImageFilter::CreateProc); |
27 FailImageFilter::GetFlattenableType()); | |
28 } | 27 } |
29 }; | 28 }; |
30 static sk_sp<SkImageFilter> Make() { | 29 static sk_sp<SkImageFilter> Make() { |
31 return sk_sp<SkImageFilter>(new FailImageFilter); | 30 return sk_sp<SkImageFilter>(new FailImageFilter); |
32 } | 31 } |
33 | 32 |
34 SK_TO_STRING_OVERRIDE() | 33 SK_TO_STRING_OVERRIDE() |
35 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter) | 34 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter) |
36 | 35 |
37 protected: | 36 protected: |
(...skipping 21 matching lines...) Expand all Loading... |
59 str->append(")"); | 58 str->append(")"); |
60 } | 59 } |
61 #endif | 60 #endif |
62 | 61 |
63 class IdentityImageFilter : public SkImageFilter { | 62 class IdentityImageFilter : public SkImageFilter { |
64 public: | 63 public: |
65 class Registrar { | 64 class Registrar { |
66 public: | 65 public: |
67 Registrar() { | 66 Registrar() { |
68 SkFlattenable::Register("IdentityImageFilter", | 67 SkFlattenable::Register("IdentityImageFilter", |
69 IdentityImageFilter::CreateProc, | 68 IdentityImageFilter::CreateProc); |
70 IdentityImageFilter::GetFlattenableType()); | |
71 } | 69 } |
72 }; | 70 }; |
73 static sk_sp<SkImageFilter> Make(sk_sp<SkImageFilter> input) { | 71 static sk_sp<SkImageFilter> Make(sk_sp<SkImageFilter> input) { |
74 return sk_sp<SkImageFilter>(new IdentityImageFilter(std::move(input))); | 72 return sk_sp<SkImageFilter>(new IdentityImageFilter(std::move(input))); |
75 } | 73 } |
76 | 74 |
77 SK_TO_STRING_OVERRIDE() | 75 SK_TO_STRING_OVERRIDE() |
78 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter) | 76 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter) |
79 | 77 |
80 protected: | 78 protected: |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 | 316 |
319 class ImageFiltersText_CF : public ImageFiltersTextBaseGM { | 317 class ImageFiltersText_CF : public ImageFiltersTextBaseGM { |
320 public: | 318 public: |
321 ImageFiltersText_CF() : ImageFiltersTextBaseGM("color") {} | 319 ImageFiltersText_CF() : ImageFiltersTextBaseGM("color") {} |
322 | 320 |
323 void installFilter(SkPaint* paint) override { | 321 void installFilter(SkPaint* paint) override { |
324 paint->setColorFilter(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfer
mode::kSrcIn_Mode)); | 322 paint->setColorFilter(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfer
mode::kSrcIn_Mode)); |
325 } | 323 } |
326 }; | 324 }; |
327 DEF_GM( return new ImageFiltersText_CF; ) | 325 DEF_GM( return new ImageFiltersText_CF; ) |
OLD | NEW |