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

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

Issue 196353021: Revert "Implement support for expanding crop rects in image filters" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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/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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 SkBitmap src = source; 139 SkBitmap src = source;
140 SkIPoint srcOffset = SkIPoint::Make(0, 0); 140 SkIPoint srcOffset = SkIPoint::Make(0, 0);
141 if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctx, &src, &srcO ffset)) { 141 if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctx, &src, &srcO ffset)) {
142 return false; 142 return false;
143 } 143 }
144 144
145 if (src.colorType() != kPMColor_SkColorType) { 145 if (src.colorType() != kPMColor_SkColorType) {
146 return false; 146 return false;
147 } 147 }
148 148
149 SkIRect srcBounds, dstBounds;
150 if (!this->applyCropRect(ctx, proxy, src, &srcOffset, &srcBounds, &src)) {
151 return false;
152 }
153
154 SkAutoLockPixels alp(src); 149 SkAutoLockPixels alp(src);
155 if (!src.getPixels()) { 150 if (!src.getPixels()) {
156 return false; 151 return false;
157 } 152 }
158 153
154 SkIRect srcBounds, dstBounds;
155 src.getBounds(&srcBounds);
156 srcBounds.offset(srcOffset);
157 if (!this->applyCropRect(&srcBounds, ctx.ctm())) {
158 return false;
159 }
160
159 dst->setConfig(src.config(), srcBounds.width(), srcBounds.height()); 161 dst->setConfig(src.config(), srcBounds.width(), srcBounds.height());
160 dst->getBounds(&dstBounds); 162 dst->getBounds(&dstBounds);
161 if (!dst->allocPixels()) { 163 if (!dst->allocPixels()) {
162 return false; 164 return false;
163 } 165 }
164 166
165 SkVector sigma, localSigma = SkVector::Make(fSigma.width(), fSigma.height()) ; 167 SkVector sigma, localSigma = SkVector::Make(fSigma.width(), fSigma.height()) ;
166 ctx.ctm().mapVectors(&sigma, &localSigma, 1); 168 ctx.ctm().mapVectors(&sigma, &localSigma, 1);
167 169
168 int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX; 170 int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 251 }
250 252
251 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx, 253 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
252 SkBitmap* result, SkIPoint* offset) const { 254 SkBitmap* result, SkIPoint* offset) const {
253 #if SK_SUPPORT_GPU 255 #if SK_SUPPORT_GPU
254 SkBitmap input = src; 256 SkBitmap input = src;
255 SkIPoint srcOffset = SkIPoint::Make(0, 0); 257 SkIPoint srcOffset = SkIPoint::Make(0, 0);
256 if (getInput(0) && !getInput(0)->getInputResultGPU(proxy, src, ctx, &input, &srcOffset)) { 258 if (getInput(0) && !getInput(0)->getInputResultGPU(proxy, src, ctx, &input, &srcOffset)) {
257 return false; 259 return false;
258 } 260 }
261 GrTexture* source = input.getTexture();
259 SkIRect rect; 262 SkIRect rect;
260 if (!this->applyCropRect(ctx, proxy, input, &srcOffset, &rect, &input)) { 263 src.getBounds(&rect);
264 rect.offset(srcOffset);
265 if (!this->applyCropRect(&rect, ctx.ctm())) {
261 return false; 266 return false;
262 } 267 }
263 GrTexture* source = input.getTexture();
264 SkVector sigma, localSigma = SkVector::Make(fSigma.width(), fSigma.height()) ; 268 SkVector sigma, localSigma = SkVector::Make(fSigma.width(), fSigma.height()) ;
265 ctx.ctm().mapVectors(&sigma, &localSigma, 1); 269 ctx.ctm().mapVectors(&sigma, &localSigma, 1);
266 offset->fX = rect.fLeft; 270 offset->fX = rect.fLeft;
267 offset->fY = rect.fTop; 271 offset->fY = rect.fTop;
268 rect.offset(-srcOffset); 272 rect.offset(-srcOffset);
269 SkAutoTUnref<GrTexture> tex(SkGpuBlurUtils::GaussianBlur(source->getContext( ), 273 SkAutoTUnref<GrTexture> tex(SkGpuBlurUtils::GaussianBlur(source->getContext( ),
270 source, 274 source,
271 false, 275 false,
272 SkRect::Make(rect), 276 SkRect::Make(rect),
273 true, 277 true,
274 sigma.x(), 278 sigma.x(),
275 sigma.y())); 279 sigma.y()));
276 WrapTexture(tex, rect.width(), rect.height(), result); 280 WrapTexture(tex, rect.width(), rect.height(), result);
277 return true; 281 return true;
278 #else 282 #else
279 SkDEBUGFAIL("Should not call in GPU-less build"); 283 SkDEBUGFAIL("Should not call in GPU-less build");
280 return false; 284 return false;
281 #endif 285 #endif
282 } 286 }
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