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

Side by Side Diff: src/effects/SkComposeImageFilter.cpp

Issue 920513003: Make filters use SkImage instead of SkBitmap Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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 SkImage* src,
27 const Context& ctx, 27 const Context& ctx,
28 SkBitmap* result, 28 SkAutoTUnref<const SkImage>& result,
29 SkIPoint* offset) const { 29 SkIPoint* offset) const {
30 SkImageFilter* outer = getInput(0); 30 SkImageFilter* outer = getInput(0);
31 SkImageFilter* inner = getInput(1); 31 SkImageFilter* inner = getInput(1);
32 32
33 SkBitmap tmp; 33 SkAutoTUnref<const SkImage> tmp;
34 SkIPoint innerOffset = SkIPoint::Make(0, 0); 34 SkIPoint innerOffset = SkIPoint::Make(0, 0);
35 SkIPoint outerOffset = SkIPoint::Make(0, 0); 35 SkIPoint outerOffset = SkIPoint::Make(0, 0);
36 if (!inner->filterImage(proxy, src, ctx, &tmp, &innerOffset)) 36 if (!inner->filterImage(proxy, src, ctx, tmp, &innerOffset))
37 return false; 37 return false;
38 38
39 SkMatrix outerMatrix(ctx.ctm()); 39 SkMatrix outerMatrix(ctx.ctm());
40 outerMatrix.postTranslate(SkIntToScalar(-innerOffset.x()), SkIntToScalar(-in nerOffset.y())); 40 outerMatrix.postTranslate(SkIntToScalar(-innerOffset.x()), SkIntToScalar(-in nerOffset.y()));
41 Context outerContext(outerMatrix, ctx.clipBounds(), ctx.cache()); 41 Context outerContext(outerMatrix, ctx.clipBounds(), ctx.cache());
42 if (!outer->filterImage(proxy, tmp, outerContext, result, &outerOffset)) { 42 if (!outer->filterImage(proxy, tmp, outerContext, result, &outerOffset)) {
43 return false; 43 return false;
44 } 44 }
45 45
46 *offset = innerOffset + outerOffset; 46 *offset = innerOffset + outerOffset;
(...skipping 24 matching lines...) Expand all
71 71
72 str->appendf("outer: "); 72 str->appendf("outer: ");
73 outer->toString(str); 73 outer->toString(str);
74 74
75 str->appendf("inner: "); 75 str->appendf("inner: ");
76 inner->toString(str); 76 inner->toString(str);
77 77
78 str->appendf(")"); 78 str->appendf(")");
79 } 79 }
80 #endif 80 #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