gbrainy r223 - trunk/src



Author: jmas
Date: Mon Feb 18 17:28:48 2008
New Revision: 223
URL: http://svn.gnome.org/viewvc/gbrainy?rev=223&view=rev

Log:
	* CairoContextEx.cs: Use Gdk.CairoHelper to create contexts
	* GameDrawingArea.cs: Use Gdk.CairoHelper to create contexts
	* CustomGameDialog.cs: Use Gdk.CairoHelper to create contexts

2008-02-18 Jordi Mas <jmas softcatala org>



Modified:
   trunk/src/CairoContextEx.cs
   trunk/src/ChangeLog
   trunk/src/CustomGameDialog.cs
   trunk/src/GameDrawingArea.cs

Modified: trunk/src/CairoContextEx.cs
==============================================================================
--- trunk/src/CairoContextEx.cs	(original)
+++ trunk/src/CairoContextEx.cs	Mon Feb 18 17:28:48 2008
@@ -31,13 +31,9 @@
 
 	}
 	
-	[DllImport("libgdk-x11-2.0.so")]
-	static extern IntPtr gdk_cairo_create(IntPtr drawable);
-	
-	public static CairoContextEx CreateFromGdk (Gdk.Drawable drawable) 
+	// No dispose of resources on this class
+	protected override void Dispose (bool disposing)
 	{
-		IntPtr raw_ret = gdk_cairo_create (drawable == null ? IntPtr.Zero : drawable.Handle);
-		return new CairoContextEx (raw_ret);
 	}
 	
 	public void DrawTextAlignedRight (double x, double y, string str)

Modified: trunk/src/CustomGameDialog.cs
==============================================================================
--- trunk/src/CustomGameDialog.cs	(original)
+++ trunk/src/CustomGameDialog.cs	Mon Feb 18 17:28:48 2008
@@ -214,13 +214,15 @@
 		{
 			if(!IsRealized)
 				return false;
-   
+
 			int w, h;
+			Cairo.Context cc = Gdk.CairoHelper.Create (args.Window);
+			CairoContextEx cr = new CairoContextEx (cc.Handle);   
 			args.Window.GetSize (out w, out h);
-			CairoContextEx cr = CairoContextEx.CreateFromGdk (args.Window);
 			puzzle.DrawPreview (cr, w, h);
 
-   			((IDisposable)cr).Dispose();
+			((IDisposable)cc).Dispose();
+			((IDisposable)cr).Dispose();
    			return base.OnExposeEvent(args);
 		}
 	}	

Modified: trunk/src/GameDrawingArea.cs
==============================================================================
--- trunk/src/GameDrawingArea.cs	(original)
+++ trunk/src/GameDrawingArea.cs	Mon Feb 18 17:28:48 2008
@@ -312,7 +312,8 @@
 
 		int w, h;
 		args.Window.GetSize (out w, out h);
-		CairoContextEx cr = CairoContextEx.CreateFromGdk (args.Window);
+		Cairo.Context cc = Gdk.CairoHelper.Create (args.Window);
+		CairoContextEx cr = new CairoContextEx (cc.Handle);
 
 		switch (mode) {
 		case Modes.Welcome:
@@ -329,6 +330,7 @@
 			break;
 		}
 
+		((IDisposable)cc).Dispose();
 		((IDisposable)cr).Dispose();
 		return base.OnExposeEvent(args);
 	}



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