completely fix (across various g++ versions) clipping regression - closes #2049

This commit is contained in:
Dane Springmeyer 2013-10-23 18:09:22 -07:00
parent 78f7de16b8
commit ecf8c20938
5 changed files with 18 additions and 11 deletions

View file

@ -335,7 +335,10 @@ void agg_renderer<T>::render_marker(pixel_position const& pos,
gamma_ = 1.0; 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(),
current_buffer_->width(),
current_buffer_->height(),
current_buffer_->width() * 4);
pixfmt_comp_type pixf(buf); pixfmt_comp_type pixf(buf);
pixf.comp_op(static_cast<agg::comp_op_e>(comp_op)); pixf.comp_op(static_cast<agg::comp_op_e>(comp_op));
renderer_base renb(pixf); renderer_base renb(pixf);
@ -441,7 +444,10 @@ template <typename T>
void agg_renderer<T>::debug_draw_box(box2d<double> const& box, void agg_renderer<T>::debug_draw_box(box2d<double> const& box,
double x, double y, double angle) double x, double y, double angle)
{ {
agg::rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_ * 4); agg::rendering_buffer buf(current_buffer_->raw_data(),
current_buffer_->width(),
current_buffer_->height(),
current_buffer_->width() * 4);
debug_draw_box(buf, box, x, y, angle); debug_draw_box(buf, box, x, y, angle);
} }

View file

@ -92,6 +92,7 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
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_);
box2d<double> clip_box = clipping_extent();
if ((*mark)->is_vector()) if ((*mark)->is_vector())
{ {
@ -139,7 +140,7 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
snap_pixels); snap_pixels);
vertex_converter<box2d<double>, dispatch_type, markers_symbolizer, vertex_converter<box2d<double>, dispatch_type, markers_symbolizer,
CoordTransform, proj_transform, agg::trans_affine, conv_types> CoordTransform, proj_transform, agg::trans_affine, conv_types>
converter(clipping_extent(), rasterizer_dispatch, sym,t_,prj_trans,tr,scale_factor_); converter(clip_box, rasterizer_dispatch, sym,t_,prj_trans,tr,scale_factor_);
if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true) if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true)
{ {
geometry_type::types type = feature.paths()[0].type(); geometry_type::types type = feature.paths()[0].type();
@ -179,7 +180,7 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
snap_pixels); snap_pixels);
vertex_converter<box2d<double>, dispatch_type, markers_symbolizer, vertex_converter<box2d<double>, dispatch_type, markers_symbolizer,
CoordTransform, proj_transform, agg::trans_affine, conv_types> CoordTransform, proj_transform, agg::trans_affine, conv_types>
converter(clipping_extent(), rasterizer_dispatch, sym,t_,prj_trans,tr,scale_factor_); converter(clip_box, rasterizer_dispatch, sym,t_,prj_trans,tr,scale_factor_);
if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true) if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true)
{ {
geometry_type::types type = feature.paths()[0].type(); geometry_type::types type = feature.paths()[0].type();
@ -216,7 +217,7 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
true /*snap rasters no matter what*/); true /*snap rasters no matter what*/);
vertex_converter<box2d<double>, dispatch_type, markers_symbolizer, vertex_converter<box2d<double>, dispatch_type, markers_symbolizer,
CoordTransform, proj_transform, agg::trans_affine, conv_types> CoordTransform, proj_transform, agg::trans_affine, conv_types>
converter(clipping_extent(), rasterizer_dispatch, sym,t_,prj_trans,tr,scale_factor_); converter(clip_box, rasterizer_dispatch, sym,t_,prj_trans,tr,scale_factor_);
if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true) if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true)
{ {

View file

@ -58,11 +58,11 @@ void agg_renderer<T>::process(polygon_symbolizer const& sym,
} }
agg::trans_affine tr; agg::trans_affine tr;
evaluate_transform(tr, feature, sym.get_transform()); evaluate_transform(tr, feature, sym.get_transform());
box2d<double> clip_box = clipping_extent();
typedef boost::mpl::vector<clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag> conv_types; typedef boost::mpl::vector<clip_poly_tag,transform_tag,affine_transform_tag,simplify_tag,smooth_tag> conv_types;
vertex_converter<box2d<double>, rasterizer, polygon_symbolizer, vertex_converter<box2d<double>, rasterizer, polygon_symbolizer,
CoordTransform, proj_transform, agg::trans_affine, conv_types> CoordTransform, proj_transform, agg::trans_affine, conv_types>
converter(clipping_extent(),*ras_ptr,sym,t_,prj_trans,tr,scale_factor_); converter(clip_box,*ras_ptr,sym,t_,prj_trans,tr,scale_factor_);
if (prj_trans.equal() && sym.clip()) converter.set<clip_poly_tag>(); //optional clip (default: true) if (prj_trans.equal() && sym.clip()) converter.set<clip_poly_tag>(); //optional clip (default: true)
converter.set<transform_tag>(); //always transform converter.set<transform_tag>(); //always transform

View file

@ -38,14 +38,14 @@ void agg_renderer<T>::process(shield_symbolizer const& sym,
mapnik::feature_impl & feature, mapnik::feature_impl & feature,
proj_transform const& prj_trans) proj_transform const& prj_trans)
{ {
box2d<double> bb = clipping_extent(); box2d<double> clip_box = clipping_extent();
shield_symbolizer_helper<face_manager<freetype_engine>, shield_symbolizer_helper<face_manager<freetype_engine>,
label_collision_detector4> helper( label_collision_detector4> helper(
sym, feature, prj_trans, sym, feature, prj_trans,
width_, height_, width_, height_,
scale_factor_, scale_factor_,
t_, font_manager_, *detector_, t_, font_manager_, *detector_,
bb); clip_box);
text_renderer<T> ren(*current_buffer_, text_renderer<T> ren(*current_buffer_,
font_manager_, font_manager_,

View file

@ -35,14 +35,14 @@ void agg_renderer<T>::process(text_symbolizer const& sym,
mapnik::feature_impl & feature, mapnik::feature_impl & feature,
proj_transform const& prj_trans) proj_transform const& prj_trans)
{ {
box2d<double> bb = clipping_extent(); box2d<double> clip_box = clipping_extent();
text_symbolizer_helper<face_manager<freetype_engine>, text_symbolizer_helper<face_manager<freetype_engine>,
label_collision_detector4> helper( label_collision_detector4> helper(
sym, feature, prj_trans, sym, feature, prj_trans,
width_,height_, width_,height_,
scale_factor_, scale_factor_,
t_, font_manager_, *detector_, t_, font_manager_, *detector_,
bb); clip_box);
text_renderer<T> ren(*current_buffer_, text_renderer<T> ren(*current_buffer_,
font_manager_, font_manager_,