premultiply marker images once, before caching - refs #1262

This commit is contained in:
Dane Springmeyer 2012-06-19 08:36:03 -04:00
parent 65156a59ed
commit 3272707548
2 changed files with 10 additions and 1 deletions

View File

@ -297,7 +297,7 @@ void agg_renderer<T>::render_marker(pixel_position const& pos, marker const& mar
comp_op, opacity,
boost::math::iround(pos.x - cx),
boost::math::iround(pos.y - cy),
true);
false);
}
}

View File

@ -38,6 +38,10 @@
#include <boost/algorithm/string.hpp>
#include <boost/make_shared.hpp>
// agg
#include "agg_rendering_buffer.h"
#include "agg_pixfmt_rgba.h"
namespace mapnik
{
@ -113,6 +117,11 @@ boost::optional<marker_ptr> marker_cache::find(std::string const& uri, bool upda
BOOST_ASSERT(width > 0 && height > 0);
mapnik::image_ptr image(boost::make_shared<mapnik::image_data_32>(width,height));
reader->read(0,0,*image);
// ensure images are premultiplied
// TODO - don't need to multiply jpegs
agg::rendering_buffer buffer(image->getBytes(),image->width(),image->height(),image->width() * 4);
agg::pixfmt_rgba32 pixf(buffer);
pixf.premultiply();
marker_ptr mark(boost::make_shared<marker>(image));
result.reset(mark);
if (update_cache)