OLD | NEW |
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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 } | 205 } |
206 SkIRect rect; | 206 SkIRect rect; |
207 if (!this->applyCropRect(ctx, proxy, input, &srcOffset, &rect, &input)) { | 207 if (!this->applyCropRect(ctx, proxy, input, &srcOffset, &rect, &input)) { |
208 return false; | 208 return false; |
209 } | 209 } |
210 GrTexture* source = input.getTexture(); | 210 GrTexture* source = input.getTexture(); |
211 SkVector sigma = mapSigma(fSigma, ctx.ctm()); | 211 SkVector sigma = mapSigma(fSigma, ctx.ctm()); |
212 offset->fX = rect.fLeft; | 212 offset->fX = rect.fLeft; |
213 offset->fY = rect.fTop; | 213 offset->fY = rect.fTop; |
214 rect.offset(-srcOffset); | 214 rect.offset(-srcOffset); |
| 215 auto constraint = GrTextureProvider::FromImageFilter(ctx.sizeConstraint()); |
215 SkAutoTUnref<GrTexture> tex(SkGpuBlurUtils::GaussianBlur(source->getContext(
), | 216 SkAutoTUnref<GrTexture> tex(SkGpuBlurUtils::GaussianBlur(source->getContext(
), |
216 source, | 217 source, |
217 false, | 218 false, |
218 SkRect::Make(rect), | 219 SkRect::Make(rect), |
219 true, | 220 true, |
220 sigma.x(), | 221 sigma.x(), |
221 sigma.y())); | 222 sigma.y(), |
| 223 constraint)); |
222 if (!tex) { | 224 if (!tex) { |
223 return false; | 225 return false; |
224 } | 226 } |
225 WrapTexture(tex, rect.width(), rect.height(), result); | 227 WrapTexture(tex, rect.width(), rect.height(), result); |
226 return true; | 228 return true; |
227 #else | 229 #else |
228 SkDEBUGFAIL("Should not call in GPU-less build"); | 230 SkDEBUGFAIL("Should not call in GPU-less build"); |
229 return false; | 231 return false; |
230 #endif | 232 #endif |
231 } | 233 } |
232 | 234 |
233 #ifndef SK_IGNORE_TO_STRING | 235 #ifndef SK_IGNORE_TO_STRING |
234 void SkBlurImageFilter::toString(SkString* str) const { | 236 void SkBlurImageFilter::toString(SkString* str) const { |
235 str->appendf("SkBlurImageFilter: ("); | 237 str->appendf("SkBlurImageFilter: ("); |
236 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); | 238 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); |
237 | 239 |
238 if (this->getInput(0)) { | 240 if (this->getInput(0)) { |
239 this->getInput(0)->toString(str); | 241 this->getInput(0)->toString(str); |
240 } | 242 } |
241 | 243 |
242 str->append("))"); | 244 str->append("))"); |
243 } | 245 } |
244 #endif | 246 #endif |
OLD | NEW |