[gcompris] geography, in shapegame engine, no more zoom small puzzle parts



commit 911e00bf8ca8f360c99e2413ca31eab024709611
Author: Bruno Coudoin <bruno coudoin gcompris net>
Date:   Sat Aug 11 21:21:39 2012 +0200

    geography, in shapegame engine, no more zoom small puzzle parts
    
    When small part are zoomed, it is too hard to place them.

 src/babymatch-activity/shapegame.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/babymatch-activity/shapegame.c b/src/babymatch-activity/shapegame.c
index 1892cdc..49b5a25 100644
--- a/src/babymatch-activity/shapegame.c
+++ b/src/babymatch-activity/shapegame.c
@@ -747,17 +747,19 @@ add_shape_to_list_of_shapes(Shape *shape)
 	      Shape *icon_shape;
 
 	      /* Calc a zoom factor so that the shape will fit in the shapelist
-		 whatever its current size */
-	      w = ICON_WIDTH;
+		 whatever its current size
+		 but do not zoom that much small parts */
+	      w = MIN( ICON_WIDTH, gdk_pixbuf_get_width(pixmap) );
 	      h = gdk_pixbuf_get_height(pixmap) * (w / gdk_pixbuf_get_width(pixmap));
-	      z = ICON_WIDTH / gdk_pixbuf_get_width(pixmap);
+	      z = w / gdk_pixbuf_get_width(pixmap);
 
 	      if(h > ICON_HEIGHT)
 		{
-		  h = ICON_HEIGHT;
+		  h = MIN( ICON_HEIGHT, gdk_pixbuf_get_height(pixmap) );
 		  w = gdk_pixbuf_get_width(pixmap) * ( h / gdk_pixbuf_get_height(pixmap));
-		  z = ICON_HEIGHT / gdk_pixbuf_get_height(pixmap);
+		  z = h / gdk_pixbuf_get_height(pixmap);
 		}
+
 	      if(h < 20 || w < 20)
 		{
 		  GdkPixbuf *scale, *hand;



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