diff --git a/include/mapnik/renderer_common.hpp b/include/mapnik/renderer_common.hpp index 71afadb12..caf85087c 100644 --- a/include/mapnik/renderer_common.hpp +++ b/include/mapnik/renderer_common.hpp @@ -28,6 +28,7 @@ #include // for box2d #include // for view_transform #include +#include // fwd declarations to speed up compile namespace mapnik { @@ -39,7 +40,7 @@ namespace mapnik { namespace mapnik { -struct renderer_common +struct renderer_common : private mapnik::noncopyable { renderer_common(Map const &m, attributes const& vars, unsigned offset_x, unsigned offset_y, unsigned width, unsigned height, double scale_factor); @@ -48,7 +49,6 @@ struct renderer_common std::shared_ptr detector); renderer_common(request const &req, attributes const& vars, unsigned offset_x, unsigned offset_y, unsigned width, unsigned height, double scale_factor); - renderer_common(renderer_common const& other); unsigned width_; unsigned height_; diff --git a/include/mapnik/renderer_common/process_group_symbolizer.hpp b/include/mapnik/renderer_common/process_group_symbolizer.hpp index ab7030245..4dee1b33d 100644 --- a/include/mapnik/renderer_common/process_group_symbolizer.hpp +++ b/include/mapnik/renderer_common/process_group_symbolizer.hpp @@ -38,6 +38,7 @@ #include #include #include +#include // agg #include @@ -48,6 +49,35 @@ class proj_transform; struct glyph_info; class text_symbolizer_helper; +struct virtual_renderer_common : private mapnik::noncopyable +{ + + virtual_renderer_common(renderer_common & common) : + width_(common.width_), + height_(common.height_), + scale_factor_(common.scale_factor_), + vars_(common.vars_), + shared_font_engine_(common.shared_font_engine_), + font_engine_(*shared_font_engine_), + font_manager_(common.font_manager_), + query_extent_(common.query_extent_), + t_(common.t_), + detector_(std::make_shared(common.detector_->extent())) {} + + unsigned & width_; + unsigned & height_; + double & scale_factor_; + attributes & vars_; + // TODO: dirty hack for cairo renderer, figure out how to remove this + std::shared_ptr & shared_font_engine_; + freetype_engine & font_engine_; + face_manager & font_manager_; + box2d & query_extent_; + view_transform & t_; + std::shared_ptr detector_; +}; + + // General: // The approach here is to run the normal symbolizers, but in @@ -117,7 +147,7 @@ struct render_thunk_extractor : public util::static_visitor<> feature_impl & feature, attributes const& vars, proj_transform const& prj_trans, - renderer_common & common, + virtual_renderer_common & common, box2d const& clipping_extent); void operator()(point_symbolizer const& sym) const; @@ -140,7 +170,7 @@ private: feature_impl & feature_; attributes const& vars_; proj_transform const& prj_trans_; - renderer_common & common_; + virtual_renderer_common & common_; box2d clipping_extent_; void update_box() const; @@ -211,8 +241,7 @@ void render_group_symbolizer(group_symbolizer const& sym, // create a copied 'virtual' common renderer for processing sub feature symbolizers // create an empty detector for it, so we are sure we won't hit anything - renderer_common virtual_renderer(common); - virtual_renderer.detector_ = std::make_shared(common.detector_->extent()); + virtual_renderer_common virtual_renderer(common); // keep track of which lists of render thunks correspond to // entries in the group_layout_manager. diff --git a/include/mapnik/renderer_common/process_point_symbolizer.hpp b/include/mapnik/renderer_common/process_point_symbolizer.hpp index a58a6a714..b9c728144 100644 --- a/include/mapnik/renderer_common/process_point_symbolizer.hpp +++ b/include/mapnik/renderer_common/process_point_symbolizer.hpp @@ -32,11 +32,11 @@ namespace mapnik { -template +template void render_point_symbolizer(point_symbolizer const &sym, mapnik::feature_impl &feature, proj_transform const &prj_trans, - renderer_common &common, + RendererType &common, F render_marker) { std::string filename = get(sym, keys::file, feature, common.vars_); diff --git a/src/renderer_common.cpp b/src/renderer_common.cpp index c2792f617..82d68e4c7 100644 --- a/src/renderer_common.cpp +++ b/src/renderer_common.cpp @@ -73,18 +73,4 @@ renderer_common::renderer_common(request const &req, attributes const& vars, uns req.width() + req.buffer_size() ,req.height() + req.buffer_size()))) {} -renderer_common::renderer_common(renderer_common const &other) - : width_(other.width_), - height_(other.height_), - scale_factor_(other.scale_factor_), - vars_(other.vars_), - shared_font_engine_(other.shared_font_engine_), - font_engine_(*shared_font_engine_), - font_manager_(font_engine_), - query_extent_(), - t_(other.t_), - detector_(other.detector_) -{ -} - } diff --git a/src/renderer_common/process_group_symbolizer.cpp b/src/renderer_common/process_group_symbolizer.cpp index 8041507b7..3feaec330 100644 --- a/src/renderer_common/process_group_symbolizer.cpp +++ b/src/renderer_common/process_group_symbolizer.cpp @@ -76,7 +76,7 @@ render_thunk_extractor::render_thunk_extractor(box2d & box, feature_impl & feature, attributes const& vars, proj_transform const& prj_trans, - renderer_common & common, + virtual_renderer_common & common, box2d const& clipping_extent) : box_(box), thunks_(thunks), feature_(feature), vars_(vars), prj_trans_(prj_trans), common_(common), clipping_extent_(clipping_extent)