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 "SkTestImageFilters.h" | 17 #include "SkTestImageFilters.h" |
18 | 18 |
19 class FailImageFilter : public SkImageFilter { | 19 class FailImageFilter : public SkImageFilter { |
20 public: | 20 public: |
21 class Registrar { | 21 class Registrar { |
22 public: | 22 public: |
23 Registrar() { | 23 Registrar() { |
24 SkFlattenable::Register("FailImageFilter", | 24 SkFlattenable::Register("FailImageFilter", |
25 FailImageFilter::CreateProc, | 25 FailImageFilter::CreateProc, |
26 FailImageFilter::GetFlattenableType()); | 26 FailImageFilter::GetFlattenableType()); |
27 } | 27 } |
28 }; | 28 }; |
29 static FailImageFilter* Create() { | 29 static FailImageFilter* Create() { return new FailImageFilter; } |
30 return SkNEW(FailImageFilter); | |
31 } | |
32 | 30 |
33 SK_TO_STRING_OVERRIDE() | 31 SK_TO_STRING_OVERRIDE() |
34 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter) | 32 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter) |
35 | 33 |
36 protected: | 34 protected: |
37 FailImageFilter() : INHERITED(0, NULL) {} | 35 FailImageFilter() : INHERITED(0, NULL) {} |
38 | 36 |
39 bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, | 37 bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, |
40 SkBitmap* result, SkIPoint* offset) const override { | 38 SkBitmap* result, SkIPoint* offset) const override { |
41 return false; | 39 return false; |
(...skipping 21 matching lines...) Expand all Loading... |
63 public: | 61 public: |
64 class Registrar { | 62 class Registrar { |
65 public: | 63 public: |
66 Registrar() { | 64 Registrar() { |
67 SkFlattenable::Register("IdentityImageFilter", | 65 SkFlattenable::Register("IdentityImageFilter", |
68 IdentityImageFilter::CreateProc, | 66 IdentityImageFilter::CreateProc, |
69 IdentityImageFilter::GetFlattenableType()); | 67 IdentityImageFilter::GetFlattenableType()); |
70 } | 68 } |
71 }; | 69 }; |
72 static IdentityImageFilter* Create(SkImageFilter* input = NULL) { | 70 static IdentityImageFilter* Create(SkImageFilter* input = NULL) { |
73 return SkNEW_ARGS(IdentityImageFilter, (input)); | 71 return new IdentityImageFilter(input); |
74 } | 72 } |
75 | 73 |
76 SK_TO_STRING_OVERRIDE() | 74 SK_TO_STRING_OVERRIDE() |
77 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter) | 75 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter) |
78 protected: | 76 protected: |
79 IdentityImageFilter(SkImageFilter* input) : INHERITED(1, &input) {} | 77 IdentityImageFilter(SkImageFilter* input) : INHERITED(1, &input) {} |
80 | 78 |
81 bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, | 79 bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, |
82 SkBitmap* result, SkIPoint* offset) const override { | 80 SkBitmap* result, SkIPoint* offset) const override { |
83 *result = src; | 81 *result = src; |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 class ImageFiltersText_CF : public ImageFiltersTextBaseGM { | 339 class ImageFiltersText_CF : public ImageFiltersTextBaseGM { |
342 public: | 340 public: |
343 ImageFiltersText_CF() : ImageFiltersTextBaseGM("color") {} | 341 ImageFiltersText_CF() : ImageFiltersTextBaseGM("color") {} |
344 | 342 |
345 void installFilter(SkPaint* paint) override { | 343 void installFilter(SkPaint* paint) override { |
346 paint->setColorFilter(SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXf
ermode::kSrcIn_Mode))->unref(); | 344 paint->setColorFilter(SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXf
ermode::kSrcIn_Mode))->unref(); |
347 } | 345 } |
348 }; | 346 }; |
349 DEF_GM( return new ImageFiltersText_CF; ) | 347 DEF_GM( return new ImageFiltersText_CF; ) |
350 | 348 |
OLD | NEW |