update boost
This commit is contained in:
@@ -62,12 +62,13 @@ private:
|
||||
{
|
||||
if( png_ptr )
|
||||
{
|
||||
BOOST_ASSERT(png_ptr->_struct && png_ptr->_info);
|
||||
|
||||
png_destroy_read_struct( &png_ptr->_struct
|
||||
, &png_ptr->_info
|
||||
, nullptr
|
||||
);
|
||||
if( png_ptr->_struct && png_ptr->_info )
|
||||
{
|
||||
png_destroy_read_struct( &png_ptr->_struct
|
||||
, &png_ptr->_info
|
||||
, nullptr
|
||||
);
|
||||
}
|
||||
|
||||
delete png_ptr;
|
||||
png_ptr = nullptr;
|
||||
@@ -78,11 +79,12 @@ private:
|
||||
{
|
||||
if( png_ptr )
|
||||
{
|
||||
BOOST_ASSERT(png_ptr->_struct && png_ptr->_info);
|
||||
|
||||
png_destroy_write_struct( &png_ptr->_struct
|
||||
, &png_ptr->_info
|
||||
);
|
||||
if( png_ptr->_struct && png_ptr->_info )
|
||||
{
|
||||
png_destroy_write_struct( &png_ptr->_struct
|
||||
, &png_ptr->_info
|
||||
);
|
||||
}
|
||||
|
||||
delete png_ptr;
|
||||
png_ptr = nullptr;
|
||||
|
||||
@@ -10,14 +10,13 @@
|
||||
|
||||
#include <boost/gil/extension/io/png/tags.hpp>
|
||||
|
||||
#include <boost/mpl/bool_fwd.hpp>
|
||||
#include <boost/mpl/for_each.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace gil { namespace detail {
|
||||
|
||||
template< typename View >
|
||||
bool is_allowed( const image_read_info< png_tag >& info
|
||||
, mpl::true_ // is read_and_no_convert
|
||||
, std::true_type // is read_and_no_convert
|
||||
)
|
||||
{
|
||||
using pixel_t = typename get_pixel_type<View>::type;
|
||||
@@ -33,7 +32,7 @@ bool is_allowed( const image_read_info< png_tag >& info
|
||||
|
||||
template< typename View >
|
||||
bool is_allowed( const image_read_info< png_tag >& /* info */
|
||||
, mpl::false_ // is read_and_convert
|
||||
, std::false_type // is read_and_convert
|
||||
)
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -13,14 +13,17 @@
|
||||
#include <boost/gil/extension/io/png/detail/is_allowed.hpp>
|
||||
|
||||
#include <boost/gil.hpp> // FIXME: Include what you use!
|
||||
#include <boost/gil/io/detail/dynamic.hpp>
|
||||
#include <boost/gil/io/base.hpp>
|
||||
#include <boost/gil/io/conversion_policies.hpp>
|
||||
#include <boost/gil/io/device.hpp>
|
||||
#include <boost/gil/io/dynamic_io_new.hpp>
|
||||
#include <boost/gil/io/error.hpp>
|
||||
#include <boost/gil/io/reader_base.hpp>
|
||||
#include <boost/gil/io/row_buffer_helper.hpp>
|
||||
#include <boost/gil/io/typedefs.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace gil {
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
@@ -81,6 +84,12 @@ public:
|
||||
template< typename View >
|
||||
void apply( const View& view )
|
||||
{
|
||||
// guard from errors in the following functions
|
||||
if (setjmp( png_jmpbuf( this->get_struct() )))
|
||||
{
|
||||
io_error("png is invalid");
|
||||
}
|
||||
|
||||
// The info structures are filled at this point.
|
||||
|
||||
// Now it's time for some transformations.
|
||||
@@ -184,7 +193,7 @@ public:
|
||||
default: io_error( "png_reader::read_data(): unknown combination of color type and bit depth" );
|
||||
}
|
||||
#else
|
||||
io_error( "gray_alpha isn't enabled. Use ENABLE_GRAY_ALPHA when building application." );
|
||||
io_error( "gray_alpha isn't enabled. Define BOOST_GIL_IO_ENABLE_GRAY_ALPHA when building application." );
|
||||
#endif // BOOST_GIL_IO_ENABLE_GRAY_ALPHA
|
||||
|
||||
|
||||
@@ -228,11 +237,17 @@ private:
|
||||
>
|
||||
void read_rows( const View& view )
|
||||
{
|
||||
// guard from errors in the following functions
|
||||
if (setjmp( png_jmpbuf( this->get_struct() )))
|
||||
{
|
||||
io_error("png is invalid");
|
||||
}
|
||||
|
||||
using row_buffer_helper_t = detail::row_buffer_helper_view<ImagePixel>;
|
||||
|
||||
using it_t = typename row_buffer_helper_t::iterator_t;
|
||||
|
||||
using is_read_and_convert_t = typename is_same
|
||||
using is_read_and_convert_t = typename std::is_same
|
||||
<
|
||||
ConversionPolicy,
|
||||
detail::read_and_no_convert
|
||||
@@ -394,14 +409,14 @@ public:
|
||||
)
|
||||
{}
|
||||
|
||||
template< typename Images >
|
||||
void apply( any_image< Images >& images )
|
||||
template< typename ...Images >
|
||||
void apply( any_image< Images... >& images )
|
||||
{
|
||||
detail::png_type_format_checker format_checker( this->_info._bit_depth
|
||||
, this->_info._color_type
|
||||
);
|
||||
|
||||
if( !construct_matched( images
|
||||
if( !detail::construct_matched( images
|
||||
, format_checker
|
||||
))
|
||||
{
|
||||
@@ -417,8 +432,8 @@ public:
|
||||
, parent_t
|
||||
> op( this );
|
||||
|
||||
apply_operation( view( images )
|
||||
, op
|
||||
variant2::visit( op
|
||||
, view( images )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -601,7 +601,7 @@ public:
|
||||
}
|
||||
|
||||
/// Check if image is large enough.
|
||||
void check_image_size( const point_t& img_dim )
|
||||
void check_image_size( point_t const& img_dim )
|
||||
{
|
||||
if( _settings._dim.x > 0 )
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#endif // BOOST_GIL_IO_ENABLE_GRAY_ALPHA
|
||||
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost { namespace gil { namespace detail {
|
||||
|
||||
@@ -318,14 +319,17 @@ struct png_write_support<uint16_t
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template< typename Pixel >
|
||||
struct is_read_supported< Pixel
|
||||
, png_tag
|
||||
>
|
||||
: mpl::bool_< detail::png_read_support< typename channel_type< Pixel >::type
|
||||
, typename color_space_type< Pixel >::type
|
||||
>::is_supported
|
||||
>
|
||||
template<typename Pixel>
|
||||
struct is_read_supported<Pixel, png_tag>
|
||||
: std::integral_constant
|
||||
<
|
||||
bool,
|
||||
detail::png_read_support
|
||||
<
|
||||
typename channel_type<Pixel>::type,
|
||||
typename color_space_type<Pixel>::type
|
||||
>::is_supported
|
||||
>
|
||||
{
|
||||
using parent_t = detail::png_read_support
|
||||
<
|
||||
@@ -337,14 +341,17 @@ struct is_read_supported< Pixel
|
||||
static const png_color_type::type _color_type = parent_t::_color_type;
|
||||
};
|
||||
|
||||
template< typename Pixel >
|
||||
struct is_write_supported< Pixel
|
||||
, png_tag
|
||||
>
|
||||
: mpl::bool_< detail::png_write_support< typename channel_type< Pixel >::type
|
||||
, typename color_space_type< Pixel >::type
|
||||
>::is_supported
|
||||
>
|
||||
template<typename Pixel>
|
||||
struct is_write_supported<Pixel, png_tag>
|
||||
: std::integral_constant
|
||||
<
|
||||
bool,
|
||||
detail::png_write_support
|
||||
<
|
||||
typename channel_type<Pixel>::type,
|
||||
typename color_space_type<Pixel>::type
|
||||
>::is_supported
|
||||
>
|
||||
{
|
||||
using parent_t = detail::png_write_support
|
||||
<
|
||||
|
||||
@@ -11,13 +11,9 @@
|
||||
#include <boost/gil/extension/io/png/detail/writer_backend.hpp>
|
||||
|
||||
#include <boost/gil/io/device.hpp>
|
||||
#include <boost/gil/io/dynamic_io_new.hpp>
|
||||
#include <boost/gil/io/detail/dynamic.hpp>
|
||||
#include <boost/gil/io/row_buffer_helper.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/less.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/gil/detail/mp11.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
@@ -85,7 +81,7 @@ private:
|
||||
|
||||
template<typename View>
|
||||
void write_view( const View& view
|
||||
, mpl::false_ // is bit aligned
|
||||
, std::false_type // is bit aligned
|
||||
)
|
||||
{
|
||||
using pixel_t = typename get_pixel_type<View>::type;
|
||||
@@ -125,7 +121,7 @@ private:
|
||||
|
||||
template<typename View>
|
||||
void write_view( const View& view
|
||||
, mpl::true_ // is bit aligned
|
||||
, std::true_type // is bit aligned
|
||||
)
|
||||
{
|
||||
using png_rw_info = detail::png_write_support
|
||||
@@ -166,8 +162,35 @@ private:
|
||||
);
|
||||
}
|
||||
|
||||
template< typename Info > struct is_less_than_eight : mpl::less< mpl::int_< Info::_bit_depth >, mpl::int_< 8 > > {};
|
||||
template< typename Info > struct is_equal_to_sixteen : mpl::equal_to< mpl::int_< Info::_bit_depth >, mpl::int_< 16 > > {};
|
||||
template<typename Info>
|
||||
struct is_less_than_eight : mp11::mp_less
|
||||
<
|
||||
std::integral_constant<int, Info::_bit_depth>,
|
||||
std::integral_constant<int, 8>
|
||||
>
|
||||
{};
|
||||
|
||||
template<typename Info>
|
||||
struct is_equal_to_sixteen : mp11::mp_and
|
||||
<
|
||||
mp11::mp_not
|
||||
<
|
||||
mp11::mp_less
|
||||
<
|
||||
std::integral_constant<int, Info::_bit_depth>,
|
||||
std::integral_constant<int, 16>
|
||||
>
|
||||
>,
|
||||
mp11::mp_not
|
||||
<
|
||||
mp11::mp_less
|
||||
<
|
||||
std::integral_constant<int, 16>,
|
||||
std::integral_constant<int, Info::_bit_depth>
|
||||
>
|
||||
>
|
||||
>
|
||||
{};
|
||||
|
||||
template <typename Info>
|
||||
void set_swap(typename std::enable_if<is_less_than_eight<Info>::value>::type* /*ptr*/ = 0)
|
||||
@@ -185,10 +208,10 @@ private:
|
||||
void set_swap(
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
mp11::mp_and
|
||||
<
|
||||
mpl::not_<is_less_than_eight<Info>>,
|
||||
mpl::not_<is_equal_to_sixteen<Info>>
|
||||
mp11::mp_not<is_less_than_eight<Info>>,
|
||||
mp11::mp_not<is_equal_to_sixteen<Info>>
|
||||
>::value
|
||||
>::type* /*ptr*/ = nullptr)
|
||||
{
|
||||
@@ -218,14 +241,14 @@ public:
|
||||
)
|
||||
{}
|
||||
|
||||
template< typename Views >
|
||||
void apply( const any_image_view< Views >& views )
|
||||
template< typename ...Views >
|
||||
void apply( const any_image_view< Views... >& views )
|
||||
{
|
||||
detail::dynamic_io_fnobj< detail::png_write_is_supported
|
||||
, parent_t
|
||||
> op( this );
|
||||
|
||||
apply_operation( views, op );
|
||||
variant2::visit( op, views );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user