diff options
Diffstat (limited to 'basebmp/inc/basebmp/truecolormaskaccessor.hxx')
-rw-r--r-- | basebmp/inc/basebmp/truecolormaskaccessor.hxx | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/basebmp/inc/basebmp/truecolormaskaccessor.hxx b/basebmp/inc/basebmp/truecolormaskaccessor.hxx index 79693a7b0ebb..efe80820fa3e 100644 --- a/basebmp/inc/basebmp/truecolormaskaccessor.hxx +++ b/basebmp/inc/basebmp/truecolormaskaccessor.hxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -40,15 +40,15 @@ namespace basebmp { -namespace +namespace { - /// Shift left for positive shift value, and right otherwise + /// Shift left for positive shift value, and right otherwise template< typename T > inline T shiftLeft( T v, int shift ) { return shift > 0 ? v << shift : v >> (-shift); } - /// Shift right for positive shift value, and left otherwise + /// Shift right for positive shift value, and left otherwise template< typename T > inline T shiftRight( T v, int shift ) { return shift > 0 ? v >> shift : v << (-shift); @@ -76,7 +76,7 @@ namespace When true, the final pixel values will be byte-swapped before passed to/from the iterator. */ -template< class Accessor, +template< class Accessor, typename ColorType, int RedMask, int GreenMask, @@ -95,11 +95,11 @@ private: template<class A, typename C, int R, int G, int B, bool S> friend class TrueColorMaskAccessor; #endif - Accessor maAccessor; + Accessor maAccessor; public: // calc corrective shifts for all three channels in advance - enum { + enum { red_shift = numberOfTrailingZeros<RedMask>::value, green_shift = numberOfTrailingZeros<GreenMask>::value, blue_shift = numberOfTrailingZeros<BlueMask>::value, @@ -115,13 +115,13 @@ public: maAccessor() {} - template< class A > explicit + template< class A > explicit TrueColorMaskAccessor( TrueColorMaskAccessor< A, ColorType, RedMask, GreenMask, BlueMask, - SwapBytes > const& rSrc ) : + SwapBytes > const& rSrc ) : maAccessor( rSrc.maAccessor ) {} @@ -144,16 +144,16 @@ public: const unsigned_data_type green(v & GreenMask); const unsigned_data_type blue (v & BlueMask); - value_type res( (shiftRight(red, + value_type res( (shiftRight(red, red_shift-8*sizeof(component_type)+red_bits)) | (shiftRight(red, red_shift-8*sizeof(component_type)+2*red_bits)), - + (shiftRight(green, green_shift-8*sizeof(component_type)+green_bits)) | (shiftRight(green, green_shift-8*sizeof(component_type)+2*green_bits)), - + (shiftRight(blue, blue_shift-8*sizeof(component_type)+blue_bits)) | (shiftRight(blue, @@ -167,7 +167,7 @@ public: const unsigned_data_type green(v.getGreen()); const unsigned_data_type blue (v.getBlue()); - unsigned_data_type res( + unsigned_data_type res( (shiftLeft(red, red_shift-8*sizeof(component_type)+red_bits) & RedMask) | (shiftLeft(green, @@ -181,10 +181,10 @@ public: // ------------------------------------------------------- template< class Iterator > - value_type operator()(Iterator const& i) const - { - return toValue( - unsigned_cast<data_type>( maAccessor(i)) ); + value_type operator()(Iterator const& i) const + { + return toValue( + unsigned_cast<data_type>( maAccessor(i)) ); } template< class Iterator, class Difference > @@ -198,7 +198,7 @@ public: template< typename V, class Iterator > void set(V const& value, Iterator const& i) const - { + { maAccessor.set( toPacked( vigra::detail::RequiresExplicitCast<value_type>::cast( @@ -209,10 +209,10 @@ public: template< typename V, class Iterator, class Difference > void set(V const& value, Iterator const& i, Difference const& diff) const { - maAccessor.set( + maAccessor.set( toPacked( vigra::detail::RequiresExplicitCast<value_type>::cast( - value)), + value)), i, diff ); } @@ -221,7 +221,7 @@ public: //----------------------------------------------------------------------------- /** Convert Color to packed true color value for TrueColorMaskAccessor - */ + */ template< class Accessor > struct ColorConvert { typename Accessor::data_type operator()( const Accessor& acc, @@ -234,13 +234,13 @@ template< class Accessor > struct ColorConvert //----------------------------------------------------------------------------- // partial specialization for TrueColorMaskAccessor -template< class Accessor, +template< class Accessor, typename ColorType, int RedMask, int GreenMask, int BlueMask, - bool SwapBytes > struct AccessorTraits< - TrueColorMaskAccessor< Accessor, + bool SwapBytes > struct AccessorTraits< + TrueColorMaskAccessor< Accessor, ColorType, RedMask, GreenMask, @@ -248,7 +248,7 @@ template< class Accessor, SwapBytes > > { /// value type of described accessor - typedef typename TrueColorMaskAccessor< Accessor, + typedef typename TrueColorMaskAccessor< Accessor, ColorType, RedMask, GreenMask, @@ -256,7 +256,7 @@ template< class Accessor, SwapBytes >::value_type value_type; /// Retrieve stand-alone color lookup function for given Accessor type - typedef ColorConvert< TrueColorMaskAccessor< Accessor, + typedef ColorConvert< TrueColorMaskAccessor< Accessor, ColorType, RedMask, GreenMask, @@ -278,7 +278,7 @@ template< class Accessor, * want to wrap a masked_accessor with a TrueColorMaskAccessor, * not the other way around. */ - template< class MaskAccessor, + template< class MaskAccessor, class Iterator, class MaskIterator > struct masked_accessor { |