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

Side by Side Diff: gm/imagefiltersgraph.cpp

Issue 1404743005: Image Filters: refactor all CPU input processing into a filterInput helper function. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Tweak comment Created 5 years, 2 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 | include/core/SkImageFilter.h » ('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 2012 Google Inc. 2 * Copyright 2012 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 9
10 #include "SkArithmeticMode.h" 10 #include "SkArithmeticMode.h"
(...skipping 23 matching lines...) Expand all
34 SimpleOffsetFilter::GetFlattenableType()); 34 SimpleOffsetFilter::GetFlattenableType());
35 } 35 }
36 }; 36 };
37 static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkImageFilter* input) { 37 static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkImageFilter* input) {
38 return new SimpleOffsetFilter(dx, dy, input); 38 return new SimpleOffsetFilter(dx, dy, input);
39 } 39 }
40 40
41 virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const Context& ctx, 41 virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const Context& ctx,
42 SkBitmap* dst, SkIPoint* offset) const override { 42 SkBitmap* dst, SkIPoint* offset) const override {
43 SkBitmap source = src; 43 SkBitmap source = src;
44 SkImageFilter* input = getInput(0);
45 SkIPoint srcOffset = SkIPoint::Make(0, 0); 44 SkIPoint srcOffset = SkIPoint::Make(0, 0);
46 if (input && !input->filterImage(proxy, src, ctx, &source, &srcOffset)) { 45 if (!this->filterInput(0, proxy, src, ctx, &source, &srcOffset)) {
47 return false; 46 return false;
48 } 47 }
49 48
50 SkIRect bounds; 49 SkIRect bounds;
51 if (!this->applyCropRect(ctx, proxy, source, &srcOffset, &bounds, &sourc e)) { 50 if (!this->applyCropRect(ctx, proxy, source, &srcOffset, &bounds, &sourc e)) {
52 return false; 51 return false;
53 } 52 }
54 53
55 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bo unds.height())); 54 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bo unds.height()));
56 SkCanvas canvas(device); 55 SkCanvas canvas(device);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 211 }
213 212
214 SkAutoTUnref<SkImage> fImage; 213 SkAutoTUnref<SkImage> fImage;
215 214
216 typedef GM INHERITED; 215 typedef GM INHERITED;
217 }; 216 };
218 217
219 /////////////////////////////////////////////////////////////////////////////// 218 ///////////////////////////////////////////////////////////////////////////////
220 219
221 DEF_GM(return new ImageFiltersGraphGM;) 220 DEF_GM(return new ImageFiltersGraphGM;)
OLDNEW
« no previous file with comments | « no previous file | include/core/SkImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698