Merge pull request #3416 from mapycz/scale-factor-improvements

Scale factor improvements
This commit is contained in:
Artem Pavlenko 2016-05-18 15:05:04 +02:00
commit aec5949d5a
11 changed files with 12 additions and 12 deletions

View file

@ -61,7 +61,7 @@ void render_point_symbolizer(point_symbolizer const &sym,
agg::trans_affine tr; agg::trans_affine tr;
auto image_transform = get_optional<transform_type>(sym, keys::image_transform); auto image_transform = get_optional<transform_type>(sym, keys::image_transform);
if (image_transform) evaluate_transform(tr, feature, common.vars_, *image_transform); if (image_transform) evaluate_transform(tr, feature, common.vars_, *image_transform, common.scale_factor_);
agg::trans_affine_translation recenter(-center.x, -center.y); agg::trans_affine_translation recenter(-center.x, -center.y);
agg::trans_affine recenter_tr = recenter * tr; agg::trans_affine recenter_tr = recenter * tr;

View file

@ -58,7 +58,7 @@ MAPNIK_DECL void evaluate_transform(agg::trans_affine& tr,
feature_impl const& feature, feature_impl const& feature,
attributes const& vars, attributes const& vars,
transform_type const& trans_expr, transform_type const& trans_expr,
double scale_factor=1.0); double scale_factor);
struct enumeration_wrapper struct enumeration_wrapper
{ {

View file

@ -92,7 +92,7 @@ struct agg_renderer_process_visitor_l
value_double opacity = get<value_double, keys::opacity>(sym_, feature_, common_.vars_); value_double opacity = get<value_double, keys::opacity>(sym_, feature_, common_.vars_);
agg::trans_affine image_tr = agg::trans_affine_scaling(common_.scale_factor_); agg::trans_affine image_tr = agg::trans_affine_scaling(common_.scale_factor_);
auto image_transform = get_optional<transform_type>(sym_, keys::image_transform); auto image_transform = get_optional<transform_type>(sym_, keys::image_transform);
if (image_transform) evaluate_transform(image_tr, feature_, common_.vars_, *image_transform); if (image_transform) evaluate_transform(image_tr, feature_, common_.vars_, *image_transform, common_.scale_factor_);
mapnik::box2d<double> const& bbox_image = marker.get_data()->bounding_box() * image_tr; mapnik::box2d<double> const& bbox_image = marker.get_data()->bounding_box() * image_tr;
image_rgba8 image(bbox_image.width(), bbox_image.height()); image_rgba8 image(bbox_image.width(), bbox_image.height());
render_pattern<buffer_type>(*ras_ptr_, marker, image_tr, 1.0, image); render_pattern<buffer_type>(*ras_ptr_, marker, image_tr, 1.0, image);

View file

@ -84,7 +84,7 @@ struct agg_renderer_process_visitor_p
{ {
agg::trans_affine image_tr = agg::trans_affine_scaling(common_.scale_factor_); agg::trans_affine image_tr = agg::trans_affine_scaling(common_.scale_factor_);
auto image_transform = get_optional<transform_type>(sym_, keys::image_transform); auto image_transform = get_optional<transform_type>(sym_, keys::image_transform);
if (image_transform) evaluate_transform(image_tr, feature_, common_.vars_, *image_transform); if (image_transform) evaluate_transform(image_tr, feature_, common_.vars_, *image_transform, common_.scale_factor_);
mapnik::box2d<double> const& bbox_image = marker.get_data()->bounding_box() * image_tr; mapnik::box2d<double> const& bbox_image = marker.get_data()->bounding_box() * image_tr;
mapnik::image_rgba8 image(bbox_image.width(), bbox_image.height()); mapnik::image_rgba8 image(bbox_image.width(), bbox_image.height());
render_pattern<buffer_type>(*ras_ptr_, marker, image_tr, 1.0, image); render_pattern<buffer_type>(*ras_ptr_, marker, image_tr, 1.0, image);

View file

@ -63,7 +63,7 @@ void agg_renderer<T0,T1>::process(text_symbolizer const& sym,
if (halo_transform) if (halo_transform)
{ {
agg::trans_affine halo_affine_transform; agg::trans_affine halo_affine_transform;
evaluate_transform(halo_affine_transform, feature, common_.vars_, *halo_transform); evaluate_transform(halo_affine_transform, feature, common_.vars_, *halo_transform, common_.scale_factor_);
ren.set_halo_transform(halo_affine_transform); ren.set_halo_transform(halo_affine_transform);
} }

View file

@ -62,7 +62,7 @@ struct cairo_renderer_process_visitor_l
mapnik::rasterizer ras; mapnik::rasterizer ras;
agg::trans_affine image_tr = agg::trans_affine_scaling(common_.scale_factor_); agg::trans_affine image_tr = agg::trans_affine_scaling(common_.scale_factor_);
auto image_transform = get_optional<transform_type>(sym_, keys::image_transform); auto image_transform = get_optional<transform_type>(sym_, keys::image_transform);
if (image_transform) evaluate_transform(image_tr, feature_, common_.vars_, *image_transform); if (image_transform) evaluate_transform(image_tr, feature_, common_.vars_, *image_transform, common_.scale_factor_);
mapnik::box2d<double> const& bbox_image = marker.get_data()->bounding_box() * image_tr; mapnik::box2d<double> const& bbox_image = marker.get_data()->bounding_box() * image_tr;
mapnik::image_rgba8 image(bbox_image.width(), bbox_image.height()); mapnik::image_rgba8 image(bbox_image.width(), bbox_image.height());
render_pattern<image_rgba8>(ras, marker, image_tr, 1.0, image); render_pattern<image_rgba8>(ras, marker, image_tr, 1.0, image);

View file

@ -96,7 +96,7 @@ void cairo_renderer<T>::process(polygon_pattern_symbolizer const& sym,
value_double opacity = get<value_double, keys::opacity>(sym, feature, common_.vars_); value_double opacity = get<value_double, keys::opacity>(sym, feature, common_.vars_);
agg::trans_affine image_tr = agg::trans_affine_scaling(common_.scale_factor_); agg::trans_affine image_tr = agg::trans_affine_scaling(common_.scale_factor_);
auto image_transform = get_optional<transform_type>(sym, keys::image_transform); auto image_transform = get_optional<transform_type>(sym, keys::image_transform);
if (image_transform) evaluate_transform(image_tr, feature, common_.vars_, *image_transform); if (image_transform) evaluate_transform(image_tr, feature, common_.vars_, *image_transform, common_.scale_factor_);
cairo_save_restore guard(context_); cairo_save_restore guard(context_);
context_.set_operator(comp_op); context_.set_operator(comp_op);

View file

@ -60,7 +60,7 @@ void grid_renderer<T>::process(text_symbolizer const& sym,
if (halo_transform) if (halo_transform)
{ {
agg::trans_affine halo_affine_transform; agg::trans_affine halo_affine_transform;
evaluate_transform(halo_affine_transform, feature, common_.vars_, *halo_transform); evaluate_transform(halo_affine_transform, feature, common_.vars_, *halo_transform, common_.scale_factor_);
ren.set_halo_transform(halo_affine_transform); ren.set_halo_transform(halo_affine_transform);
} }

View file

@ -159,7 +159,7 @@ struct render_marker_symbolizer_visitor
if (auto image_transform = get_optional<transform_type>(sym_, keys::image_transform)) if (auto image_transform = get_optional<transform_type>(sym_, keys::image_transform))
{ {
evaluate_transform(image_tr, feature_, common_.vars_, *image_transform); evaluate_transform(image_tr, feature_, common_.vars_, *image_transform, common_.scale_factor_);
} }
vector_dispatch_type rasterizer_dispatch(marker_ptr, vector_dispatch_type rasterizer_dispatch(marker_ptr,
@ -183,7 +183,7 @@ struct render_marker_symbolizer_visitor
setup_transform_scaling(image_tr, mark.width(), mark.height(), feature_, common_.vars_, sym_); setup_transform_scaling(image_tr, mark.width(), mark.height(), feature_, common_.vars_, sym_);
auto image_transform = get_optional<transform_type>(sym_, keys::image_transform); auto image_transform = get_optional<transform_type>(sym_, keys::image_transform);
if (image_transform) evaluate_transform(image_tr, feature_, common_.vars_, *image_transform); if (image_transform) evaluate_transform(image_tr, feature_, common_.vars_, *image_transform, common_.scale_factor_);
box2d<double> const& bbox = mark.bounding_box(); box2d<double> const& bbox = mark.bounding_box();
mapnik::image_rgba8 const& marker = mark.get_data(); mapnik::image_rgba8 const& marker = mark.get_data();
// - clamp sizes to > 4 pixels of interactivity // - clamp sizes to > 4 pixels of interactivity

View file

@ -465,7 +465,7 @@ void text_symbolizer_helper::init_marker() const
if (marker->is<marker_null>()) return; if (marker->is<marker_null>()) return;
agg::trans_affine trans; agg::trans_affine trans;
auto image_transform = get_optional<transform_type>(sym_, keys::image_transform); auto image_transform = get_optional<transform_type>(sym_, keys::image_transform);
if (image_transform) evaluate_transform(trans, feature_, vars_, *image_transform); if (image_transform) evaluate_transform(trans, feature_, vars_, *image_transform, scale_factor_);
double width = marker->width(); double width = marker->width();
double height = marker->height(); double height = marker->height();
double px0 = - 0.5 * width; double px0 = - 0.5 * width;

View file

@ -51,7 +51,7 @@ text_line::text_line(text_line && rhs)
void text_line::add_glyph(glyph_info && glyph, double scale_factor_) void text_line::add_glyph(glyph_info && glyph, double scale_factor_)
{ {
line_height_ = std::max(line_height_, glyph.line_height() + glyph.format->line_spacing); line_height_ = std::max(line_height_, glyph.line_height() + glyph.format->line_spacing * scale_factor_);
double advance = glyph.advance(); double advance = glyph.advance();
if (glyphs_.empty()) if (glyphs_.empty())
{ {