maposmatic-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Maposmatic-dev] [PATCH] Move the background setting to the renderer


From: gael . utard
Subject: [Maposmatic-dev] [PATCH] Move the background setting to the renderer
Date: Fri, 30 Mar 2012 16:58:24 +0200

From: Gael UTARD <address@hidden>

And fix it by the way when png_dpi != 72.

Signed-off-by: Gael UTARD <address@hidden>
---
 ocitysmap2/__init__.py                        |    6 ------
 ocitysmap2/layoutlib/single_page_renderers.py |    8 ++++++++
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/ocitysmap2/__init__.py b/ocitysmap2/__init__.py
index ceba182..eccf448 100644
--- a/ocitysmap2/__init__.py
+++ b/ocitysmap2/__init__.py
@@ -529,12 +529,6 @@ SELECT ST_AsText(ST_LongestLine(
 
         surface = factory(renderer.paper_width_pt, renderer.paper_height_pt)
 
-        # Set a white background
-        ctx = cairo.Context(surface)
-        ctx.set_source_rgb(1, 1, 1)
-        ctx.rectangle(0, 0, renderer.paper_width_pt, renderer.paper_height_pt)
-        ctx.fill()
-
         renderer.render(surface, dpi, osm_date)
 
         LOG.debug('Writing %s...' % output_filename)
diff --git a/ocitysmap2/layoutlib/single_page_renderers.py 
b/ocitysmap2/layoutlib/single_page_renderers.py
index 51c778f..0ac066c 100644
--- a/ocitysmap2/layoutlib/single_page_renderers.py
+++ b/ocitysmap2/layoutlib/single_page_renderers.py
@@ -335,6 +335,14 @@ class SinglePageRenderer(Renderer):
 
         ctx = cairo.Context(cairo_surface)
 
+        # Set a white background
+        ctx.save()
+        ctx.set_source_rgb(1, 1, 1)
+        ctx.rectangle(0, 0, commons.convert_pt_to_dots(self.paper_width_pt, 
dpi),
+                      commons.convert_pt_to_dots(self.paper_height_pt, dpi))
+        ctx.fill()
+        ctx.restore()
+
         ##
         ## Draw the index, when applicable
         ##
-- 
1.7.5.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]