[libchamplain] Make sure ChamplainView is pixel-aligned



commit 8b93ffbdb4b0115573cc711d417180ad95bd7760
Author: Jiří Techet <techet gmail com>
Date:   Thu May 2 21:16:08 2013 +0200

    Make sure ChamplainView is pixel-aligned
    
    Even when the view size is odd.

 champlain/champlain-view.c |   12 ++++++------
 demos/launcher-gtk.c       |    2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index 212b91a..8b45b2e 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -353,15 +353,15 @@ resize_viewport (ChamplainView *view)
   champlain_viewport_get_adjustments (CHAMPLAIN_VIEWPORT (priv->viewport), &hadjust,
       &vadjust);
 
-  gdouble map_width = champlain_map_source_get_column_count (priv->map_source, priv->zoom_level) *
+  gint map_width = champlain_map_source_get_column_count (priv->map_source, priv->zoom_level) *
     champlain_map_source_get_tile_size (priv->map_source);
-  gdouble map_height = champlain_map_source_get_row_count (priv->map_source, priv->zoom_level) *
+  gint map_height = champlain_map_source_get_row_count (priv->map_source, priv->zoom_level) *
     champlain_map_source_get_tile_size (priv->map_source);
   
-  lower_x = MIN (-priv->viewport_width / 2.0, -priv->viewport_width + map_width / 2.0);
-  lower_y = MIN (-priv->viewport_height / 2.0, -priv->viewport_height + map_height / 2.0);
-  upper_x = MAX (map_width - priv->viewport_width / 2.0, map_width / 2.0);
-  upper_y = MAX (map_height - priv->viewport_height / 2.0, map_height / 2.0);
+  lower_x = MIN (-priv->viewport_width / 2, -priv->viewport_width + map_width / 2);
+  lower_y = MIN (-priv->viewport_height / 2, -priv->viewport_height + map_height / 2);
+  upper_x = MAX (map_width - priv->viewport_width / 2, map_width / 2);
+  upper_y = MAX (map_height - priv->viewport_height / 2, map_height / 2);
 
   /*
    * block emmision of signal by priv->viewport with viewport_pos_changed_cb()
diff --git a/demos/launcher-gtk.c b/demos/launcher-gtk.c
index 6458e93..730f237 100644
--- a/demos/launcher-gtk.c
+++ b/demos/launcher-gtk.c
@@ -286,7 +286,7 @@ main (int argc,
   append_point (path_layer, 45.4151, -73.1218);
   champlain_view_add_layer (view, CHAMPLAIN_LAYER (path_layer));
 
-  gtk_widget_set_size_request (widget, 640, 480);
+  gtk_widget_set_size_request (widget, 640, 481);
 
   bbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
   button = gtk_button_new_from_stock (GTK_STOCK_ZOOM_IN);


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