Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | |
michael@0 | 2 | /* |
michael@0 | 3 | * Copyright 2008 The Android Open Source Project |
michael@0 | 4 | * |
michael@0 | 5 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 6 | * found in the LICENSE file. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | |
michael@0 | 10 | #ifndef SkUnitMappers_DEFINED |
michael@0 | 11 | #define SkUnitMappers_DEFINED |
michael@0 | 12 | |
michael@0 | 13 | #include "SkUnitMapper.h" |
michael@0 | 14 | |
michael@0 | 15 | /** This discretizes the range [0...1) into N discret values. |
michael@0 | 16 | */ |
michael@0 | 17 | class SkDiscreteMapper : public SkUnitMapper { |
michael@0 | 18 | public: |
michael@0 | 19 | SkDiscreteMapper(int segments); |
michael@0 | 20 | // override from SkUnitMapper |
michael@0 | 21 | virtual uint16_t mapUnit16(uint16_t x); |
michael@0 | 22 | |
michael@0 | 23 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscreteMapper) |
michael@0 | 24 | |
michael@0 | 25 | protected: |
michael@0 | 26 | SkDiscreteMapper(SkReadBuffer& ); |
michael@0 | 27 | virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
michael@0 | 28 | |
michael@0 | 29 | private: |
michael@0 | 30 | int fSegments; |
michael@0 | 31 | int32_t fScale; // computed from fSegments |
michael@0 | 32 | |
michael@0 | 33 | typedef SkUnitMapper INHERITED; |
michael@0 | 34 | }; |
michael@0 | 35 | |
michael@0 | 36 | /** This returns cos(x), to simulate lighting a sphere, where 0 maps to the |
michael@0 | 37 | center of the sphere, and 1 maps to the edge. |
michael@0 | 38 | */ |
michael@0 | 39 | class SkCosineMapper : public SkUnitMapper { |
michael@0 | 40 | public: |
michael@0 | 41 | SkCosineMapper() {} |
michael@0 | 42 | // override from SkUnitMapper |
michael@0 | 43 | virtual uint16_t mapUnit16(uint16_t x); |
michael@0 | 44 | |
michael@0 | 45 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkCosineMapper) |
michael@0 | 46 | |
michael@0 | 47 | protected: |
michael@0 | 48 | SkCosineMapper(SkReadBuffer&); |
michael@0 | 49 | |
michael@0 | 50 | private: |
michael@0 | 51 | |
michael@0 | 52 | typedef SkUnitMapper INHERITED; |
michael@0 | 53 | }; |
michael@0 | 54 | |
michael@0 | 55 | #endif |