gnome-games r8669 - trunk/gnometris



Author: jclinton
Date: Fri Feb  6 17:50:42 2009
New Revision: 8669
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8669&view=rev

Log:
Call the rescaleCache() in ctor according to class

This commit solves the vtables issue in the previous commit and now
calls the correct drawCell(), ultimately.

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

Modified: trunk/gnometris/renderer.cpp
==============================================================================
--- trunk/gnometris/renderer.cpp	(original)
+++ trunk/gnometris/renderer.cpp	Fri Feb  6 17:50:42 2009
@@ -62,7 +62,7 @@
 		return new TangoBlock (pxw, pxh, FALSE);
 	case 0:
 	default:
-		return new Renderer (pxw, pxh);
+		return new Renderer (pxw, pxh, FALSE);
 	}
 }
 
@@ -80,14 +80,15 @@
    for the preview widget and possibly the theme previewer, so make no
    assumptions. */
 
-Renderer::Renderer (gint pxw, gint pxh)
+Renderer::Renderer (gint pxw, gint pxh, bool initFromSubclass)
 {
 	pxwidth = pxw == 0 ? 1 : pxw;
 	pxheight = pxh == 0 ? 1 : pxh;
 	for (int i = 0; i < NCOLOURS; i++) {
 		cache[i] = NULL;
 	}
-	rescaleCache (pxwidth, pxheight);
+	if (!initFromSubclass)
+		rescaleCache (pxwidth, pxheight);
 }
 
 Renderer::~Renderer ()
@@ -151,9 +152,10 @@
 	cairo_paint (cr);
 }
 
-TangoBlock::TangoBlock (gint pxw, gint pxh, gboolean grad) : Renderer (pxw, pxh)
+TangoBlock::TangoBlock (gint pxw, gint pxh, gboolean grad) : Renderer (pxw, pxh, TRUE)
 {
 	usegrads = grad;
+	rescaleCache (pxwidth, pxheight);
 }
 
 void TangoBlock::drawCell (cairo_t *cr, guint color)

Modified: trunk/gnometris/renderer.h
==============================================================================
--- trunk/gnometris/renderer.h	(original)
+++ trunk/gnometris/renderer.h	Fri Feb  6 17:50:42 2009
@@ -40,7 +40,7 @@
 
 class Renderer {
 public:
-	Renderer (gint pxw, gint pxh);
+	Renderer (gint pxw, gint pxh, bool initFromSubclass);
 	virtual ~ Renderer ();
 
 	void rescaleCache (gint pxw, gint pxh);



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