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

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

Issue 395603002: Simplify flattening to just write enough to call the factory (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 4 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/SkColorMatrixFilter.cpp ('k') | src/effects/SkCornerPathEffect.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 bool SkComposeImageFilter::onFilterImage(Proxy* proxy, 16 bool SkComposeImageFilter::onFilterImage(Proxy* proxy,
17 const SkBitmap& src, 17 const SkBitmap& src,
18 const Context& ctx, 18 const Context& ctx,
19 SkBitmap* result, 19 SkBitmap* result,
20 SkIPoint* offset) const { 20 SkIPoint* offset) const {
21 SkImageFilter* outer = getInput(0); 21 SkImageFilter* outer = getInput(0);
22 SkImageFilter* inner = getInput(1); 22 SkImageFilter* inner = getInput(1);
23 23
24 if (!outer && !inner) {
25 return false;
26 }
27
28 if (!outer || !inner) {
29 return (outer ? outer : inner)->filterImage(proxy, src, ctx, result, off set);
30 }
31
32 SkBitmap tmp; 24 SkBitmap tmp;
33 return inner->filterImage(proxy, src, ctx, &tmp, offset) && 25 return inner->filterImage(proxy, src, ctx, &tmp, offset) &&
34 outer->filterImage(proxy, tmp, ctx, result, offset); 26 outer->filterImage(proxy, tmp, ctx, result, offset);
35 } 27 }
36 28
37 bool SkComposeImageFilter::onFilterBounds(const SkIRect& src, 29 bool SkComposeImageFilter::onFilterBounds(const SkIRect& src,
38 const SkMatrix& ctm, 30 const SkMatrix& ctm,
39 SkIRect* dst) const { 31 SkIRect* dst) const {
40 SkImageFilter* outer = getInput(0); 32 SkImageFilter* outer = getInput(0);
41 SkImageFilter* inner = getInput(1); 33 SkImageFilter* inner = getInput(1);
42 34
43 if (!outer && !inner) {
44 return false;
45 }
46
47 if (!outer || !inner) {
48 return (outer ? outer : inner)->filterBounds(src, ctm, dst);
49 }
50
51 SkIRect tmp; 35 SkIRect tmp;
52 return inner->filterBounds(src, ctm, &tmp) && 36 return inner->filterBounds(src, ctm, &tmp) && outer->filterBounds(tmp, ctm, dst);
53 outer->filterBounds(tmp, ctm, dst);
54 } 37 }
55 38
39 SkFlattenable* SkComposeImageFilter::CreateProc(SkReadBuffer& buffer) {
40 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 2);
41 return SkComposeImageFilter::Create(common.getInput(0), common.getInput(1));
42 }
43
44 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
56 SkComposeImageFilter::SkComposeImageFilter(SkReadBuffer& buffer) 45 SkComposeImageFilter::SkComposeImageFilter(SkReadBuffer& buffer)
57 : INHERITED(2, buffer) { 46 : INHERITED(2, buffer) {
58 } 47 }
48 #endif
OLDNEW
« no previous file with comments | « src/effects/SkColorMatrixFilter.cpp ('k') | src/effects/SkCornerPathEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698