diff --git a/include/mapnik/marker.hpp b/include/mapnik/marker.hpp index 63fe16c18..160ff0fd3 100644 --- a/include/mapnik/marker.hpp +++ b/include/mapnik/marker.hpp @@ -25,6 +25,7 @@ // mapnik #include +#include #include #include #include @@ -56,7 +57,7 @@ public: marker() { // create default OGC 4x4 black pixel - bitmap_data_ = boost::optional(std::make_shared(4,4)); + bitmap_data_ = boost::optional(std::make_shared(4,4,true,true)); (*bitmap_data_)->set(0xff000000); } diff --git a/include/mapnik/renderer_common/process_raster_symbolizer.hpp b/include/mapnik/renderer_common/process_raster_symbolizer.hpp index 911f1b309..5e171b9b2 100644 --- a/include/mapnik/renderer_common/process_raster_symbolizer.hpp +++ b/include/mapnik/renderer_common/process_raster_symbolizer.hpp @@ -72,7 +72,7 @@ struct image_data_dispatcher void operator() (image_data_null const& data_in) const {} //no-op void operator() (image_data_rgba8 const& data_in) const { - image_data_rgba8 data_out(width_, height_); + image_data_rgba8 data_out(width_, height_, true, true); scale_image_agg(data_out, data_in, method_, scale_x_, scale_y_, 0.0, 0.0, filter_factor_); composite_(data_out, comp_op_, opacity_, start_x_, start_y_); } @@ -86,6 +86,7 @@ struct image_data_dispatcher image_data_rgba8 dst(width_, height_); raster_colorizer_ptr colorizer = get(sym_, keys::colorizer); if (colorizer) colorizer->colorize(dst, data_out, nodata_, feature_); + premultiply_alpha(dst); composite_(dst, comp_op_, opacity_, start_x_, start_y_); } private: @@ -138,7 +139,7 @@ struct image_data_warp_dispatcher void operator() (image_data_rgba8 const& data_in) const { - image_data_rgba8 data_out(width_, height_); + image_data_rgba8 data_out(width_, height_, true, true); warp_image(data_out, data_in, prj_trans_, target_ext_, source_ext_, offset_x_, offset_y_, mesh_size_, scaling_method_, filter_factor_); composite_(data_out, comp_op_, opacity_, start_x_, start_y_); } @@ -153,6 +154,7 @@ struct image_data_warp_dispatcher image_data_rgba8 dst(width_, height_); raster_colorizer_ptr colorizer = get(sym_, keys::colorizer); if (colorizer) colorizer->colorize(dst, data_out, nodata_, feature_); + premultiply_alpha(dst); composite_(dst, comp_op_, opacity_, start_x_, start_y_); } private: diff --git a/src/agg/agg_renderer.cpp b/src/agg/agg_renderer.cpp index fd15b646d..f11a02330 100644 --- a/src/agg/agg_renderer.cpp +++ b/src/agg/agg_renderer.cpp @@ -111,6 +111,7 @@ agg_renderer::agg_renderer(Map const& m, T0 & pixmap, std::shared_ptr template void agg_renderer::setup(Map const &m) { + mapnik::set_premultiplied_alpha(pixmap_.data(), true); boost::optional const& bg = m.background(); if (bg) { @@ -145,8 +146,6 @@ void agg_renderer::setup(Map const &m) { for (unsigned y=0;y::start_style_processing(feature_type_style const& st) ras_ptr->clip_box(0,0,common_.width_,common_.height_); } current_buffer_ = internal_buffer_.get(); + set_premultiplied_alpha(current_buffer_->data(),true); } else { @@ -279,8 +279,6 @@ void agg_renderer::end_style_processing(feature_type_style const& st) util::apply_visitor(visitor, filter_tag); } } - mapnik::premultiply_alpha(pixmap_.data()); - mapnik::premultiply_alpha(current_buffer_->data()); if (st.comp_op()) { composite(pixmap_.data(), current_buffer_->data(), @@ -374,8 +372,6 @@ void agg_renderer::render_marker(pixel_position const& pos, { double cx = 0.5 * width; double cy = 0.5 * height; - mapnik::premultiply_alpha(current_buffer_->data()); - mapnik::premultiply_alpha(**marker.get_bitmap_data()); composite(current_buffer_->data(), **marker.get_bitmap_data(), comp_op, opacity, std::floor(pos.x - cx + .5), diff --git a/src/agg/process_raster_symbolizer.cpp b/src/agg/process_raster_symbolizer.cpp index 099462b6f..3bfb6c20a 100644 --- a/src/agg/process_raster_symbolizer.cpp +++ b/src/agg/process_raster_symbolizer.cpp @@ -54,8 +54,6 @@ void agg_renderer::process(raster_symbolizer const& sym, sym, feature, prj_trans, common_, [&](image_data_rgba8 & target, composite_mode_e comp_op, double opacity, int start_x, int start_y) { - premultiply_alpha(target); - premultiply_alpha(current_buffer_->data()); composite(current_buffer_->data(), target, comp_op, opacity, start_x, start_y); }