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 20 matching lines...) Expand all Loading... |
31 buffer.validate(SkScalarIsFinite(fSigma.fWidth) && | 31 buffer.validate(SkScalarIsFinite(fSigma.fWidth) && |
32 SkScalarIsFinite(fSigma.fHeight) && | 32 SkScalarIsFinite(fSigma.fHeight) && |
33 (fSigma.fWidth >= 0) && | 33 (fSigma.fWidth >= 0) && |
34 (fSigma.fHeight >= 0)); | 34 (fSigma.fHeight >= 0)); |
35 } | 35 } |
36 #endif | 36 #endif |
37 | 37 |
38 SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX, | 38 SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX, |
39 SkScalar sigmaY, | 39 SkScalar sigmaY, |
40 SkImageFilter* input, | 40 SkImageFilter* input, |
41 const CropRect* cropRect) | 41 const CropRect* cropRect, |
42 : INHERITED(1, &input, cropRect), fSigma(SkSize::Make(sigmaX, sigmaY)) { | 42 uint32_t uniqueID) |
43 SkASSERT(sigmaX >= 0 && sigmaY >= 0); | 43 : INHERITED(1, &input, cropRect, uniqueID), fSigma(SkSize::Make(sigmaX, sigm
aY)) { |
44 } | 44 } |
45 | 45 |
46 SkFlattenable* SkBlurImageFilter::CreateProc(SkReadBuffer& buffer) { | 46 SkFlattenable* SkBlurImageFilter::CreateProc(SkReadBuffer& buffer) { |
47 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 47 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
48 SkScalar sigmaX = buffer.readScalar(); | 48 SkScalar sigmaX = buffer.readScalar(); |
49 SkScalar sigmaY = buffer.readScalar(); | 49 SkScalar sigmaY = buffer.readScalar(); |
50 return Create(sigmaX, sigmaY, common.getInput(0), &common.cropRect()); | 50 return Create(sigmaX, sigmaY, common.getInput(0), &common.cropRect(), common
.uniqueID()); |
51 } | 51 } |
52 | 52 |
53 void SkBlurImageFilter::flatten(SkWriteBuffer& buffer) const { | 53 void SkBlurImageFilter::flatten(SkWriteBuffer& buffer) const { |
54 this->INHERITED::flatten(buffer); | 54 this->INHERITED::flatten(buffer); |
55 buffer.writeScalar(fSigma.fWidth); | 55 buffer.writeScalar(fSigma.fWidth); |
56 buffer.writeScalar(fSigma.fHeight); | 56 buffer.writeScalar(fSigma.fHeight); |
57 } | 57 } |
58 | 58 |
59 enum BlurDirection { | 59 enum BlurDirection { |
60 kX, kY | 60 kX, kY |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 true, | 291 true, |
292 sigma.x(), | 292 sigma.x(), |
293 sigma.y())); | 293 sigma.y())); |
294 WrapTexture(tex, rect.width(), rect.height(), result); | 294 WrapTexture(tex, rect.width(), rect.height(), result); |
295 return true; | 295 return true; |
296 #else | 296 #else |
297 SkDEBUGFAIL("Should not call in GPU-less build"); | 297 SkDEBUGFAIL("Should not call in GPU-less build"); |
298 return false; | 298 return false; |
299 #endif | 299 #endif |
300 } | 300 } |
OLD | NEW |