[gnome-nibbles] Don't reload the pixmaps unless the tilesize actually changes



commit bac49516a3a9af6464db7bef416076ac1b566d73
Author: Bryan Quigley <bryanquigs src gnome org>
Date:   Sat Apr 27 11:44:23 2013 -0400

    Don't reload the pixmaps unless the tilesize actually changes

 src/main.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/src/main.c b/src/main.c
index 3978784..6b95698 100644
--- a/src/main.c
+++ b/src/main.c
@@ -197,14 +197,17 @@ configure_event_cb (GtkWidget *widget, GdkEventConfigure *event, gpointer data)
     ts_y--;
   tilesize = MIN (ts_x, ts_y);
 
-  gnibbles_load_pixmap (tilesize);
+  if(tilesize != properties->tilesize)
+  {    
+    gnibbles_load_pixmap (tilesize);
 
-  clutter_actor_set_size (CLUTTER_ACTOR (stage),
+    clutter_actor_set_size (CLUTTER_ACTOR (stage),
                           BOARDWIDTH * tilesize,
                           BOARDHEIGHT * tilesize);
-  if (game_running ()) {
-    if (board) {
-      gnibbles_board_rescale (board, tilesize);
+
+    gnibbles_board_rescale (board, tilesize);
+
+    if (game_running ()) {
       gnibbles_boni_rescale (boni, tilesize);
 
       for (i=0; i<properties->numworms; i++)
@@ -213,11 +216,10 @@ configure_event_cb (GtkWidget *widget, GdkEventConfigure *event, gpointer data)
       if (warpmanager)
         gnibbles_warpmanager_rescale (warpmanager, tilesize);
     }
-  } else
-      gnibbles_board_rescale (board, tilesize);
 
-  properties->tilesize = tilesize;
-  gnibbles_properties_set_tile_size (tilesize);
+    properties->tilesize = tilesize;
+    gnibbles_properties_set_tile_size (tilesize);
+  }
 
   return FALSE;
 }


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