summaryrefslogtreecommitdiff
path: root/boost/gil/io/row_buffer_helper.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/gil/io/row_buffer_helper.hpp')
-rw-r--r--boost/gil/io/row_buffer_helper.hpp70
1 files changed, 36 insertions, 34 deletions
diff --git a/boost/gil/io/row_buffer_helper.hpp b/boost/gil/io/row_buffer_helper.hpp
index f9ab1e13ed..e06b98363b 100644
--- a/boost/gil/io/row_buffer_helper.hpp
+++ b/boost/gil/io/row_buffer_helper.hpp
@@ -1,29 +1,25 @@
-/*
- Copyright 2007-2008 Christian Henning
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-*/
-
-/*************************************************************************************************/
-
+//
+// Copyright 2007-2008 Christian Henning
+//
+// Distributed under the Boost Software License, Version 1.0
+// See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+//
#ifndef BOOST_GIL_IO_ROW_BUFFER_HELPER_HPP
#define BOOST_GIL_IO_ROW_BUFFER_HELPER_HPP
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief Helper for having one read implementation used for
-/// bit_aligned and byte images.
-/// \author Christian Henning, Andreas Pokorny, Lubomir Bourdev \n
-///
-/// \date 2007-2008 \n
-///
-////////////////////////////////////////////////////////////////////////////////////////
-
+// TODO: Shall we move toolbox to core?
#include <boost/gil/extension/toolbox/metafunctions/is_bit_aligned.hpp>
+#include <boost/gil/extension/toolbox/metafunctions/is_homogeneous.hpp>
+#include <boost/gil/extension/toolbox/metafunctions/pixel_bit_size.hpp>
#include <boost/gil/io/typedefs.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#include <cstddef>
+#include <vector>
namespace boost { namespace gil { namespace detail {
@@ -67,10 +63,10 @@ struct row_buffer_helper< Pixel
row_buffer_helper( std::size_t width
, bool in_bytes
)
- : _c( ( width
+ : _c( ( width
* pixel_bit_size< pixel_type >::value
)
- >> 3
+ >> 3
)
, _r( width
@@ -111,13 +107,19 @@ private:
buffer_t _row_buffer;
};
-template<typename Pixel >
-struct row_buffer_helper< Pixel
- , typename boost::enable_if< typename mpl::and_< typename is_bit_aligned< Pixel >::type
- , typename is_homogeneous< Pixel >::type
- >::type
- >
- >
+template<typename Pixel>
+struct row_buffer_helper
+<
+ Pixel,
+ typename boost::enable_if
+ <
+ typename mpl::and_
+ <
+ typename is_bit_aligned<Pixel>::type,
+ typename is_homogeneous<Pixel>::type
+ >::type
+ >
+>
{
typedef byte_t element_t;
typedef std::vector< element_t > buffer_t;
@@ -127,16 +129,16 @@ struct row_buffer_helper< Pixel
row_buffer_helper( std::size_t width
, bool in_bytes
)
- : _c( ( width
+ : _c( ( width
* num_channels< pixel_type >::type::value
* channel_type< pixel_type >::type::num_bits
)
- >> 3
+ >> 3
)
, _r( width
- * num_channels< pixel_type >::type::value
- * channel_type< pixel_type >::type::num_bits
+ * num_channels< pixel_type >::type::value
+ * channel_type< pixel_type >::type::num_bits
- ( _c << 3 )
)
{
@@ -190,14 +192,14 @@ struct row_buffer_helper_view : row_buffer_helper< typename View::value_type >
template< typename View >
struct row_buffer_helper_view< View
- , typename enable_if< typename is_bit_aligned< typename View::value_type
+ , typename enable_if< typename is_bit_aligned< typename View::value_type
>::type
>::type
> : row_buffer_helper< typename View::reference >
{
row_buffer_helper_view( std::size_t width
, bool in_bytes
- )
+ )
: row_buffer_helper< typename View::reference >( width
, in_bytes
)