ensure the bounds used for avoid-edges and minimum-padding is non-buffered - refs #1283
This commit is contained in:
parent
7d9b4ce0da
commit
c677b4f47c
6 changed files with 31 additions and 14 deletions
|
@ -72,7 +72,7 @@ private:
|
|||
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 @@ protected:
|
|||
|
||||
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);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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_,
|
||||
|
|
|
@ -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_,
|
||||
|
|
|
@ -737,9 +737,16 @@ private:
|
|||
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,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),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());
|
||||
|
|
|
@ -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_,
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue