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

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

Issue 198003008: Implement support for expanding crop rects in image filters (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix ImageFilterTest Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/effects/SkMatrixConvolutionImageFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.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 2012 The Android Open Source Project 2 * Copyright 2012 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 "SkMergeImageFilter.h" 8 #include "SkMergeImageFilter.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkDevice.h" 10 #include "SkDevice.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 67
68 bool SkMergeImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, 68 bool SkMergeImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
69 const Context& ctx, 69 const Context& ctx,
70 SkBitmap* result, SkIPoint* offset) const { 70 SkBitmap* result, SkIPoint* offset) const {
71 if (countInputs() < 1) { 71 if (countInputs() < 1) {
72 return false; 72 return false;
73 } 73 }
74 74
75 SkIRect bounds; 75 SkIRect bounds;
76 src.getBounds(&bounds); 76 if (!this->applyCropRect(ctx, src, SkIPoint::Make(0, 0), &bounds)) {
77 if (!this->applyCropRect(&bounds, ctx.ctm())) {
78 return false; 77 return false;
79 } 78 }
80 79
81 const int x0 = bounds.left(); 80 const int x0 = bounds.left();
82 const int y0 = bounds.top(); 81 const int y0 = bounds.top();
83 82
84 SkAutoTUnref<SkBaseDevice> dst(proxy->createDevice(bounds.width(), bounds.he ight())); 83 SkAutoTUnref<SkBaseDevice> dst(proxy->createDevice(bounds.width(), bounds.he ight()));
85 if (NULL == dst) { 84 if (NULL == dst) {
86 return false; 85 return false;
87 } 86 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 if (buffer.validate(buffer.getArrayCount() == size) && 136 if (buffer.validate(buffer.getArrayCount() == size) &&
138 buffer.readByteArray(fModes, size)) { 137 buffer.readByteArray(fModes, size)) {
139 for (int i = 0; i < nbInputs; ++i) { 138 for (int i = 0; i < nbInputs; ++i) {
140 buffer.validate(SkIsValidMode((SkXfermode::Mode)fModes[i])); 139 buffer.validate(SkIsValidMode((SkXfermode::Mode)fModes[i]));
141 } 140 }
142 } 141 }
143 } else { 142 } else {
144 fModes = 0; 143 fModes = 0;
145 } 144 }
146 } 145 }
OLDNEW
« no previous file with comments | « src/effects/SkMatrixConvolutionImageFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698