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 if ((fSigma.fWidth < 0) || (fSigma.fHeight < 0)) { | |
23 buffer.setError(kInvalidArgument_SkError); | |
reed1
2013/08/21 15:49:24
should we set fSigma to (0,0) to be "safe" now tha
sugoi1
2013/08/21 16:52:36
I can do that, but it comes back to the original q
| |
24 } | |
22 } | 25 } |
23 | 26 |
24 SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX, | 27 SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX, |
25 SkScalar sigmaY, | 28 SkScalar sigmaY, |
26 SkImageFilter* input, | 29 SkImageFilter* input, |
27 const SkIRect* cropRect) | 30 const SkIRect* cropRect) |
28 : INHERITED(input, cropRect), fSigma(SkSize::Make(sigmaX, sigmaY)) { | 31 : INHERITED(input, cropRect), fSigma(SkSize::Make(sigmaX, sigmaY)) { |
29 SkASSERT(sigmaX >= 0 && sigmaY >= 0); | 32 SkASSERT(sigmaX >= 0 && sigmaY >= 0); |
30 } | 33 } |
31 | 34 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 fSigma.width(), | 230 fSigma.width(), |
228 fSigma.height())); | 231 fSigma.height())); |
229 offset->fX += rect.fLeft; | 232 offset->fX += rect.fLeft; |
230 offset->fY += rect.fTop; | 233 offset->fY += rect.fTop; |
231 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res ult); | 234 return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), res ult); |
232 #else | 235 #else |
233 SkDEBUGFAIL("Should not call in GPU-less build"); | 236 SkDEBUGFAIL("Should not call in GPU-less build"); |
234 return false; | 237 return false; |
235 #endif | 238 #endif |
236 } | 239 } |
OLD | NEW |