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

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

Issue 1702683002: Image filters: change applyCropRect() to take a src rect. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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/core/SkImageFilter.cpp ('k') | src/effects/SkColorFilterImageFilter.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 2011 The Android Open Source Project 2 * Copyright 2011 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 SkBitmap src = source; 75 SkBitmap src = source;
76 SkIPoint srcOffset = SkIPoint::Make(0, 0); 76 SkIPoint srcOffset = SkIPoint::Make(0, 0);
77 if (!this->filterInput(0, proxy, source, ctx, &src, &srcOffset)) { 77 if (!this->filterInput(0, proxy, source, ctx, &src, &srcOffset)) {
78 return false; 78 return false;
79 } 79 }
80 80
81 if (src.colorType() != kN32_SkColorType) { 81 if (src.colorType() != kN32_SkColorType) {
82 return false; 82 return false;
83 } 83 }
84 84
85 SkIRect srcBounds, dstBounds; 85 SkIRect srcBounds = src.bounds();
86 if (!this->applyCropRect(this->mapContext(ctx), src, srcOffset, &dstBounds, &srcBounds)) { 86 srcBounds.offset(srcOffset);
87 SkIRect dstBounds;
88 if (!this->applyCropRect(this->mapContext(ctx), srcBounds, &dstBounds)) {
87 return false; 89 return false;
88 } 90 }
89 if (!srcBounds.intersect(dstBounds)) { 91 if (!srcBounds.intersect(dstBounds)) {
90 return false; 92 return false;
91 } 93 }
92 94
93 SkVector sigma = map_sigma(fSigma, ctx.ctm()); 95 SkVector sigma = map_sigma(fSigma, ctx.ctm());
94 96
95 int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX; 97 int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX;
96 int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY; 98 int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 199 }
198 200
199 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx, 201 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
200 SkBitmap* result, SkIPoint* offset) const { 202 SkBitmap* result, SkIPoint* offset) const {
201 #if SK_SUPPORT_GPU 203 #if SK_SUPPORT_GPU
202 SkBitmap input = src; 204 SkBitmap input = src;
203 SkIPoint srcOffset = SkIPoint::Make(0, 0); 205 SkIPoint srcOffset = SkIPoint::Make(0, 0);
204 if (!this->filterInputGPU(0, proxy, src, ctx, &input, &srcOffset)) { 206 if (!this->filterInputGPU(0, proxy, src, ctx, &input, &srcOffset)) {
205 return false; 207 return false;
206 } 208 }
207 SkIRect srcBounds, dstBounds; 209 SkIRect srcBounds = input.bounds();
208 if (!this->applyCropRect(this->mapContext(ctx), input, srcOffset, &dstBounds , &srcBounds)) { 210 srcBounds.offset(srcOffset);
211 SkIRect dstBounds;
212 if (!this->applyCropRect(this->mapContext(ctx), srcBounds, &dstBounds)) {
209 return false; 213 return false;
210 } 214 }
211 if (!srcBounds.intersect(dstBounds)) { 215 if (!srcBounds.intersect(dstBounds)) {
212 return false; 216 return false;
213 } 217 }
214 SkVector sigma = map_sigma(fSigma, ctx.ctm()); 218 SkVector sigma = map_sigma(fSigma, ctx.ctm());
215 if (sigma.x() == 0 && sigma.y() == 0) { 219 if (sigma.x() == 0 && sigma.y() == 0) {
216 input.extractSubset(result, srcBounds); 220 input.extractSubset(result, srcBounds);
217 offset->fX = srcBounds.x(); 221 offset->fX = srcBounds.x();
218 offset->fY = srcBounds.y(); 222 offset->fY = srcBounds.y();
(...skipping 28 matching lines...) Expand all
247 str->appendf("SkBlurImageFilter: ("); 251 str->appendf("SkBlurImageFilter: (");
248 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); 252 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight);
249 253
250 if (this->getInput(0)) { 254 if (this->getInput(0)) {
251 this->getInput(0)->toString(str); 255 this->getInput(0)->toString(str);
252 } 256 }
253 257
254 str->append("))"); 258 str->append("))");
255 } 259 }
256 #endif 260 #endif
OLDNEW
« no previous file with comments | « src/core/SkImageFilter.cpp ('k') | src/effects/SkColorFilterImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698