Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
finish mapnik#1512 and adjust tests to use new parameter
  • Loading branch information
Dane Springmeyer authored and PetrDlouhy committed Aug 21, 2013
1 parent 634aed7 commit 7681edf
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions include/mapnik/raster_symbolizer.hpp
Expand Up @@ -30,6 +30,7 @@

// boost
#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>

namespace mapnik
{
Expand Down
13 changes: 12 additions & 1 deletion src/agg/process_raster_symbolizer.cpp
Expand Up @@ -98,9 +98,20 @@ void agg_renderer<T>::process(raster_symbolizer const& sym,
filter_radius);
}
}
// handle whether to premultiply the source
// data before compositing
// first, default to what the data reports
bool premultiply_source = !source->premultiplied_alpha_;
// the, allow the user to override
boost::optional<bool> is_premultiplied = sym.premultiplied();
if (is_premultiplied)
{
if (*is_premultiplied) premultiply_source = false;
else premultiply_source = true;
}
composite(current_buffer_->data(), target.data_,
sym.comp_op(), sym.get_opacity(),
start_x, start_y, !source->premultiplied_alpha_);
start_x, start_y, premultiply_source);
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/raster_symbolizer.cpp
Expand Up @@ -55,7 +55,8 @@ raster_symbolizer::raster_symbolizer(raster_symbolizer const& rhs)
opacity_(rhs.opacity_),
colorizer_(rhs.colorizer_),
filter_factor_(rhs.filter_factor_),
mesh_size_(rhs.mesh_size_) {}
mesh_size_(rhs.mesh_size_),
premultiplied_(rhs.premultiplied_) {}

std::string const& raster_symbolizer::get_mode() const
{
Expand Down
Expand Up @@ -4,7 +4,7 @@

<Style name="white">
<Rule>
<RasterSymbolizer opacity="1" scaling="bilinear" comp-op="src-over"/>
<RasterSymbolizer />
</Rule>
</Style>
<Layer name="white"
Expand Down
Expand Up @@ -4,7 +4,7 @@

<Style name="white">
<Rule>
<RasterSymbolizer opacity="1" scaling="bilinear" comp-op="src-over"/>
<RasterSymbolizer premultiplied="false"/>
</Rule>
</Style>
<Layer name="white"
Expand Down

0 comments on commit 7681edf

Please sign in to comment.