[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Maposmatic-dev] [PATCH] cairo_renderer: use transform() instead of
From: |
Thomas Petazzoni |
Subject: |
Re: [Maposmatic-dev] [PATCH] cairo_renderer: use transform() instead of set_matrix() for markers |
Date: |
Mon, 26 Mar 2012 19:30:58 +0200 |
Hello,
Just for the address@hidden list: this is Mapnik patch, it is not
intended to be applied on ocitysmap or maposmatic.
Thomas
Le Mon, 26 Mar 2012 16:49:50 +0200,
Thomas Petazzoni <address@hidden> a écrit :
> From: Thomas Petazzoni <address@hidden>
>
> Mapnik is current using context.set_matrix() to modify the Cairo
> transformation matrix to render markers at the right location and with
> the right angle on the map. This is typically used to render one-way
> arrows with the MapQuest stylesheet.
>
> Unfortunately, context.set_matrix() completely _overrides_ the
> existing Cairo transformation matrix instead of making an _additional_
> transformation to it. However, in MapOSMatic
> (http://www.maposmatic.org), for our map-rendering needs, we pass to
> Mapnik a Cairo surface on which we have already applied a
> translation+scaling transformation. The usage of .set_matrix() by
> Mapnik completely overrides this transformation, with the result of
> having completely misplaced one-way arrows.
>
> By using context.transform(), then the transformation matrix is
> applied on _top_ of the current one, which fixes the rendering. Now,
> the one-way arrows are at the right locations on our translated+scaled
> Cairo surface.
>
> Thanks to Gaël Utard <address@hidden> for his help in debugging
> this problem.
>
> Signed-off-by: Thomas Petazzoni <address@hidden>
> ---
> src/cairo_renderer.cpp | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/cairo_renderer.cpp b/src/cairo_renderer.cpp
> index 589247e..12f6277 100644
> --- a/src/cairo_renderer.cpp
> +++ b/src/cairo_renderer.cpp
> @@ -1269,7 +1269,7 @@ void cairo_renderer_base::start_map_processing(Map
> const& map)
> double x, y, angle;
> while (placement.get_point(&x, &y, &angle)) {
> Cairo::Matrix matrix = Cairo::rotation_matrix(angle) *
> Cairo::translation_matrix(x,y) ;
> - context.set_matrix(matrix);
> + context.transform(matrix);
> context.add_path(arrow_);
> }
> }
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com