fix gamma for symbolizers that do not (yet) support user driven gamma - closes #2912

This commit is contained in:
Dane Springmeyer 2015-06-12 18:18:39 -07:00
parent 0d86afff36
commit 8172eda3d1
3 changed files with 21 additions and 0 deletions

View file

@ -214,6 +214,14 @@ void agg_renderer<T0,T1>::process(debug_symbolizer const& sym,
debug_symbolizer_mode_enum mode = get<debug_symbolizer_mode_enum>(sym, keys::mode, feature, common_.vars_, DEBUG_SYM_MODE_COLLISION); debug_symbolizer_mode_enum mode = get<debug_symbolizer_mode_enum>(sym, keys::mode, feature, common_.vars_, DEBUG_SYM_MODE_COLLISION);
ras_ptr->reset();
if (gamma_method_ != GAMMA_POWER || gamma_ != 1.0)
{
ras_ptr->gamma(agg::gamma_power());
gamma_method_ = GAMMA_POWER;
gamma_ = 1.0;
}
if (mode == DEBUG_SYM_MODE_RINGS) if (mode == DEBUG_SYM_MODE_RINGS)
{ {
RingRenderer<buffer_type> renderer(*ras_ptr,*current_buffer_,common_.t_,prj_trans); RingRenderer<buffer_type> renderer(*ras_ptr,*current_buffer_,common_.t_,prj_trans);

View file

@ -111,6 +111,12 @@ void agg_renderer<T0,T1>::process(dot_symbolizer const& sym,
double opacity = get<double>(sym, keys::opacity, feature, common_.vars_, 1.0); double opacity = get<double>(sym, keys::opacity, feature, common_.vars_, 1.0);
color const& fill = get<mapnik::color>(sym, keys::fill, feature, common_.vars_, mapnik::color(128,128,128)); color const& fill = get<mapnik::color>(sym, keys::fill, feature, common_.vars_, mapnik::color(128,128,128));
ras_ptr->reset(); ras_ptr->reset();
if (gamma_method_ != GAMMA_POWER || gamma_ != 1.0)
{
ras_ptr->gamma(agg::gamma_power());
gamma_method_ = GAMMA_POWER;
gamma_ = 1.0;
}
agg::rendering_buffer buf(current_buffer_->bytes(),current_buffer_->width(),current_buffer_->height(),current_buffer_->row_size()); agg::rendering_buffer buf(current_buffer_->bytes(),current_buffer_->width(),current_buffer_->height(),current_buffer_->row_size());
using blender_type = agg::comp_op_adaptor_rgba_pre<agg::rgba8, agg::order_rgba>; using blender_type = agg::comp_op_adaptor_rgba_pre<agg::rgba8, agg::order_rgba>;
using pixfmt_comp_type = agg::pixfmt_custom_blend_rgba<blender_type, agg::rendering_buffer>; using pixfmt_comp_type = agg::pixfmt_custom_blend_rgba<blender_type, agg::rendering_buffer>;

View file

@ -237,6 +237,13 @@ void agg_renderer<T0,T1>::process(line_pattern_symbolizer const& sym,
std::string filename = get<std::string, keys::file>(sym, feature, common_.vars_); std::string filename = get<std::string, keys::file>(sym, feature, common_.vars_);
if (filename.empty()) return; if (filename.empty()) return;
ras_ptr->reset();
if (gamma_method_ != GAMMA_POWER || gamma_ != 1.0)
{
ras_ptr->gamma(agg::gamma_power());
gamma_method_ = GAMMA_POWER;
gamma_ = 1.0;
}
std::shared_ptr<mapnik::marker const> marker = marker_cache::instance().find(filename, true); std::shared_ptr<mapnik::marker const> marker = marker_cache::instance().find(filename, true);
agg_renderer_process_visitor_l<buffer_type> visitor(common_, agg_renderer_process_visitor_l<buffer_type> visitor(common_,
pixmap_, pixmap_,