Permalink
Browse files

ensure the bounds used for avoid-edges and minimum-padding is non-buf…

…fered - refs #1283
  • Loading branch information...
1 parent 77c946d commit 3947ea8c0aebd68e64eb29190ce85bdf64a15510 @springmeyer springmeyer committed Jul 5, 2012
View
7 include/mapnik/cairo_renderer.hpp
@@ -72,7 +72,7 @@ class cairo_face_manager : private boost::noncopyable
class MAPNIK_DECL cairo_renderer_base : private boost::noncopyable
{
protected:
- cairo_renderer_base(Map const& m, Cairo::RefPtr<Cairo::Context> const& context, unsigned offset_x=0, unsigned offset_y=0);
+ cairo_renderer_base(Map const& m, Cairo::RefPtr<Cairo::Context> const& context, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0);
public:
~cairo_renderer_base();
void start_map_processing(Map const& map);
@@ -127,6 +127,9 @@ class MAPNIK_DECL cairo_renderer_base : private boost::noncopyable
Map const& m_;
Cairo::RefPtr<Cairo::Context> context_;
+ unsigned width_;
+ unsigned height_;
+ double scale_factor_;
CoordTransform t_;
boost::shared_ptr<freetype_engine> font_engine_;
face_manager<freetype_engine> font_manager_;
@@ -141,7 +144,7 @@ class MAPNIK_DECL cairo_renderer : public feature_style_processor<cairo_renderer
{
public:
typedef cairo_renderer_base processor_impl_type;
- cairo_renderer(Map const& m, Cairo::RefPtr<T> const& surface, unsigned offset_x=0, unsigned offset_y=0);
+ cairo_renderer(Map const& m, Cairo::RefPtr<T> const& surface, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0);
void end_map_processing(Map const& map);
};
}
View
5 src/agg/process_shield_symbolizer.cpp
@@ -42,9 +42,10 @@ void agg_renderer<T>::process(shield_symbolizer const& sym,
shield_symbolizer_helper<face_manager<freetype_engine>,
label_collision_detector4> helper(
sym, feature, prj_trans,
- detector_->extent().width(), detector_->extent().height(),
+ width_, height_,
scale_factor_,
- t_, font_manager_, *detector_, query_extent_);
+ t_, font_manager_, *detector_,
+ query_extent_);
text_renderer<T> ren(*current_buffer_,
font_manager_,
View
5 src/agg/process_text_symbolizer.cpp
@@ -35,9 +35,10 @@ void agg_renderer<T>::process(text_symbolizer const& sym,
text_symbolizer_helper<face_manager<freetype_engine>,
label_collision_detector4> helper(
sym, feature, prj_trans,
- detector_->extent().width(), detector_->extent().height(),
+ width_,height_,
scale_factor_,
- t_, font_manager_, *detector_, query_extent_);
+ t_, font_manager_, *detector_,
+ query_extent_);
text_renderer<T> ren(*current_buffer_,
font_manager_,
View
22 src/cairo_renderer.cpp
@@ -737,9 +737,16 @@ class cairo_context : private boost::noncopyable
Cairo::RefPtr<Cairo::Context> context_;
};
-cairo_renderer_base::cairo_renderer_base(Map const& m, Cairo::RefPtr<Cairo::Context> const& context, unsigned offset_x, unsigned offset_y)
+cairo_renderer_base::cairo_renderer_base(Map const& m,
+ Cairo::RefPtr<Cairo::Context> const& context,
+ double scale_factor,
+ unsigned offset_x,
+ unsigned offset_y)
: m_(m),
context_(context),
+ width_(m.width()),
+ height_(m.height()),
+ scale_factor_(scale_factor),
t_(m.width(),m.height(),m.get_current_extent(),offset_x,offset_y),
font_engine_(boost::make_shared<freetype_engine>()),
font_manager_(*font_engine_),
@@ -750,14 +757,14 @@ cairo_renderer_base::cairo_renderer_base(Map const& m, Cairo::RefPtr<Cairo::Cont
}
template <>
-cairo_renderer<Cairo::Context>::cairo_renderer(Map const& m, Cairo::RefPtr<Cairo::Context> const& context, unsigned offset_x, unsigned offset_y)
+cairo_renderer<Cairo::Context>::cairo_renderer(Map const& m, Cairo::RefPtr<Cairo::Context> const& context, double scale_factor, unsigned offset_x, unsigned offset_y)
: feature_style_processor<cairo_renderer>(m),
cairo_renderer_base(m,context,scale_factor,offset_x,offset_y)
{
}
template <>
-cairo_renderer<Cairo::Surface>::cairo_renderer(Map const& m, Cairo::RefPtr<Cairo::Surface> const& surface, unsigned offset_x, unsigned offset_y)
+cairo_renderer<Cairo::Surface>::cairo_renderer(Map const& m, Cairo::RefPtr<Cairo::Surface> const& surface, double scale_factor, unsigned offset_x, unsigned offset_y)
: feature_style_processor<cairo_renderer>(m),
cairo_renderer_base(m,Cairo::Context::create(surface),scale_factor,offset_x,offset_y)
{
@@ -1192,7 +1199,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
shield_symbolizer_helper<face_manager<freetype_engine>,
label_collision_detector4> helper(
sym, feature, prj_trans,
- detector_.extent().width(), detector_.extent().height(),
+ width_, height_,
1.0 /*scale_factor*/,
t_, font_manager_, detector_, query_extent_);
cairo_context context(context_);
@@ -1619,7 +1626,12 @@ void cairo_renderer_base::start_map_processing(Map const& map)
mapnik::feature_impl & feature,
proj_transform const& prj_trans)
{
- text_symbolizer_helper<face_manager<freetype_engine>, label_collision_detector4> helper(sym, feature, prj_trans, detector_.extent().width(), detector_.extent().height(), 1.0 /*scale_factor*/, t_, font_manager_, detector_, query_extent_);
+ text_symbolizer_helper<face_manager<freetype_engine>,
+ label_collision_detector4> helper(
+ sym, feature, prj_trans,
+ width_, height_,
+ 1.0 /*scale_factor*/,
+ t_, font_manager_, detector_, query_extent_);
cairo_context context(context_);
context.set_operator(sym.comp_op());
View
4 src/grid/process_shield_symbolizer.cpp
@@ -47,8 +47,8 @@ void grid_renderer<T>::process(shield_symbolizer const& sym,
sym, feature, prj_trans,
width_, height_,
scale_factor_,
- t_, font_manager_, detector_, query_extent);
-
+ t_, font_manager_, detector_,
+ query_extent);
bool placement_found = false;
text_renderer<T> ren(pixmap_,
View
2 src/grid/process_text_symbolizer.cpp
@@ -35,7 +35,7 @@ void grid_renderer<T>::process(text_symbolizer const& sym,
text_symbolizer_helper<face_manager<freetype_engine>,
label_collision_detector4> helper(
sym, feature, prj_trans,
- detector_.extent().width(), detector_.extent().height(),
+ width_, height_,
scale_factor_ * (1.0/pixmap_.get_resolution()),
t_, font_manager_, detector_,
query_extent);

0 comments on commit 3947ea8

Please sign in to comment.