Index: head/games/freeorion/files/patch-boost168 =================================================================== --- head/games/freeorion/files/patch-boost168 (revision 476413) +++ head/games/freeorion/files/patch-boost168 (revision 476414) @@ -1,168 +1,149 @@ -https://github.com/freeorion/freeorion/pull/2221 +https://github.com/freeorion/freeorion/pull/2241 ---- GG/CMakeLists.txt.orig 2018-06-14 14:12:09 UTC -+++ GG/CMakeLists.txt -@@ -144,6 +144,16 @@ if(USE_STATIC_LIBS) - ) - endif() - -+target_compile_definitions(GiGi -+ PRIVATE -+ -+ # Starting with boost 1.68 boost::gil integrates support for -+ # grayscale-alpha png images, so prefer their implementation -+ # instead of our hacky gilext code. -+ $<$:GIGI_CONFIG_USE_OLD_IMPLEMENTATION_OF_GIL_PNG_IO> -+ $<$:BOOST_GIL_IO_ENABLE_GRAY_ALPHA> -+) -+ - target_include_directories(GiGi SYSTEM - PRIVATE - ${Boost_INCLUDE_DIRS} --- GG/src/GUI.cpp.orig 2018-06-14 14:12:09 UTC +++ GG/src/GUI.cpp @@ -37,14 +37,19 @@ #include #if GG_HAVE_LIBPNG -# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 7) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wunused-local-typedefs" -+# if GIGI_CONFIG_USE_OLD_IMPLEMENTATION_OF_GIL_PNG_IO ++# if BOOST_VERSION < 106800 +# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 7) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-local-typedefs" +# endif +# include "gilext/io/png_io.hpp" +# include "gilext/io/png_io_v2_compat.hpp" +# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 7) +# pragma GCC diagnostic pop +# endif +# else +# include # endif -# include "gilext/io/png_io.hpp" -# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 7) -# pragma GCC diagnostic pop -# endif #endif #include @@ -132,12 +137,15 @@ namespace { glPopClientAttrib(); using namespace boost::gil; - png_write_view(filename, - flipped_up_down_view( - interleaved_view(Value(size.x), - Value(size.y), - static_cast(static_cast(&bytes[0])), - Value(size.x) * sizeof(rgba8_pixel_t)))); + write_view( + filename, + flipped_up_down_view( + interleaved_view( + Value(size.x), + Value(size.y), + static_cast(static_cast(&bytes[0])), + Value(size.x) * sizeof(rgba8_pixel_t))), + png_tag()); #endif } } --- GG/src/Texture.cpp.orig 2018-06-14 14:12:09 UTC +++ GG/src/Texture.cpp @@ -36,7 +36,12 @@ #include #if GG_HAVE_LIBPNG -# include "gilext/io/png_dynamic_io.hpp" -+# if GIGI_CONFIG_USE_OLD_IMPLEMENTATION_OF_GIL_PNG_IO ++# if BOOST_VERSION < 106800 +# include "gilext/io/png_dynamic_io.hpp" +# include "gilext/io/png_io_v2_compat.hpp" +# else +# include +# endif #endif #include @@ -241,12 +246,12 @@ void Texture::Load(const boost::filesystem::path& path // formats above. #if GG_HAVE_LIBPNG if (extension == ".png") - gil::png_read_image(path, image); + gil::read_image(filename, image, gil::image_read_settings()); else #endif #if GG_HAVE_LIBTIFF if (extension == ".tif" || extension == ".tiff") - gil::tiff_read_image(filename, image); + gil::read_image(filename, image, gil::image_read_settings()); else #endif throw BadFile("Texture file \"" + filename + "\" does not have a supported file extension"); @@ -256,14 +261,14 @@ void Texture::Load(const boost::filesystem::path& path #if GG_HAVE_LIBPNG if (extension == ".png") { gil::rgba8_image_t rgba_image; - gil::png_read_and_convert_image(path, rgba_image); + gil::read_and_convert_image(filename, rgba_image, gil::image_read_settings()); image.move_in(rgba_image); } #endif #if GG_HAVE_LIBTIFF if (extension == ".tif" || extension == ".tiff") { gil::rgba8_image_t rgba_image; - gil::tiff_read_and_convert_image(filename, rgba_image); + gil::read_and_convert_image(filename, rgba_image, gil::image_read_settings()); image.move_in(rgba_image); } #endif --- GG/src/gilext/io/png_io_v2_compat.hpp.orig 2018-07-20 13:44:48 UTC +++ GG/src/gilext/io/png_io_v2_compat.hpp @@ -0,0 +1,45 @@ +#ifndef GILEXT_PNG_IO_V2_COMPAT_H +#define GILEXT_PNG_IO_V2_COMPAT_H + +namespace boost { namespace gil { + +struct png_tag {}; + +template< typename Tag> +struct image_read_settings {}; + +template< typename String + , typename Image + , typename FormatTag + > +inline +void read_image( const String& file_name + , Image& image + , const FormatTag& tag + ) +{ boost::gil::png_read_image(file_name, image); } + +template< typename String + , typename Image + , typename FormatTag + > +inline +void read_and_convert_image( const String& file_name + , Image& image + , const FormatTag& tag + ) +{ boost::gil::png_read_and_convert_image(file_name, image); } +} } + +template< typename String + , typename View + , typename FormatTag + > +inline +void write_view( const String& file_name + , const View& view + , const FormatTag& tag + ) +{ boost::gil::png_write_view( file_name, view); } + +#endif