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

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

Issue 23295017: In image filters, apply the CTM and offset to the crop rect. This is necessary to compensate for bo… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix documentation comment. Created 7 years, 3 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 return false; 151 return false;
152 } 152 }
153 153
154 SkAutoLockPixels alp(src); 154 SkAutoLockPixels alp(src);
155 if (!src.getPixels()) { 155 if (!src.getPixels()) {
156 return false; 156 return false;
157 } 157 }
158 158
159 SkIRect srcBounds, dstBounds; 159 SkIRect srcBounds, dstBounds;
160 src.getBounds(&srcBounds); 160 src.getBounds(&srcBounds);
161 if (!this->applyCropRect(&srcBounds)) { 161 if (!this->applyCropRect(&srcBounds, ctm)) {
162 return false; 162 return false;
163 } 163 }
164 164
165 dst->setConfig(src.config(), srcBounds.width(), srcBounds.height()); 165 dst->setConfig(src.config(), srcBounds.width(), srcBounds.height());
166 dst->getBounds(&dstBounds); 166 dst->getBounds(&dstBounds);
167 dst->allocPixels(); 167 dst->allocPixels();
168 int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX; 168 int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX;
169 int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY; 169 int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY;
170 getBox3Params(fSigma.width(), &kernelSizeX, &kernelSizeX3, &lowOffsetX, &hig hOffsetX); 170 getBox3Params(fSigma.width(), &kernelSizeX, &kernelSizeX3, &lowOffsetX, &hig hOffsetX);
171 getBox3Params(fSigma.height(), &kernelSizeY, &kernelSizeY3, &lowOffsetY, &hi ghOffsetY); 171 getBox3Params(fSigma.height(), &kernelSizeY, &kernelSizeY3, &lowOffsetY, &hi ghOffsetY);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm, 209 bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
210 SkBitmap* result, SkIPoint* offset) { 210 SkBitmap* result, SkIPoint* offset) {
211 #if SK_SUPPORT_GPU 211 #if SK_SUPPORT_GPU
212 SkBitmap input; 212 SkBitmap input;
213 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &in put, offset)) { 213 if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &in put, offset)) {
214 return false; 214 return false;
215 } 215 }
216 GrTexture* source = input.getTexture(); 216 GrTexture* source = input.getTexture();
217 SkIRect rect; 217 SkIRect rect;
218 src.getBounds(&rect); 218 src.getBounds(&rect);
219 if (!this->applyCropRect(&rect)) { 219 if (!this->applyCropRect(&rect, ctm)) {
220 return false; 220 return false;
221 } 221 }
222 SkAutoTUnref<GrTexture> tex(SkGpuBlurUtils::GaussianBlur(source->getContext( ), 222 SkAutoTUnref<GrTexture> tex(SkGpuBlurUtils::GaussianBlur(source->getContext( ),
223 source, 223 source,
224 false, 224 false,
225 SkRect::Make(rect), 225 SkRect::Make(rect),
226 true, 226 true,
227 fSigma.width(), 227 fSigma.width(),
228 fSigma.height())); 228 fSigma.height()));
229 offset->fX += rect.fLeft; 229 offset->fX += rect.fLeft;
230 offset->fY += rect.fTop; 230 offset->fY += rect.fTop;
231 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res ult); 231 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res ult);
232 #else 232 #else
233 SkDEBUGFAIL("Should not call in GPU-less build"); 233 SkDEBUGFAIL("Should not call in GPU-less build");
234 return false; 234 return false;
235 #endif 235 #endif
236 } 236 }
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