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 "SkBlurImageFilter.h" |
9 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
10 #include "SkColorFilter.h" | 11 #include "SkColorFilter.h" |
| 12 #include "SkColorFilterImageFilter.h" |
11 #include "SkColorPriv.h" | 13 #include "SkColorPriv.h" |
| 14 #include "SkDropShadowImageFilter.h" |
| 15 #include "SkImage.h" |
12 #include "SkShader.h" | 16 #include "SkShader.h" |
13 | |
14 #include "SkBlurImageFilter.h" | |
15 #include "SkColorFilterImageFilter.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() { |
30 return SkNEW(FailImageFilter); | 30 return SkNEW(FailImageFilter); |
31 } | 31 } |
32 | 32 |
33 SK_TO_STRING_OVERRIDE() | 33 SK_TO_STRING_OVERRIDE() |
34 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter) | 34 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter) |
35 | 35 |
36 protected: | 36 protected: |
37 FailImageFilter() : INHERITED(0, NULL) {} | 37 FailImageFilter() : INHERITED(0, NULL) {} |
38 | 38 |
39 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, | 39 virtual bool onFilterImage(Proxy*, const SkImage* src, const Context&, |
40 SkBitmap* result, SkIPoint* offset) const SK_OVER
RIDE { | 40 SkAutoTUnref<const SkImage>& result, |
| 41 SkIPoint* offset) const SK_OVERRIDE { |
41 return false; | 42 return false; |
42 } | 43 } |
43 | 44 |
44 private: | 45 private: |
45 typedef SkImageFilter INHERITED; | 46 typedef SkImageFilter INHERITED; |
46 }; | 47 }; |
47 | 48 |
48 static FailImageFilter::Registrar gReg0; | 49 static FailImageFilter::Registrar gReg0; |
49 | 50 |
50 SkFlattenable* FailImageFilter::CreateProc(SkReadBuffer& buffer) { | 51 SkFlattenable* FailImageFilter::CreateProc(SkReadBuffer& buffer) { |
(...skipping 20 matching lines...) Expand all Loading... |
71 }; | 72 }; |
72 static IdentityImageFilter* Create(SkImageFilter* input = NULL) { | 73 static IdentityImageFilter* Create(SkImageFilter* input = NULL) { |
73 return SkNEW_ARGS(IdentityImageFilter, (input)); | 74 return SkNEW_ARGS(IdentityImageFilter, (input)); |
74 } | 75 } |
75 | 76 |
76 SK_TO_STRING_OVERRIDE() | 77 SK_TO_STRING_OVERRIDE() |
77 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter) | 78 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter) |
78 protected: | 79 protected: |
79 IdentityImageFilter(SkImageFilter* input) : INHERITED(1, &input) {} | 80 IdentityImageFilter(SkImageFilter* input) : INHERITED(1, &input) {} |
80 | 81 |
81 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, | 82 virtual bool onFilterImage(Proxy*, const SkImage* src, const Context&, |
82 SkBitmap* result, SkIPoint* offset) const SK_OVER
RIDE { | 83 SkAutoTUnref<const SkImage>& result, |
83 *result = src; | 84 SkIPoint* offset) const SK_OVERRIDE { |
| 85 result.reset(SkRef(src)); |
84 offset->set(0, 0); | 86 offset->set(0, 0); |
85 return true; | 87 return true; |
86 } | 88 } |
87 | 89 |
88 private: | 90 private: |
89 typedef SkImageFilter INHERITED; | 91 typedef SkImageFilter INHERITED; |
90 }; | 92 }; |
91 | 93 |
92 static IdentityImageFilter::Registrar gReg1; | 94 static IdentityImageFilter::Registrar gReg1; |
93 | 95 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 } | 254 } |
253 | 255 |
254 private: | 256 private: |
255 typedef GM INHERITED; | 257 typedef GM INHERITED; |
256 }; | 258 }; |
257 | 259 |
258 /////////////////////////////////////////////////////////////////////////////// | 260 /////////////////////////////////////////////////////////////////////////////// |
259 | 261 |
260 static skiagm::GM* MyFactory(void*) { return new ImageFiltersBaseGM; } | 262 static skiagm::GM* MyFactory(void*) { return new ImageFiltersBaseGM; } |
261 static skiagm::GMRegistry reg(MyFactory); | 263 static skiagm::GMRegistry reg(MyFactory); |
OLD | NEW |