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

Side by Side Diff: gm/imagefiltersbase.cpp

Issue 376953003: Clean up SkImageFilter constructors. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixed 100-col issues Created 6 years, 5 months 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 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, NULL) {}
28 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, 28 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
29 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE { 29 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE {
30 return false; 30 return false;
31 } 31 }
32 32
33 FailImageFilter(SkReadBuffer& buffer) 33 FailImageFilter(SkReadBuffer& buffer)
34 : INHERITED(1, buffer) {} 34 : INHERITED(0, 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(SkImageFilter* input = NULL) {
48 return SkNEW(IdentityImageFilter); 48 return SkNEW_ARGS(IdentityImageFilter, (input));
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(SkImageFilter* input) : INHERITED(1, &input) {}
54 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, 54 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
55 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE { 55 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE {
56 *result = src; 56 *result = src;
57 offset->set(0, 0); 57 offset->set(0, 0);
58 return true; 58 return true;
59 } 59 }
60 60
61 IdentityImageFilter(SkReadBuffer& buffer) 61 IdentityImageFilter(SkReadBuffer& buffer)
62 : INHERITED(1, buffer) {} 62 : INHERITED(1, buffer) {}
63 63
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
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