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 } | 22 } |
23 | 23 |
24 SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX, | 24 SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX, |
25 SkScalar sigmaY, | 25 SkScalar sigmaY, |
26 SkImageFilter* input, | 26 SkImageFilter* input, |
27 const SkIRect* cropRect) | 27 const CropRect* cropRect) |
28 : INHERITED(input, cropRect), fSigma(SkSize::Make(sigmaX, sigmaY)) { | 28 : INHERITED(input, cropRect), fSigma(SkSize::Make(sigmaX, sigmaY)) { |
29 SkASSERT(sigmaX >= 0 && sigmaY >= 0); | 29 SkASSERT(sigmaX >= 0 && sigmaY >= 0); |
30 } | 30 } |
31 | 31 |
32 void SkBlurImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { | 32 void SkBlurImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { |
33 this->INHERITED::flatten(buffer); | 33 this->INHERITED::flatten(buffer); |
34 buffer.writeScalar(fSigma.fWidth); | 34 buffer.writeScalar(fSigma.fWidth); |
35 buffer.writeScalar(fSigma.fHeight); | 35 buffer.writeScalar(fSigma.fHeight); |
36 } | 36 } |
37 | 37 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
OLD | NEW |