reduce overhead of flexible agg gamma setting per symbolizer - closes #1174
This commit is contained in:
parent
2b3170322d
commit
44c02a10c5
6 changed files with 48 additions and 11 deletions
|
@ -79,7 +79,10 @@ agg_renderer<T>::agg_renderer(Map const& m, T & pixmap, double scale_factor, uns
|
||||||
font_engine_(),
|
font_engine_(),
|
||||||
font_manager_(font_engine_),
|
font_manager_(font_engine_),
|
||||||
detector_(boost::make_shared<label_collision_detector4>(box2d<double>(-m.buffer_size(), -m.buffer_size(), m.width() + m.buffer_size() ,m.height() + m.buffer_size()))),
|
detector_(boost::make_shared<label_collision_detector4>(box2d<double>(-m.buffer_size(), -m.buffer_size(), m.width() + m.buffer_size() ,m.height() + m.buffer_size()))),
|
||||||
ras_ptr(new rasterizer)
|
ras_ptr(new rasterizer),
|
||||||
|
query_extent_(),
|
||||||
|
gamma_method_(GAMMA_POWER),
|
||||||
|
gamma_(1.0)
|
||||||
{
|
{
|
||||||
setup(m);
|
setup(m);
|
||||||
}
|
}
|
||||||
|
@ -98,7 +101,10 @@ agg_renderer<T>::agg_renderer(Map const& m, request const& req, T & pixmap, doub
|
||||||
font_engine_(),
|
font_engine_(),
|
||||||
font_manager_(font_engine_),
|
font_manager_(font_engine_),
|
||||||
detector_(boost::make_shared<label_collision_detector4>(box2d<double>(-req.buffer_size(), -req.buffer_size(), req.width() + req.buffer_size() ,req.height() + req.buffer_size()))),
|
detector_(boost::make_shared<label_collision_detector4>(box2d<double>(-req.buffer_size(), -req.buffer_size(), req.width() + req.buffer_size() ,req.height() + req.buffer_size()))),
|
||||||
ras_ptr(new rasterizer)
|
ras_ptr(new rasterizer),
|
||||||
|
query_extent_(),
|
||||||
|
gamma_method_(GAMMA_POWER),
|
||||||
|
gamma_(1.0)
|
||||||
{
|
{
|
||||||
setup(m);
|
setup(m);
|
||||||
}
|
}
|
||||||
|
@ -118,7 +124,10 @@ agg_renderer<T>::agg_renderer(Map const& m, T & pixmap, boost::shared_ptr<label_
|
||||||
font_engine_(),
|
font_engine_(),
|
||||||
font_manager_(font_engine_),
|
font_manager_(font_engine_),
|
||||||
detector_(detector),
|
detector_(detector),
|
||||||
ras_ptr(new rasterizer)
|
ras_ptr(new rasterizer),
|
||||||
|
query_extent_(),
|
||||||
|
gamma_method_(GAMMA_POWER),
|
||||||
|
gamma_(1.0)
|
||||||
{
|
{
|
||||||
setup(m);
|
setup(m);
|
||||||
}
|
}
|
||||||
|
@ -297,7 +306,12 @@ void agg_renderer<T>::render_marker(pixel_position const& pos,
|
||||||
typedef agg::pod_bvector<mapnik::svg::path_attributes> svg_attribute_type;
|
typedef agg::pod_bvector<mapnik::svg::path_attributes> svg_attribute_type;
|
||||||
|
|
||||||
ras_ptr->reset();
|
ras_ptr->reset();
|
||||||
ras_ptr->gamma(agg::gamma_power());
|
if (gamma_method_ != GAMMA_POWER || gamma_ != 1.0)
|
||||||
|
{
|
||||||
|
ras_ptr->gamma(agg::gamma_power());
|
||||||
|
gamma_method_ = GAMMA_POWER;
|
||||||
|
gamma_ = 1.0;
|
||||||
|
}
|
||||||
agg::scanline_u8 sl;
|
agg::scanline_u8 sl;
|
||||||
agg::rendering_buffer buf(current_buffer_->raw_data(), width_, height_, width_ * 4);
|
agg::rendering_buffer buf(current_buffer_->raw_data(), width_, height_, width_ * 4);
|
||||||
pixfmt_comp_type pixf(buf);
|
pixfmt_comp_type pixf(buf);
|
||||||
|
|
|
@ -70,7 +70,12 @@ void agg_renderer<T>::process(building_symbolizer const& sym,
|
||||||
agg::scanline_u8 sl;
|
agg::scanline_u8 sl;
|
||||||
|
|
||||||
ras_ptr->reset();
|
ras_ptr->reset();
|
||||||
ras_ptr->gamma(agg::gamma_power());
|
if (gamma_method_ != GAMMA_POWER || gamma_ != 1.0)
|
||||||
|
{
|
||||||
|
ras_ptr->gamma(agg::gamma_power());
|
||||||
|
gamma_method_ = GAMMA_POWER;
|
||||||
|
gamma_ = 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
double height = 0.0;
|
double height = 0.0;
|
||||||
expression_ptr height_expr = sym.height();
|
expression_ptr height_expr = sym.height();
|
||||||
|
|
|
@ -66,7 +66,12 @@ void agg_renderer<T>::process(line_symbolizer const& sym,
|
||||||
unsigned a=col.alpha();
|
unsigned a=col.alpha();
|
||||||
|
|
||||||
ras_ptr->reset();
|
ras_ptr->reset();
|
||||||
set_gamma_method(stroke_, ras_ptr);
|
if (stroke_.get_gamma() != gamma_ || stroke_.get_gamma_method() != gamma_method_)
|
||||||
|
{
|
||||||
|
set_gamma_method(stroke_, ras_ptr);
|
||||||
|
gamma_method_ = stroke_.get_gamma_method();
|
||||||
|
gamma_ = stroke_.get_gamma();
|
||||||
|
}
|
||||||
|
|
||||||
agg::rendering_buffer buf(current_buffer_->raw_data(),width_,height_, width_ * 4);
|
agg::rendering_buffer buf(current_buffer_->raw_data(),width_,height_, width_ * 4);
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,12 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
|
||||||
if (mark && *mark)
|
if (mark && *mark)
|
||||||
{
|
{
|
||||||
ras_ptr->reset();
|
ras_ptr->reset();
|
||||||
ras_ptr->gamma(agg::gamma_power());
|
if (gamma_method_ != GAMMA_POWER || gamma_ != 1.0)
|
||||||
|
{
|
||||||
|
ras_ptr->gamma(agg::gamma_power());
|
||||||
|
gamma_method_ = GAMMA_POWER;
|
||||||
|
gamma_ = 1.0;
|
||||||
|
}
|
||||||
agg::trans_affine geom_tr;
|
agg::trans_affine geom_tr;
|
||||||
evaluate_transform(geom_tr, feature, sym.get_transform());
|
evaluate_transform(geom_tr, feature, sym.get_transform());
|
||||||
agg::trans_affine tr = agg::trans_affine_scaling(scale_factor_);
|
agg::trans_affine tr = agg::trans_affine_scaling(scale_factor_);
|
||||||
|
|
|
@ -61,8 +61,12 @@ void agg_renderer<T>::process(polygon_pattern_symbolizer const& sym,
|
||||||
|
|
||||||
agg::rendering_buffer buf(current_buffer_->raw_data(), width_, height_, width_ * 4);
|
agg::rendering_buffer buf(current_buffer_->raw_data(), width_, height_, width_ * 4);
|
||||||
ras_ptr->reset();
|
ras_ptr->reset();
|
||||||
set_gamma_method(sym,ras_ptr);
|
if (sym.get_gamma() != gamma_ || sym.get_gamma_method() != gamma_method_)
|
||||||
|
{
|
||||||
|
set_gamma_method(sym, ras_ptr);
|
||||||
|
gamma_method_ = sym.get_gamma_method();
|
||||||
|
gamma_ = sym.get_gamma();
|
||||||
|
}
|
||||||
std::string filename = path_processor_type::evaluate( *sym.get_filename(), feature);
|
std::string filename = path_processor_type::evaluate( *sym.get_filename(), feature);
|
||||||
boost::optional<mapnik::marker_ptr> marker;
|
boost::optional<mapnik::marker_ptr> marker;
|
||||||
if ( !filename.empty() )
|
if ( !filename.empty() )
|
||||||
|
|
|
@ -48,8 +48,12 @@ void agg_renderer<T>::process(polygon_symbolizer const& sym,
|
||||||
{
|
{
|
||||||
|
|
||||||
ras_ptr->reset();
|
ras_ptr->reset();
|
||||||
set_gamma_method(sym,ras_ptr);
|
if (sym.get_gamma() != gamma_ || sym.get_gamma_method() != gamma_method_)
|
||||||
|
{
|
||||||
|
set_gamma_method(sym, ras_ptr);
|
||||||
|
gamma_method_ = sym.get_gamma_method();
|
||||||
|
gamma_ = sym.get_gamma();
|
||||||
|
}
|
||||||
agg::trans_affine tr;
|
agg::trans_affine tr;
|
||||||
evaluate_transform(tr, feature, sym.get_transform());
|
evaluate_transform(tr, feature, sym.get_transform());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue