diff --git a/include/mapnik/span_image_filter.hpp b/include/mapnik/span_image_filter.hpp index ccfd0c347..1a056198f 100644 --- a/include/mapnik/span_image_filter.hpp +++ b/include/mapnik/span_image_filter.hpp @@ -30,6 +30,8 @@ #include +#include + namespace mapnik { @@ -140,19 +142,7 @@ public: } else { - fg /= total_weight; - if (fg < std::numeric_limits::min()) - { - span->v = std::numeric_limits::min(); - } - else if (fg > std::numeric_limits::max()) - { - span->v = std::numeric_limits::max(); - } - else - { - span->v = static_cast(fg); - } + span->v = safe_cast(fg / total_weight); } span->a = base_mask;