In .:
authorGeoff Norton <grompf@sublimeintervention.com>
Fri, 1 Feb 2008 17:41:24 +0000 (17:41 -0000)
committerGeoff Norton <grompf@sublimeintervention.com>
Fri, 1 Feb 2008 17:41:24 +0000 (17:41 -0000)
2008-02-01  Geoff Norton  <gnorton@novell.com>

* carbonFunctions.cs: Ensure we save/restore the GState before
modifying the clipping path as QD contexts can be reused.

2008-02-01  Geoff Norton  <gnorton@novell.com>

* carbonFunction.cs:  Rework the clipping interaction with
CoreGraphics.  Our old method was buggy in certain cases causing
improper / inefficient clip handling.

svn path=/trunk/mcs/; revision=94534

mcs/class/System.Drawing/System.Drawing/ChangeLog
mcs/class/System.Drawing/System.Drawing/carbonFunctions.cs

index 5e391abb88f1a43eff3fda11b78a3f3b4dbb2b4b..6c5f8536cb36fefade1398285c28ebc4b1275ae8 100644 (file)
@@ -1,3 +1,8 @@
+2008-02-01  Geoff Norton  <gnorton@novell.com>
+
+       * carbonFunctions.cs: Ensure we save/restore the GState before
+       modifying the clipping path as QD contexts can be reused.
+
 2008-02-01  Geoff Norton  <gnorton@novell.com>
 
        * carbonFunction.cs:  Rework the clipping interaction with 
index 97beb6e66f13b3c3a29eb7260e68a0d3f84a2e96..ed02a447a0e747137d9b21e414be7cafb7a2c578 100644 (file)
@@ -89,6 +89,8 @@ namespace System.Drawing {
                        // Create the original rect path and clip to it
                        Rect rc_clip = new Rect (0, 0, view_bounds.size.width, view_bounds.size.height);
 
+                       CGContextSaveGState (context);
+
                        Rectangle [] clip_rectangles = (Rectangle []) hwnd_delegate.DynamicInvoke (new object [] {handle});
                        if (clip_rectangles != null && clip_rectangles.Length > 0) {
                                int length = clip_rectangles.Length;
@@ -132,6 +134,8 @@ namespace System.Drawing {
                }
 
                internal static void ReleaseContext (IntPtr port, IntPtr context) {
+                       CGContextRestoreGState (context);
+
                        lock (lockobj) { 
                                if (contextReference [port] != null && context == (IntPtr) contextReference [port]) { 
                                        QDEndCGContext (port, ref context);
@@ -216,6 +220,10 @@ namespace System.Drawing {
                internal static extern void CGContextEOClip (IntPtr context);
                [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
                internal static extern void CGContextEOFillPath (IntPtr context);
+               [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+               internal static extern void CGContextSaveGState (IntPtr context);
+               [DllImport ("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+               internal static extern void CGContextRestoreGState (IntPtr context);
        }
 
        internal struct CGSize {