Author: spouliot
Date: 2007-03-23 07:26:23 -0500 (Fri, 23 Mar 2007)
New Revision: 74868
Modified:
trunk/libgdiplus/src/ChangeLog
trunk/libgdiplus/src/metafile.c
Log:
2007-03-23 Sebastien Pouliot <[EMAIL PROTECTED]>
* metafile.c: More endian fixes (EMF headers)
Modified: trunk/libgdiplus/src/ChangeLog
===================================================================
--- trunk/libgdiplus/src/ChangeLog 2007-03-23 12:08:37 UTC (rev 74867)
+++ trunk/libgdiplus/src/ChangeLog 2007-03-23 12:26:23 UTC (rev 74868)
@@ -1,3 +1,7 @@
+2007-03-23 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * metafile.c: More endian fixes (EMF headers)
+
2007-03-22 Sebastien Pouliot <[EMAIL PROTECTED]>
* emfcodec.h: Some endian fixes.
Modified: trunk/libgdiplus/src/metafile.c
===================================================================
--- trunk/libgdiplus/src/metafile.c 2007-03-23 12:08:37 UTC (rev 74867)
+++ trunk/libgdiplus/src/metafile.c 2007-03-23 12:26:23 UTC (rev 74868)
@@ -1089,6 +1089,37 @@
#endif
}
+static void
+EnhMetaHeaderLE (ENHMETAHEADER3 *emf)
+{
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+ /* emf->iType is already adjusted */
+ emf->nSize = GUINT32_FROM_LE (emf->nSize);
+ emf->rclBounds.left = GUINT32_FROM_LE (emf->rclBounds.left);
+ emf->rclBounds.top = GUINT32_FROM_LE (emf->rclBounds.top);
+ emf->rclBounds.right = GUINT32_FROM_LE (emf->rclBounds.right);
+ emf->rclBounds.bottom = GUINT32_FROM_LE (emf->rclBounds.bottom);
+ emf->rclFrame.left = GUINT32_FROM_LE (emf->rclFrame.left);
+ emf->rclFrame.top = GUINT32_FROM_LE (emf->rclFrame.top);
+ emf->rclFrame.right = GUINT32_FROM_LE (emf->rclFrame.right);
+ emf->rclFrame.bottom = GUINT32_FROM_LE (emf->rclFrame.bottom);
+ emf->dSignature = GUINT32_FROM_LE (emf->dSignature);
+ emf->nVersion = GUINT32_FROM_LE (emf->nVersion);
+ emf->nBytes = GUINT32_FROM_LE (emf->nBytes);
+ emf->nRecords = GUINT32_FROM_LE (emf->nRecords);
+ emf->nHandles = GUINT32_FROM_LE (emf->nHandles);
+
+ emf->sReserved = GUINT32_FROM_LE (emf->sReserved);
+ emf->nDescription = GUINT32_FROM_LE (emf->nDescription);
+ emf->offDescription = GUINT32_FROM_LE (emf->offDescription);
+ emf->nPalEntries = GUINT32_FROM_LE (emf->nPalEntries);
+ emf->szlDevice.cx = GUINT32_FROM_LE (emf->szlDevice.cx);
+ emf->szlDevice.cy = GUINT32_FROM_LE (emf->szlDevice.cy);
+ emf->szlMillimeters.cx = GUINT32_FROM_LE (emf->szlMillimeters.cx);
+ emf->szlMillimeters.cy = GUINT32_FROM_LE (emf->szlMillimeters.cy);
+#endif
+}
+
static GpStatus
combine_headers (GDIPCONST WmfPlaceableFileHeader *wmfPlaceableFileHeader,
MetafileHeader *header)
{
@@ -1201,6 +1232,7 @@
size = sizeof (ENHMETAHEADER3) - size;
if (gdip_read_emf_data (pointer, (void*)(&header->EmfHeader) +
sizeof (DWORD), size, useFile) != size)
return InvalidParameter;
+ EnhMetaHeaderLE (&header->EmfHeader);
#if FALSE
g_warning ("EMF HEADER iType %d, nSize %d, Bounds L %d, T %d, R %d, B %d,
Frame L %d, T %d, R %d, B %d, signature %X, version %d, bytes %d, records %d,
handles %d, reserved %d, description %d, %d, palentries %d, device %d, %d,
millimeters %d, %d",
emf->iType, emf->nSize,
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches