before caching marker premultiply only those image formats that might potentially need to be premultiplied
This commit is contained in:
parent
357e711312
commit
a4b5549282
2 changed files with 7 additions and 6 deletions
|
@ -50,7 +50,7 @@ public:
|
|||
~JpegReader();
|
||||
unsigned width() const;
|
||||
unsigned height() const;
|
||||
inline bool premultiplied_alpha() const { return true ;}
|
||||
inline bool premultiplied_alpha() const { return true; }
|
||||
void read(unsigned x,unsigned y,image_data_32& image);
|
||||
private:
|
||||
void init();
|
||||
|
|
|
@ -198,11 +198,12 @@ boost::optional<marker_ptr> marker_cache::find(std::string const& uri,
|
|||
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();
|
||||
if (!reader->premultiplied_alpha())
|
||||
{
|
||||
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)
|
||||
|
|
Loading…
Add table
Reference in a new issue