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

Side by Side Diff: src/effects/SkXfermodeImageFilter.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/SkTileImageFilter.cpp ('k') | no next file » | 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 The Android Open Source Project 2 * Copyright 2013 The Android Open Source Project
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 "SkXfermodeImageFilter.h" 8 #include "SkXfermodeImageFilter.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkDevice.h" 10 #include "SkDevice.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 this->INHERITED::flatten(buffer); 43 this->INHERITED::flatten(buffer);
44 buffer.writeFlattenable(fMode); 44 buffer.writeFlattenable(fMode);
45 } 45 }
46 46
47 bool SkXfermodeImageFilter::onFilterImage(Proxy* proxy, 47 bool SkXfermodeImageFilter::onFilterImage(Proxy* proxy,
48 const SkBitmap& src, 48 const SkBitmap& src,
49 const Context& ctx, 49 const Context& ctx,
50 SkBitmap* dst, 50 SkBitmap* dst,
51 SkIPoint* offset) const { 51 SkIPoint* offset) const {
52 SkBitmap background = src, foreground = src; 52 SkBitmap background = src, foreground = src;
53 SkImageFilter* backgroundInput = this->getInput(0);
54 SkImageFilter* foregroundInput = this->getInput(1);
55 SkIPoint backgroundOffset = SkIPoint::Make(0, 0); 53 SkIPoint backgroundOffset = SkIPoint::Make(0, 0);
56 if (backgroundInput && 54 if (!this->filterInput(0, proxy, src, ctx, &background, &backgroundOffset)) {
57 !backgroundInput->filterImage(proxy, src, ctx, &background, &backgroundO ffset)) {
58 background.reset(); 55 background.reset();
59 } 56 }
60 SkIPoint foregroundOffset = SkIPoint::Make(0, 0); 57 SkIPoint foregroundOffset = SkIPoint::Make(0, 0);
61 if (foregroundInput && 58 if (!this->filterInput(1, proxy, src, ctx, &foreground, &foregroundOffset)) {
62 !foregroundInput->filterImage(proxy, src, ctx, &foreground, &foregroundO ffset)) {
63 foreground.reset(); 59 foreground.reset();
64 } 60 }
65 61
66 SkIRect bounds, foregroundBounds; 62 SkIRect bounds, foregroundBounds;
67 if (!applyCropRect(ctx, foreground, foregroundOffset, &foregroundBounds)) { 63 if (!applyCropRect(ctx, foreground, foregroundOffset, &foregroundBounds)) {
68 foregroundBounds.setEmpty(); 64 foregroundBounds.setEmpty();
69 foreground.reset(); 65 foreground.reset();
70 } 66 }
71 if (!applyCropRect(ctx, background, backgroundOffset, &bounds)) { 67 if (!applyCropRect(ctx, background, backgroundOffset, &bounds)) {
72 bounds.setEmpty(); 68 bounds.setEmpty();
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 SkMatrix::I(), srcRect); 202 SkMatrix::I(), srcRect);
207 203
208 offset->fX = backgroundOffset.fX; 204 offset->fX = backgroundOffset.fX;
209 offset->fY = backgroundOffset.fY; 205 offset->fY = backgroundOffset.fY;
210 WrapTexture(dst, src.width(), src.height(), result); 206 WrapTexture(dst, src.width(), src.height(), result);
211 return true; 207 return true;
212 } 208 }
213 209
214 #endif 210 #endif
215 211
OLDNEW
« no previous file with comments | « src/effects/SkTileImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698