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

Side by Side Diff: gm/imagefiltersbase.cpp

Issue 23021015: Initial error handling code (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Adapting code to sk_once changes Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | gyp/core.gypi » ('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"
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 29
30 FailImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} 30 FailImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
31 31
32 private: 32 private:
33 typedef SkImageFilter INHERITED; 33 typedef SkImageFilter INHERITED;
34 }; 34 };
35 35
36 // register the filter with the flattenable registry 36 // register the filter with the flattenable registry
37 static SkFlattenable::Registrar gFailImageFilterReg("FailImageFilter", 37 static SkFlattenable::Registrar gFailImageFilterReg("FailImageFilter",
38 FailImageFilter::CreateProc) ; 38 FailImageFilter::CreateProc,
39 FailImageFilter::GetFlattena bleType());
39 40
40 class IdentityImageFilter : public SkImageFilter { 41 class IdentityImageFilter : public SkImageFilter {
41 public: 42 public:
42 IdentityImageFilter() : INHERITED(0) {} 43 IdentityImageFilter() : INHERITED(0) {}
43 44
44 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter) 45 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter)
45 protected: 46 protected:
46 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, 47 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
47 SkBitmap* result, SkIPoint* offset) { 48 SkBitmap* result, SkIPoint* offset) {
48 *result = src; 49 *result = src;
49 return true; 50 return true;
50 } 51 }
51 52
52 IdentityImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} 53 IdentityImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
53 54
54 private: 55 private:
55 typedef SkImageFilter INHERITED; 56 typedef SkImageFilter INHERITED;
56 }; 57 };
57 58
58 // register the filter with the flattenable registry 59 // register the filter with the flattenable registry
59 static SkFlattenable::Registrar gIdentityImageFilterReg("IdentityImageFilter", 60 static SkFlattenable::Registrar gIdentityImageFilterReg("IdentityImageFilter",
60 IdentityImageFilter::Cre ateProc); 61 IdentityImageFilter::Cre ateProc,
62 IdentityImageFilter::Get FlattenableType());
61 63
62 64
63 /////////////////////////////////////////////////////////////////////////////// 65 ///////////////////////////////////////////////////////////////////////////////
64 66
65 static void draw_paint(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) { 67 static void draw_paint(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {
66 SkPaint paint; 68 SkPaint paint;
67 paint.setImageFilter(imf); 69 paint.setImageFilter(imf);
68 paint.setColor(SK_ColorGREEN); 70 paint.setColor(SK_ColorGREEN);
69 canvas->save(); 71 canvas->save();
70 canvas->clipRect(r); 72 canvas->clipRect(r);
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 220 }
219 221
220 private: 222 private:
221 typedef GM INHERITED; 223 typedef GM INHERITED;
222 }; 224 };
223 225
224 /////////////////////////////////////////////////////////////////////////////// 226 ///////////////////////////////////////////////////////////////////////////////
225 227
226 static skiagm::GM* MyFactory(void*) { return new ImageFiltersBaseGM; } 228 static skiagm::GM* MyFactory(void*) { return new ImageFiltersBaseGM; }
227 static skiagm::GMRegistry reg(MyFactory); 229 static skiagm::GMRegistry reg(MyFactory);
OLDNEW
« no previous file with comments | « no previous file | gyp/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698