| 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" |
| 11 #include "SkFlattenableBuffers.h" | 11 #include "SkFlattenableBuffers.h" |
| 12 #include "SkGpuBlurUtils.h" | 12 #include "SkGpuBlurUtils.h" |
| 13 #if SK_SUPPORT_GPU | 13 #if SK_SUPPORT_GPU |
| 14 #include "GrContext.h" | 14 #include "GrContext.h" |
| 15 #include "SkImageFilterUtils.h" | 15 #include "SkImageFilterUtils.h" |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 SkBlurImageFilter::SkBlurImageFilter(SkFlattenableReadBuffer& buffer) | 18 SkBlurImageFilter::SkBlurImageFilter(SkFlattenableReadBuffer& buffer) |
| 19 : INHERITED(buffer) { | 19 : INHERITED(buffer) { |
| 20 fSigma.fWidth = buffer.readScalar(); | 20 fSigma.fWidth = buffer.readScalar(); |
| 21 fSigma.fHeight = buffer.readScalar(); | 21 fSigma.fHeight = buffer.readScalar(); |
| 22 buffer.validate(SkScalarIsFinite(fSigma.fWidth) && |
| 23 SkScalarIsFinite(fSigma.fHeight) && |
| 24 (fSigma.fWidth >= 0) && |
| 25 (fSigma.fHeight >= 0)); |
| 22 } | 26 } |
| 23 | 27 |
| 24 SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX, | 28 SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX, |
| 25 SkScalar sigmaY, | 29 SkScalar sigmaY, |
| 26 SkImageFilter* input, | 30 SkImageFilter* input, |
| 27 const CropRect* cropRect) | 31 const CropRect* cropRect) |
| 28 : INHERITED(input, cropRect), fSigma(SkSize::Make(sigmaX, sigmaY)) { | 32 : INHERITED(input, cropRect), fSigma(SkSize::Make(sigmaX, sigmaY)) { |
| 29 SkASSERT(sigmaX >= 0 && sigmaY >= 0); | 33 SkASSERT(sigmaX >= 0 && sigmaY >= 0); |
| 30 } | 34 } |
| 31 | 35 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 fSigma.width(), | 231 fSigma.width(), |
| 228 fSigma.height())); | 232 fSigma.height())); |
| 229 offset->fX += rect.fLeft; | 233 offset->fX += rect.fLeft; |
| 230 offset->fY += rect.fTop; | 234 offset->fY += rect.fTop; |
| 231 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res
ult); | 235 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res
ult); |
| 232 #else | 236 #else |
| 233 SkDEBUGFAIL("Should not call in GPU-less build"); | 237 SkDEBUGFAIL("Should not call in GPU-less build"); |
| 234 return false; | 238 return false; |
| 235 #endif | 239 #endif |
| 236 } | 240 } |
| OLD | NEW |