OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkUnitMappers_DEFINED | 10 #ifndef SkUnitMappers_DEFINED |
(...skipping 10 matching lines...) Expand all Loading... |
21 virtual uint16_t mapUnit16(uint16_t x); | 21 virtual uint16_t mapUnit16(uint16_t x); |
22 | 22 |
23 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscreteMapper) | 23 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscreteMapper) |
24 | 24 |
25 protected: | 25 protected: |
26 SkDiscreteMapper(SkFlattenableReadBuffer& ); | 26 SkDiscreteMapper(SkFlattenableReadBuffer& ); |
27 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; | 27 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
28 | 28 |
29 private: | 29 private: |
30 int fSegments; | 30 int fSegments; |
31 SkFract fScale; // computed from fSegments | 31 int32_t fScale; // computed from fSegments |
32 | 32 |
33 typedef SkUnitMapper INHERITED; | 33 typedef SkUnitMapper INHERITED; |
34 }; | 34 }; |
35 | 35 |
36 /** This returns cos(x), to simulate lighting a sphere, where 0 maps to the | 36 /** This returns cos(x), to simulate lighting a sphere, where 0 maps to the |
37 center of the sphere, and 1 maps to the edge. | 37 center of the sphere, and 1 maps to the edge. |
38 */ | 38 */ |
39 class SkCosineMapper : public SkUnitMapper { | 39 class SkCosineMapper : public SkUnitMapper { |
40 public: | 40 public: |
41 SkCosineMapper() {} | 41 SkCosineMapper() {} |
42 // override from SkUnitMapper | 42 // override from SkUnitMapper |
43 virtual uint16_t mapUnit16(uint16_t x); | 43 virtual uint16_t mapUnit16(uint16_t x); |
44 | 44 |
45 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkCosineMapper) | 45 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkCosineMapper) |
46 | 46 |
47 protected: | 47 protected: |
48 SkCosineMapper(SkFlattenableReadBuffer&); | 48 SkCosineMapper(SkFlattenableReadBuffer&); |
49 | 49 |
50 private: | 50 private: |
51 | 51 |
52 typedef SkUnitMapper INHERITED; | 52 typedef SkUnitMapper INHERITED; |
53 }; | 53 }; |
54 | 54 |
55 #endif | 55 #endif |
OLD | NEW |