Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

before caching marker premultiply only those image formats that might…

… potentially need to be premultiplied
  • Loading branch information...
commit a4b5549282390c0692bde8abf1e872acbfe3db00 1 parent 357e711
@springmeyer springmeyer authored
Showing with 7 additions and 6 deletions.
  1. +1 −1  src/jpeg_reader.cpp
  2. +6 −5 src/marker_cache.cpp
View
2  src/jpeg_reader.cpp
@@ -50,7 +50,7 @@ class JpegReader : public image_reader, boost::noncopyable
~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();
View
11 src/marker_cache.cpp
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.