image_filters : agg-stack-blur requires premultiplied pixels - move de/pre multipling into apply_filter()

This commit is contained in:
artemp 2014-06-19 15:40:54 +01:00
parent 2fb3069825
commit 68a5cc55a6
2 changed files with 6 additions and 4 deletions

View file

@ -392,8 +392,12 @@ void apply_convolution_3x3(Src const& src_view, Dst & dst_view, Filter const& fi
template <typename Src, typename Filter>
void apply_filter(Src & src, Filter const& filter)
{
double_buffer<Src> tb(src);
apply_convolution_3x3(tb.src_view, tb.dst_view, filter);
{
src.demultiply();
double_buffer<Src> tb(src);
apply_convolution_3x3(tb.src_view, tb.dst_view, filter);
} // ensure ~double_buffer() is called before premultiplying
src.premultiply();
}
template <typename Src>

View file

@ -275,12 +275,10 @@ void agg_renderer<T0,T1>::end_style_processing(feature_type_style const& st)
{
blend_from = true;
mapnik::filter::filter_visitor<image_32> visitor(*current_buffer_);
current_buffer_->demultiply(); // apply image-filters in de-multiplied color space
for (mapnik::filter::filter_type const& filter_tag : st.image_filters())
{
boost::apply_visitor(visitor, filter_tag);
}
current_buffer_->premultiply(); // back to pre-multiplied color space
}
if (st.comp_op())
{