Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: gm/imagefiltersbase.cpp

Issue 769953002: Remove SK_SUPPORT_LEGACY_DEEPFLATTENING. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gm/imagefiltersgraph.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
26 FailImageFilter::DeepCreateProc,
27 #else
28 FailImageFilter::CreateProc, 25 FailImageFilter::CreateProc,
29 #endif
30 FailImageFilter::GetFlattenableType()); 26 FailImageFilter::GetFlattenableType());
31 } 27 }
32 }; 28 };
33 static FailImageFilter* Create() { 29 static FailImageFilter* Create() {
34 return SkNEW(FailImageFilter); 30 return SkNEW(FailImageFilter);
35 } 31 }
36 32
37 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter) 33 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter)
38 34
39 protected: 35 protected:
40 FailImageFilter() : INHERITED(0, NULL) {} 36 FailImageFilter() : INHERITED(0, NULL) {}
41 37
42 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, 38 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
43 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE { 39 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE {
44 return false; 40 return false;
45 } 41 }
46 42
47 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
48 FailImageFilter(SkReadBuffer& buffer) : INHERITED(0, buffer) {}
49 #endif
50
51 private: 43 private:
52 typedef SkImageFilter INHERITED; 44 typedef SkImageFilter INHERITED;
53 }; 45 };
54 46
55 static FailImageFilter::Registrar gReg0; 47 static FailImageFilter::Registrar gReg0;
56 48
57 SkFlattenable* FailImageFilter::CreateProc(SkReadBuffer& buffer) { 49 SkFlattenable* FailImageFilter::CreateProc(SkReadBuffer& buffer) {
58 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0); 50 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0);
59 return FailImageFilter::Create(); 51 return FailImageFilter::Create();
60 } 52 }
61 53
62 class IdentityImageFilter : public SkImageFilter { 54 class IdentityImageFilter : public SkImageFilter {
63 public: 55 public:
64 class Registrar { 56 class Registrar {
65 public: 57 public:
66 Registrar() { 58 Registrar() {
67 SkFlattenable::Register("IdentityImageFilter", 59 SkFlattenable::Register("IdentityImageFilter",
68 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
69 IdentityImageFilter::DeepCreateProc,
70 #else
71 IdentityImageFilter::CreateProc, 60 IdentityImageFilter::CreateProc,
72 #endif
73 IdentityImageFilter::GetFlattenableType()); 61 IdentityImageFilter::GetFlattenableType());
74 } 62 }
75 }; 63 };
76 static IdentityImageFilter* Create(SkImageFilter* input = NULL) { 64 static IdentityImageFilter* Create(SkImageFilter* input = NULL) {
77 return SkNEW_ARGS(IdentityImageFilter, (input)); 65 return SkNEW_ARGS(IdentityImageFilter, (input));
78 } 66 }
79 67
80 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter) 68 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter)
81 protected: 69 protected:
82 IdentityImageFilter(SkImageFilter* input) : INHERITED(1, &input) {} 70 IdentityImageFilter(SkImageFilter* input) : INHERITED(1, &input) {}
83 71
84 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, 72 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
85 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE { 73 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE {
86 *result = src; 74 *result = src;
87 offset->set(0, 0); 75 offset->set(0, 0);
88 return true; 76 return true;
89 } 77 }
90 78
91 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
92 IdentityImageFilter(SkReadBuffer& buffer) : INHERITED(1, buffer) {}
93 #endif
94
95 private: 79 private:
96 typedef SkImageFilter INHERITED; 80 typedef SkImageFilter INHERITED;
97 }; 81 };
98 82
99 static IdentityImageFilter::Registrar gReg1; 83 static IdentityImageFilter::Registrar gReg1;
100 84
101 SkFlattenable* IdentityImageFilter::CreateProc(SkReadBuffer& buffer) { 85 SkFlattenable* IdentityImageFilter::CreateProc(SkReadBuffer& buffer) {
102 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); 86 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
103 return IdentityImageFilter::Create(common.getInput(0)); 87 return IdentityImageFilter::Create(common.getInput(0));
104 } 88 }
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 } 244 }
261 245
262 private: 246 private:
263 typedef GM INHERITED; 247 typedef GM INHERITED;
264 }; 248 };
265 249
266 /////////////////////////////////////////////////////////////////////////////// 250 ///////////////////////////////////////////////////////////////////////////////
267 251
268 static skiagm::GM* MyFactory(void*) { return new ImageFiltersBaseGM; } 252 static skiagm::GM* MyFactory(void*) { return new ImageFiltersBaseGM; }
269 static skiagm::GMRegistry reg(MyFactory); 253 static skiagm::GMRegistry reg(MyFactory);
OLDNEW
« no previous file with comments | « no previous file | gm/imagefiltersgraph.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698