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

Side by Side Diff: src/effects/SkComposeImageFilter.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 | « src/effects/SkColorFilterImageFilter.cpp ('k') | src/effects/SkDisplacementMapEffect.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 2013 Google Inc. 2 * Copyright 2013 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkComposeImageFilter.h" 9 #include "SkComposeImageFilter.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
11 #include "SkWriteBuffer.h" 11 #include "SkWriteBuffer.h"
12 12
13 SkComposeImageFilter::~SkComposeImageFilter() { 13 SkComposeImageFilter::~SkComposeImageFilter() {
14 } 14 }
15 15
16 void SkComposeImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) con st { 16 void SkComposeImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) con st {
17 SkImageFilter* outer = getInput(0); 17 SkImageFilter* outer = getInput(0);
18 SkImageFilter* inner = getInput(1); 18 SkImageFilter* inner = getInput(1);
19 19
20 SkRect tmp; 20 SkRect tmp;
21 inner->computeFastBounds(src, &tmp); 21 inner->computeFastBounds(src, &tmp);
22 outer->computeFastBounds(tmp, dst); 22 outer->computeFastBounds(tmp, dst);
23 } 23 }
24 24
25 bool SkComposeImageFilter::onFilterImage(Proxy* proxy, 25 bool SkComposeImageFilter::onFilterImage(Proxy* proxy,
26 const SkBitmap& src, 26 const SkBitmap& src,
27 const Context& ctx, 27 const Context& ctx,
28 SkBitmap* result, 28 SkBitmap* result,
29 SkIPoint* offset) const { 29 SkIPoint* offset) const {
30 SkImageFilter* outer = getInput(0);
31 SkImageFilter* inner = getInput(1);
32
33 SkBitmap tmp; 30 SkBitmap tmp;
34 SkIPoint innerOffset = SkIPoint::Make(0, 0); 31 SkIPoint innerOffset = SkIPoint::Make(0, 0);
35 SkIPoint outerOffset = SkIPoint::Make(0, 0); 32 SkIPoint outerOffset = SkIPoint::Make(0, 0);
36 if (!inner->filterImage(proxy, src, ctx, &tmp, &innerOffset)) 33 if (!this->filterInput(1, proxy, src, ctx, &tmp, &innerOffset))
37 return false; 34 return false;
38 35
39 SkMatrix outerMatrix(ctx.ctm()); 36 SkMatrix outerMatrix(ctx.ctm());
40 outerMatrix.postTranslate(SkIntToScalar(-innerOffset.x()), SkIntToScalar(-in nerOffset.y())); 37 outerMatrix.postTranslate(SkIntToScalar(-innerOffset.x()), SkIntToScalar(-in nerOffset.y()));
41 Context outerContext(outerMatrix, ctx.clipBounds(), ctx.cache()); 38 Context outerContext(outerMatrix, ctx.clipBounds(), ctx.cache());
42 if (!outer->filterImage(proxy, tmp, outerContext, result, &outerOffset)) { 39 if (!this->filterInput(0, proxy, tmp, outerContext, result, &outerOffset)) {
43 return false; 40 return false;
44 } 41 }
45 42
46 *offset = innerOffset + outerOffset; 43 *offset = innerOffset + outerOffset;
47 return true; 44 return true;
48 } 45 }
49 46
50 bool SkComposeImageFilter::onFilterBounds(const SkIRect& src, 47 bool SkComposeImageFilter::onFilterBounds(const SkIRect& src,
51 const SkMatrix& ctm, 48 const SkMatrix& ctm,
52 SkIRect* dst) const { 49 SkIRect* dst) const {
(...skipping 18 matching lines...) Expand all
71 68
72 str->appendf("outer: "); 69 str->appendf("outer: ");
73 outer->toString(str); 70 outer->toString(str);
74 71
75 str->appendf("inner: "); 72 str->appendf("inner: ");
76 inner->toString(str); 73 inner->toString(str);
77 74
78 str->appendf(")"); 75 str->appendf(")");
79 } 76 }
80 #endif 77 #endif
OLDNEW
« no previous file with comments | « src/effects/SkColorFilterImageFilter.cpp ('k') | src/effects/SkDisplacementMapEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698