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

Side by Side Diff: gm/imagefiltersbase.cpp

Issue 230653005: Implement intra-frame cacheing in image filters. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Set minChildren to 2 by default; comment it. Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | include/core/SkImageFilter.h » ('j') | src/core/SkImageFilter.cpp » ('J')
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) {}
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 { 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(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 Context&, 54 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
55 SkBitmap* result, SkIPoint* offset) const { 55 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE {
56 *result = src; 56 *result = src;
57 offset->set(0, 0);
57 return true; 58 return true;
58 } 59 }
59 60
60 IdentityImageFilter(SkReadBuffer& buffer) 61 IdentityImageFilter(SkReadBuffer& buffer)
61 : INHERITED(1, buffer) {} 62 : INHERITED(1, buffer) {}
62 63
63 private: 64 private:
64 typedef SkImageFilter INHERITED; 65 typedef SkImageFilter INHERITED;
65 }; 66 };
66 67
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 227 }
227 228
228 private: 229 private:
229 typedef GM INHERITED; 230 typedef GM INHERITED;
230 }; 231 };
231 232
232 /////////////////////////////////////////////////////////////////////////////// 233 ///////////////////////////////////////////////////////////////////////////////
233 234
234 static skiagm::GM* MyFactory(void*) { return new ImageFiltersBaseGM; } 235 static skiagm::GM* MyFactory(void*) { return new ImageFiltersBaseGM; }
235 static skiagm::GMRegistry reg(MyFactory); 236 static skiagm::GMRegistry reg(MyFactory);
OLDNEW
« no previous file with comments | « no previous file | include/core/SkImageFilter.h » ('j') | src/core/SkImageFilter.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698