gnome-games r8663 - trunk/gnometris



Author: jclinton
Date: Thu Feb  5 23:38:51 2009
New Revision: 8663
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8663&view=rev

Log:
Make renderer resilient enough to work even if the caller provides a size of 0

Modified:
   trunk/gnometris/blockops.cpp
   trunk/gnometris/renderer.cpp

Modified: trunk/gnometris/blockops.cpp
==============================================================================
--- trunk/gnometris/blockops.cpp	(original)
+++ trunk/gnometris/blockops.cpp	Thu Feb  5 23:38:51 2009
@@ -448,10 +448,6 @@
 void
 BlockOps::rescaleField ()
 {
-	// don't waste our time if GTK+ is just going through allocation
-	if (width < 1 or height < 1)
-		return;
-
 	ClutterActor *stage;
 	stage = games_clutter_embed_get_stage (GAMES_CLUTTER_EMBED (w));
 

Modified: trunk/gnometris/renderer.cpp
==============================================================================
--- trunk/gnometris/renderer.cpp	(original)
+++ trunk/gnometris/renderer.cpp	Thu Feb  5 23:38:51 2009
@@ -82,15 +82,10 @@
 
 Renderer::Renderer (gint pxw, gint pxh)
 {
-	pxwidth = pxw;
-	pxheight = pxh;
-	if (pxwidth == 0 || pxheight == 0) {
-		for (int i = 0; i<NCOLOURS; i++)
-			cache[i] = NULL;
-	} else {
-		for (int i = 0; i<NCOLOURS; i++) {
-			cache[i] = clutter_cairo_new (pxwidth, pxheight);
-		}
+	pxwidth = pxw == 0 ? 1 : pxw;
+	pxheight = pxh == 0 ? 1 : pxh;
+	for (int i = 0; i<NCOLOURS; i++) {
+		cache[i] = clutter_cairo_new (pxwidth, pxheight);
 	}
 }
 



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