Author: jordi
Date: 2005-03-15 07:11:30 -0500 (Tue, 15 Mar 2005)
New Revision: 41832
Modified:
trunk/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog
trunk/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsState.cs
trunk/mcs/class/System.Drawing/System.Drawing.Drawing2D/Matrix.cs
trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog
trunk/mcs/class/System.Drawing/System.Drawing/Graphics.cs
trunk/mcs/class/System.Drawing/System.Drawing/Pen.cs
Log:
In System.Drawing.Drawing2D:
2005-03-15 Jordi Mas i Hernandez <[EMAIL PROTECTED]>
* GraphicsState.cs: should only contain the nativeState cookie
* Matrix.cs: Fixes Dispose method to allow to be called multiple times
In System.Drawing:
2005-03-15 Jordi Mas i Hernandez <[EMAIL PROTECTED]>
* Pen.cs: Fixes dispose method to allow to be called multiple times
* Graphics.cs: matrix are saved and restored at gdiplus level
Modified: trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog 2005-03-15
12:02:03 UTC (rev 41831)
+++ trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog 2005-03-15
12:11:30 UTC (rev 41832)
@@ -1,3 +1,8 @@
+2005-03-15 Jordi Mas i Hernandez <[EMAIL PROTECTED]>
+
+ * Pen.cs: Fixes dispose method to allow to be called multiple times
+ * Graphics.cs: matrix are saved and restored at gdiplus level
+
2005-02-24 Geoff Norton <[EMAIL PROTECTED]>
* gdipFunctions.cs: Cache the delegates in the GdiPlusStreamHelper
Modified: trunk/mcs/class/System.Drawing/System.Drawing/Graphics.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/Graphics.cs 2005-03-15
12:02:03 UTC (rev 41831)
+++ trunk/mcs/class/System.Drawing/System.Drawing/Graphics.cs 2005-03-15
12:11:30 UTC (rev 41832)
@@ -1606,8 +1606,7 @@
}
public void Restore (GraphicsState gstate)
- {
- Transform = gstate.matrix.Clone ();
+ {
Status status = GDIPlus.GdipRestoreGraphics
(nativeObject, gstate.nativeState);
GDIPlus.CheckStatus (status);
}
@@ -1626,13 +1625,12 @@
}
public GraphicsState Save ()
- {
- GraphicsState state = new GraphicsState ();
- state.matrix = Transform.Clone ();
+ {
uint saveState;
Status status = GDIPlus.GdipSaveGraphics (nativeObject,
out saveState);
GDIPlus.CheckStatus (status);
+ GraphicsState state = new GraphicsState ();
state.nativeState = saveState;
return state;
}
Modified: trunk/mcs/class/System.Drawing/System.Drawing/Pen.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/Pen.cs 2005-03-15
12:02:03 UTC (rev 41831)
+++ trunk/mcs/class/System.Drawing/System.Drawing/Pen.cs 2005-03-15
12:11:30 UTC (rev 41832)
@@ -455,19 +455,23 @@
void Dispose (bool disposing)
{
lock (this){
+ if (isModifiable == false) {
+ throw new ArgumentException ("This Pen
object can't be modified.");
+ }
+
// Pen is disposed if and only if it is not
disposed and
// it is modifiable OR it is not disposed and
it is being
// collected by GC.
- if (! disposed) {
+ if (!disposed) {
if (isModifiable || disposing == false)
{
- Status status =
GDIPlus.GdipDeletePen (nativeObject);
- GDIPlus.CheckStatus (status);
- nativeObject = IntPtr.Zero;
- disposed = true;
+ if (nativeObject !=
IntPtr.Zero) {
+ Status status =
GDIPlus.GdipDeletePen (nativeObject);
+ GDIPlus.CheckStatus
(status);
+ nativeObject =
IntPtr.Zero;
+ disposed = true;
+ }
}
- }
- else
- throw new ArgumentException ("This Pen
object can't be modified.");
+ }
}
}
Modified: trunk/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog
2005-03-15 12:02:03 UTC (rev 41831)
+++ trunk/mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog
2005-03-15 12:11:30 UTC (rev 41832)
@@ -1,3 +1,8 @@
+2005-03-15 Jordi Mas i Hernandez <[EMAIL PROTECTED]>
+
+ * GraphicsState.cs: should only contain the nativeState cookie
+ * Matrix.cs: Fixes Dispose method to allow to be called multiple times
+
2005-01-02 Geoff Norton <[EMAIL PROTECTED]>
* GraphicsPath.cs: Fixed the AddPoints methods. Fixes bug #70916
Modified:
trunk/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsState.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsState.cs
2005-03-15 12:02:03 UTC (rev 41831)
+++ trunk/mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsState.cs
2005-03-15 12:11:30 UTC (rev 41832)
@@ -37,14 +37,15 @@
/// </summary>
public sealed class GraphicsState : MarshalByRefObject
{
+ // All members inherited
+ internal uint nativeState;
+
// Constructor
internal GraphicsState()
{
// Nothing to be done here
}
- // All members inherited
- internal Matrix matrix;
- internal uint nativeState;
+
}
}
Modified: trunk/mcs/class/System.Drawing/System.Drawing.Drawing2D/Matrix.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing.Drawing2D/Matrix.cs
2005-03-15 12:02:03 UTC (rev 41831)
+++ trunk/mcs/class/System.Drawing/System.Drawing.Drawing2D/Matrix.cs
2005-03-15 12:11:30 UTC (rev 41832)
@@ -131,8 +131,13 @@
public void Dispose ()
{
- Status status = GDIPlus.GdipDeleteMatrix (nativeMatrix);
- GDIPlus.CheckStatus (status);
+ if (nativeMatrix != IntPtr.Zero) {
+ Status status = GDIPlus.GdipDeleteMatrix
(nativeMatrix);
+ GDIPlus.CheckStatus (status);
+ nativeMatrix = IntPtr.Zero;
+ }
+
+ GC.SuppressFinalize (true);
}
public override bool Equals (object obj)
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches