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