OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkDisplacementMapEffect.h" | 8 #include "SkDisplacementMapEffect.h" |
9 #include "SkReadBuffer.h" | 9 #include "SkReadBuffer.h" |
10 #include "SkWriteBuffer.h" | 10 #include "SkWriteBuffer.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 : INHERITED(2, inputs, cropRect, uniqueID) | 185 : INHERITED(2, inputs, cropRect, uniqueID) |
186 , fXChannelSelector(xChannelSelector) | 186 , fXChannelSelector(xChannelSelector) |
187 , fYChannelSelector(yChannelSelector) | 187 , fYChannelSelector(yChannelSelector) |
188 , fScale(scale) | 188 , fScale(scale) |
189 { | 189 { |
190 } | 190 } |
191 | 191 |
192 SkDisplacementMapEffect::~SkDisplacementMapEffect() { | 192 SkDisplacementMapEffect::~SkDisplacementMapEffect() { |
193 } | 193 } |
194 | 194 |
195 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | |
196 SkDisplacementMapEffect::SkDisplacementMapEffect(SkReadBuffer& buffer) | |
197 : INHERITED(2, buffer) | |
198 { | |
199 fXChannelSelector = (SkDisplacementMapEffect::ChannelSelectorType) buffer.re
adInt(); | |
200 fYChannelSelector = (SkDisplacementMapEffect::ChannelSelectorType) buffer.re
adInt(); | |
201 fScale = buffer.readScalar(); | |
202 buffer.validate(channel_selector_type_is_valid(fXChannelSelector) && | |
203 channel_selector_type_is_valid(fYChannelSelector) && | |
204 SkScalarIsFinite(fScale)); | |
205 } | |
206 #endif | |
207 | |
208 SkFlattenable* SkDisplacementMapEffect::CreateProc(SkReadBuffer& buffer) { | 195 SkFlattenable* SkDisplacementMapEffect::CreateProc(SkReadBuffer& buffer) { |
209 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 2); | 196 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 2); |
210 ChannelSelectorType xsel = (ChannelSelectorType)buffer.readInt(); | 197 ChannelSelectorType xsel = (ChannelSelectorType)buffer.readInt(); |
211 ChannelSelectorType ysel = (ChannelSelectorType)buffer.readInt(); | 198 ChannelSelectorType ysel = (ChannelSelectorType)buffer.readInt(); |
212 SkScalar scale = buffer.readScalar(); | 199 SkScalar scale = buffer.readScalar(); |
213 return Create(xsel, ysel, scale, common.getInput(0), common.getInput(1), &co
mmon.cropRect(), common.uniqueID()); | 200 return Create(xsel, ysel, scale, common.getInput(0), common.getInput(1), &co
mmon.cropRect(), common.uniqueID()); |
214 } | 201 } |
215 | 202 |
216 void SkDisplacementMapEffect::flatten(SkWriteBuffer& buffer) const { | 203 void SkDisplacementMapEffect::flatten(SkWriteBuffer& buffer) const { |
217 this->INHERITED::flatten(buffer); | 204 this->INHERITED::flatten(buffer); |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, | 615 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, |
629 const GrGLCaps&, GrProcessorKeyBuilder* b
) { | 616 const GrGLCaps&, GrProcessorKeyBuilder* b
) { |
630 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 617 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
631 | 618 |
632 uint32_t xKey = displacementMap.xChannelSelector(); | 619 uint32_t xKey = displacementMap.xChannelSelector(); |
633 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 620 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
634 | 621 |
635 b->add32(xKey | yKey); | 622 b->add32(xKey | yKey); |
636 } | 623 } |
637 #endif | 624 #endif |
OLD | NEW |