pngtile.tile: fix render_region centering
authorTero Marttila <terom@paivola.fi>
Mon, 15 Sep 2014 00:49:15 +0300
changeset 144 5b2b866ad0a3
parent 143 22efa9fe73c8
child 145 51908b0cc3a1
pngtile.tile: fix render_region centering
pngtile/tile.py
--- a/pngtile/tile.py	Mon Sep 15 00:15:51 2014 +0300
+++ b/pngtile/tile.py	Mon Sep 15 00:49:15 2014 +0300
@@ -39,7 +39,7 @@
         Scale value about center by zoom.
     """
 
-    return scale(val - dim / 2, zoom)
+    return scale(val, zoom) - dim / 2
 
 class TileApplication (BaseApplication):
     def __init__ (self, **opts):
@@ -63,8 +63,8 @@
         if zoom > MAX_ZOOM:
             raise exceptions.BadRequest("Image zoom: %d > %d" % (zoom, MAX_ZOOM))
 
-        x = scale(x, zoom)
-        y = scale(y, zoom)
+        x = scale_center(x, width, zoom)
+        y = scale_center(y, height, zoom)
         
         try:
             return image.tile_mem(width, height, x, y, zoom)