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 static FailImageFilter* Create() { | 21 static FailImageFilter* Create() { |
22 return SkNEW(FailImageFilter); | 22 return SkNEW(FailImageFilter); |
23 } | 23 } |
24 | 24 |
25 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter) | 25 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter) |
26 protected: | 26 protected: |
27 FailImageFilter() : INHERITED(0) {} | 27 FailImageFilter() : INHERITED(0) {} |
28 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, | 28 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, |
29 SkBitmap* result, SkIPoint* offset) const { | 29 SkBitmap* result, SkIPoint* offset) const { |
30 return false; | 30 return false; |
31 } | 31 } |
32 | 32 |
33 FailImageFilter(SkReadBuffer& buffer) | 33 FailImageFilter(SkReadBuffer& buffer) |
34 : INHERITED(1, buffer) {} | 34 : INHERITED(1, buffer) {} |
35 | 35 |
36 private: | 36 private: |
37 typedef SkImageFilter INHERITED; | 37 typedef SkImageFilter INHERITED; |
38 }; | 38 }; |
39 | 39 |
40 // register the filter with the flattenable registry | 40 // register the filter with the flattenable registry |
41 static SkFlattenable::Registrar gFailImageFilterReg("FailImageFilter", | 41 static SkFlattenable::Registrar gFailImageFilterReg("FailImageFilter", |
42 FailImageFilter::CreateProc, | 42 FailImageFilter::CreateProc, |
43 FailImageFilter::GetFlattena
bleType()); | 43 FailImageFilter::GetFlattena
bleType()); |
44 | 44 |
45 class IdentityImageFilter : public SkImageFilter { | 45 class IdentityImageFilter : public SkImageFilter { |
46 public: | 46 public: |
47 static IdentityImageFilter* Create() { | 47 static IdentityImageFilter* Create() { |
48 return SkNEW(IdentityImageFilter); | 48 return SkNEW(IdentityImageFilter); |
49 } | 49 } |
50 | 50 |
51 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter) | 51 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter) |
52 protected: | 52 protected: |
53 IdentityImageFilter() : INHERITED(0) {} | 53 IdentityImageFilter() : INHERITED(0) {} |
54 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, | 54 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, |
55 SkBitmap* result, SkIPoint* offset) const { | 55 SkBitmap* result, SkIPoint* offset) const { |
56 *result = src; | 56 *result = src; |
57 return true; | 57 return true; |
58 } | 58 } |
59 | 59 |
60 IdentityImageFilter(SkReadBuffer& buffer) | 60 IdentityImageFilter(SkReadBuffer& buffer) |
61 : INHERITED(1, buffer) {} | 61 : INHERITED(1, buffer) {} |
62 | 62 |
63 private: | 63 private: |
64 typedef SkImageFilter INHERITED; | 64 typedef SkImageFilter INHERITED; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 226 } |
227 | 227 |
228 private: | 228 private: |
229 typedef GM INHERITED; | 229 typedef GM INHERITED; |
230 }; | 230 }; |
231 | 231 |
232 /////////////////////////////////////////////////////////////////////////////// | 232 /////////////////////////////////////////////////////////////////////////////// |
233 | 233 |
234 static skiagm::GM* MyFactory(void*) { return new ImageFiltersBaseGM; } | 234 static skiagm::GM* MyFactory(void*) { return new ImageFiltersBaseGM; } |
235 static skiagm::GMRegistry reg(MyFactory); | 235 static skiagm::GMRegistry reg(MyFactory); |
OLD | NEW |