From 280bac1e049bd90896eed57582fdb2601bc2176a Mon Sep 17 00:00:00 2001 From: Stefan Seefeld Date: Sun, 2 Jul 2017 12:34:30 -0400 Subject: [PATCH] Fix compile-time failure. --- include/boost/gil/premultiply.hpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/include/boost/gil/premultiply.hpp b/include/boost/gil/premultiply.hpp index 5b18beb9..89e21922 100644 --- a/include/boost/gil/premultiply.hpp +++ b/include/boost/gil/premultiply.hpp @@ -32,15 +32,28 @@ struct channel_premultiply { DstP & dst_; }; +namespace detail +{ +template +void assign_alpha_if(mpl::true_, SrcP const &src, DstP &dst) +{ + get_color (dst,alpha_t()) = alpha_or_max (src); +}; +template +void assign_alpha_if(mpl::false_, SrcP const &src, DstP &dst) +{ + // nothing to do +}; +} struct premultiply { template void operator()(const SrcP& src, DstP& dst) const { typedef typename color_space_type::type src_colour_space_t; typedef typename color_space_type::type dst_colour_space_t; typedef typename mpl:: remove :: type src_colour_channels; + typedef mpl::bool_::value> has_alpha_t; mpl:: for_each ( channel_premultiply (src, dst) ); - if (mpl:: contains :: value) - get_color (dst,alpha_t()) = alpha_or_max (src); + detail::assign_alpha_if(has_alpha_t(), src, dst); } };