[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mono-patches
Subject:    [Mono-patches] mcs/class/System.Drawing/System.Drawing ChangeLog,1.241,1.242 Graphics.cs,1.75,1.76
From:       jackson () mono-cvs ! ximian ! com (Jackson Harper (jacksonh () telus ! net))
Date:       2004-09-29 20:26:56
Message-ID: 20040929202656.6F64B94762 () mono-cvs ! ximian ! com
[Download RAW message or body]

Update of /cvs/public/mcs/class/System.Drawing/System.Drawing
In directory mono-cvs.ximian.com:/tmp/cvs-serv21381/System.Drawing

Modified Files:
	ChangeLog Graphics.cs 
Log Message:
	* Graphics.cs: Use FromHdcInternal to set the X display
	handle. Add a flag to check if we are on unix so we aren't calling
	Environment.OSVersion.Platform all the time. Mad props to Peter
	Bartok for this.



Index: ChangeLog
===================================================================
RCS file: /cvs/public/mcs/class/System.Drawing/System.Drawing/ChangeLog,v
retrieving revision 1.241
retrieving revision 1.242
diff -u -d -r1.241 -r1.242
--- ChangeLog	17 Sep 2004 12:10:46 -0000	1.241
+++ ChangeLog	29 Sep 2004 20:26:54 -0000	1.242
@@ -1,3 +1,10 @@
+2004-09-29  Jackson Harper  <jackson@ximian.com>
+
+	* Graphics.cs: Use FromHdcInternal to set the X display
+	handle. Add a flag to check if we are on unix so we aren't calling
+	Environment.OSVersion.Platform all the time. Mad props to Peter
+	Bartok for this.
+
 2004-09-17  Marek Safar <marek.safar@seznam.cz>
 
 	* Font.cs (FromHfont, ToHfont): Fixed windows implementation.

Index: Graphics.cs
===================================================================
RCS file: /cvs/public/mcs/class/System.Drawing/System.Drawing/Graphics.cs,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- Graphics.cs	17 Sep 2004 12:10:46 -0000	1.75
+++ Graphics.cs	29 Sep 2004 20:26:54 -0000	1.76
@@ -47,6 +47,7 @@
 		private static float defDpiX = 0;
 		private static float defDpiY = 0;
 		private static IntPtr display = IntPtr.Zero;
+		private static bool use_x_drawable = false;
 	
 		[ComVisible(false)]
 		public delegate bool EnumerateMetafileProc (EmfPlusRecordType recordType,
@@ -61,6 +62,9 @@
 		private Graphics (IntPtr nativeGraphics)
 		{
 			nativeObject = nativeGraphics;
+                        if (Environment.OSVersion.Platform == (PlatformID) 128) {
+				use_x_drawable = true;
+			}
 		}
 		
 		~Graphics ()
@@ -1244,11 +1248,11 @@
 			throw new NotImplementedException ();
 		}
 
-		[MonoTODO]
 		[EditorBrowsable (EditorBrowsableState.Advanced)]
 		public static Graphics FromHdcInternal (IntPtr hdc)
 		{
-			throw new NotImplementedException ();
+			display = hdc;
+			return null;
 		}
 
 		[EditorBrowsable (EditorBrowsableState.Advanced)]		
@@ -1256,29 +1260,18 @@
 		{
 			IntPtr graphics;
 			
-			// This needs some working over to support wine in the future
-			if (Environment.OSVersion.Platform==(PlatformID)128) {
-
+			if (use_x_drawable) {
 				if (display==IntPtr.Zero) {
-					display=GDIPlus.XOpenDisplay(IntPtr.Zero);
+					display = GDIPlus.XOpenDisplay (IntPtr.Zero);
 				}
-				return FromHwnd(hwnd, display);
+
+				return FromXDrawable (hwnd, display);
 			}
-			Status status = GDIPlus.GdipCreateFromHWND (hwnd, out graphics); 				GDIPlus.CheckStatus (status);
- 			
-			return new Graphics (graphics); 
-		}
+			
+			Status status = GDIPlus.GdipCreateFromHWND (hwnd, out graphics);
+			GDIPlus.CheckStatus (status);
 
-		[EditorBrowsable (EditorBrowsableState.Advanced)]		
-		public static Graphics FromHwnd (IntPtr hwnd, IntPtr display)
-		{
-			lock (typeof (Graphics))
-			{
-				IntPtr graphics;
-				Status s = GDIPlus.GdipCreateFromXDrawable_linux (hwnd, display, out graphics);
-				GDIPlus.CheckStatus (s);
 				return new Graphics (graphics);
-			}
 		}
 
 		[MonoTODO]

_______________________________________________
Mono-patches maillist  -  Mono-patches@ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic