diff --git a/include/mapnik/cairo_renderer.hpp b/include/mapnik/cairo_renderer.hpp index 3fe8f5344..73d5e4f47 100644 --- a/include/mapnik/cairo_renderer.hpp +++ b/include/mapnik/cairo_renderer.hpp @@ -72,7 +72,7 @@ private: class MAPNIK_DECL cairo_renderer_base : private boost::noncopyable { protected: - cairo_renderer_base(Map const& m, Cairo::RefPtr const& context, unsigned offset_x=0, unsigned offset_y=0); + cairo_renderer_base(Map const& m, Cairo::RefPtr 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 context_; + unsigned width_; + unsigned height_; + double scale_factor_; CoordTransform t_; boost::shared_ptr font_engine_; face_manager font_manager_; @@ -141,7 +144,7 @@ class MAPNIK_DECL cairo_renderer : public feature_style_processor const& surface, unsigned offset_x=0, unsigned offset_y=0); + cairo_renderer(Map const& m, Cairo::RefPtr const& surface, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0); void end_map_processing(Map const& map); }; } diff --git a/src/agg/process_shield_symbolizer.cpp b/src/agg/process_shield_symbolizer.cpp index b900c3bca..45e7c04f1 100644 --- a/src/agg/process_shield_symbolizer.cpp +++ b/src/agg/process_shield_symbolizer.cpp @@ -42,9 +42,10 @@ void agg_renderer::process(shield_symbolizer const& sym, shield_symbolizer_helper, 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 ren(*current_buffer_, font_manager_, diff --git a/src/agg/process_text_symbolizer.cpp b/src/agg/process_text_symbolizer.cpp index 52ed7a823..2d0988640 100644 --- a/src/agg/process_text_symbolizer.cpp +++ b/src/agg/process_text_symbolizer.cpp @@ -35,9 +35,10 @@ void agg_renderer::process(text_symbolizer const& sym, text_symbolizer_helper, 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 ren(*current_buffer_, font_manager_, diff --git a/src/cairo_renderer.cpp b/src/cairo_renderer.cpp index fc07684b7..02794ad49 100644 --- a/src/cairo_renderer.cpp +++ b/src/cairo_renderer.cpp @@ -737,9 +737,16 @@ private: Cairo::RefPtr context_; }; -cairo_renderer_base::cairo_renderer_base(Map const& m, Cairo::RefPtr const& context, unsigned offset_x, unsigned offset_y) +cairo_renderer_base::cairo_renderer_base(Map const& m, + Cairo::RefPtr 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()), font_manager_(*font_engine_), @@ -750,14 +757,14 @@ cairo_renderer_base::cairo_renderer_base(Map const& m, Cairo::RefPtr -cairo_renderer::cairo_renderer(Map const& m, Cairo::RefPtr const& context, unsigned offset_x, unsigned offset_y) +cairo_renderer::cairo_renderer(Map const& m, Cairo::RefPtr const& context, double scale_factor, unsigned offset_x, unsigned offset_y) : feature_style_processor(m), cairo_renderer_base(m,context,offset_x,offset_y) { } template <> -cairo_renderer::cairo_renderer(Map const& m, Cairo::RefPtr const& surface, unsigned offset_x, unsigned offset_y) +cairo_renderer::cairo_renderer(Map const& m, Cairo::RefPtr const& surface, double scale_factor, unsigned offset_x, unsigned offset_y) : feature_style_processor(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, 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, 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, + 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()); diff --git a/src/grid/process_shield_symbolizer.cpp b/src/grid/process_shield_symbolizer.cpp index 820e9b31b..88681293d 100644 --- a/src/grid/process_shield_symbolizer.cpp +++ b/src/grid/process_shield_symbolizer.cpp @@ -47,8 +47,8 @@ void grid_renderer::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 ren(pixmap_, diff --git a/src/grid/process_text_symbolizer.cpp b/src/grid/process_text_symbolizer.cpp index 41c7881f4..dc5b58786 100644 --- a/src/grid/process_text_symbolizer.cpp +++ b/src/grid/process_text_symbolizer.cpp @@ -35,7 +35,7 @@ void grid_renderer::process(text_symbolizer const& sym, text_symbolizer_helper, 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);