Skip to content

Commit

Permalink
Backport r91391, fix for #349103
Browse files Browse the repository at this point in the history
svn path=/branches/mono-1-2-6/mcs/; revision=91399
  • Loading branch information
migueldeicaza committed Dec 17, 2007
1 parent 040ba14 commit cba1442
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
8 changes: 8 additions & 0 deletions mcs/class/System.Drawing/System.Drawing/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2007-12-16 Miguel de Icaza <miguel@novell.com>

[Backport r91391, fix for #349103]

* Image.cs: Use the existing GdipPropertyItem.MarshalTo method to
conver the PropertyItem into a property item with Sequential
attached to it, and pass that to unmanaged code. Fixes #349103.

2007-11-19 Sebastien Pouliot <sebastien@ximian.com>

[Backport r89932]
Expand Down
16 changes: 8 additions & 8 deletions mcs/class/System.Drawing/System.Drawing/Image.cs
Original file line number Diff line number Diff line change
Expand Up @@ -525,16 +525,16 @@ public int SelectActiveFrame(FrameDimension dimension, int frameIndex)

return frameIndex;
}

public void SetPropertyItem(PropertyItem propitem)
{
IntPtr property;
int size = Marshal.SizeOf (typeof(GdipPropertyItem));
property = Marshal.AllocHGlobal (size);

Marshal.StructureToPtr (propitem, property, true);
Status status = GDIPlus.GdipSetPropertyItem (nativeObject, property);
GDIPlus.CheckStatus (status);
GdipPropertyItem pi = new GdipPropertyItem ();
GdipPropertyItem.MarshalTo (pi, propitem);
unsafe {
Status status = GDIPlus.GdipSetPropertyItem (nativeObject, &pi);
GDIPlus.CheckStatus (status);
}
// FIXME: GdipSetPropertyItem isn't implemented in libgdiplus (but returns Ok)
// so who's freeing "property" ? GDI+ ?
}
Expand Down
2 changes: 1 addition & 1 deletion mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ internal static extern Status GdipGetStringFormatMeasurableCharacterRangeCount (
internal static extern Status GdipRemovePropertyItem (IntPtr image, int propertyId);

[DllImport("gdiplus.dll")]
internal static extern Status GdipSetPropertyItem (IntPtr image, IntPtr propertyItem);
internal unsafe static extern Status GdipSetPropertyItem (IntPtr image, GdipPropertyItem *propertyItem);

[DllImport("gdiplus.dll")]
internal static extern Status GdipGetImageThumbnail ( IntPtr image, uint width, uint height, out IntPtr thumbImage, IntPtr callback, IntPtr callBackData );
Expand Down

0 comments on commit cba1442

Please sign in to comment.