OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
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 "SkBlurDrawLooper.h" | 8 #include "SkBlurDrawLooper.h" |
9 #include "SkBlurMask.h" // just for SkBlurMask::ConvertRadiusToSigma | 9 #include "SkBlurMask.h" // just for SkBlurMask::ConvertRadiusToSigma |
10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 SkColor color, uint32_t flags) { | 54 SkColor color, uint32_t flags) { |
55 fSigma = sigma; | 55 fSigma = sigma; |
56 fDx = dx; | 56 fDx = dx; |
57 fDy = dy; | 57 fDy = dy; |
58 fBlurColor = color; | 58 fBlurColor = color; |
59 fBlurFlags = flags; | 59 fBlurFlags = flags; |
60 | 60 |
61 this->initEffects(); | 61 this->initEffects(); |
62 } | 62 } |
63 | 63 |
64 SkFlattenable* SkBlurDrawLooper::CreateProc(SkReadBuffer& buffer) { | 64 sk_sp<SkFlattenable> SkBlurDrawLooper::CreateProc(SkReadBuffer& buffer) { |
65 const SkColor color = buffer.readColor(); | 65 const SkColor color = buffer.readColor(); |
66 const SkScalar sigma = buffer.readScalar(); | 66 const SkScalar sigma = buffer.readScalar(); |
67 const SkScalar dx = buffer.readScalar(); | 67 const SkScalar dx = buffer.readScalar(); |
68 const SkScalar dy = buffer.readScalar(); | 68 const SkScalar dy = buffer.readScalar(); |
69 const uint32_t flags = buffer.read32(); | 69 const uint32_t flags = buffer.read32(); |
70 return Make(color, sigma, dx, dy, flags).release(); | 70 return Make(color, sigma, dx, dy, flags); |
71 } | 71 } |
72 | 72 |
73 void SkBlurDrawLooper::flatten(SkWriteBuffer& buffer) const { | 73 void SkBlurDrawLooper::flatten(SkWriteBuffer& buffer) const { |
74 buffer.writeColor(fBlurColor); | 74 buffer.writeColor(fBlurColor); |
75 buffer.writeScalar(fSigma); | 75 buffer.writeScalar(fSigma); |
76 buffer.writeScalar(fDx); | 76 buffer.writeScalar(fDx); |
77 buffer.writeScalar(fDy); | 77 buffer.writeScalar(fDy); |
78 buffer.write32(fBlurFlags); | 78 buffer.write32(fBlurFlags); |
79 } | 79 } |
80 | 80 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 &needsSeparator); | 173 &needsSeparator); |
174 SkAddFlagToString(str, SkToBool(kHighQuality_BlurFlag & fBlurFlags), "Hi
ghQuality", | 174 SkAddFlagToString(str, SkToBool(kHighQuality_BlurFlag & fBlurFlags), "Hi
ghQuality", |
175 &needsSeparator); | 175 &needsSeparator); |
176 } | 176 } |
177 str->append(")"); | 177 str->append(")"); |
178 | 178 |
179 // TODO: add optional "fBlurFilter->toString(str);" when SkMaskFilter::toStr
ing is added | 179 // TODO: add optional "fBlurFilter->toString(str);" when SkMaskFilter::toStr
ing is added |
180 // alternatively we could cache the radius in SkBlurDrawLooper and just add
it here | 180 // alternatively we could cache the radius in SkBlurDrawLooper and just add
it here |
181 } | 181 } |
182 #endif | 182 #endif |
OLD | NEW |