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