[PATCH 34/45] [WinHelp]: now also writing metafiles to RTF stream
Eric Pouech
eric.pouech at orange.fr
Sun Mar 23 04:20:46 CDT 2008
A+
---
programs/winhelp/hlpfile.c | 33 ++++++++++++++-------------------
1 files changed, 14 insertions(+), 19 deletions(-)
diff --git a/programs/winhelp/hlpfile.c b/programs/winhelp/hlpfile.c
index 28f8b8a..19549f2 100644
--- a/programs/winhelp/hlpfile.c
+++ b/programs/winhelp/hlpfile.c
@@ -753,24 +753,24 @@ done:
*
*
*/
-static BOOL HLPFILE_RtfAddMetaFile(BYTE* beg, BYTE pack)
+static BOOL HLPFILE_RtfAddMetaFile(struct RtfData* rd, BYTE* beg, BYTE pack)
{
-#if 0
BYTE* ptr;
unsigned long size, csize;
unsigned long off, hsoff;
BYTE* bits;
- LPMETAFILEPICT lpmfp;
+ char tmp[256];
+ unsigned mm;
+ BOOL ret;
WINE_TRACE("Loading metafile\n");
ptr = beg + 2; /* for type and pack */
- lpmfp = ¶graph->u.gfx.u.mfp;
- lpmfp->mm = fetch_ushort(&ptr); /* mapping mode */
-
- lpmfp->xExt = GET_USHORT(ptr, 0);
- lpmfp->yExt = GET_USHORT(ptr, 2);
+ mm = fetch_ushort(&ptr); /* mapping mode */
+ sprintf(tmp, "{\\pict\\wmetafile%d\\picw%d\\pich%d",
+ mm, GET_USHORT(ptr, 0), GET_USHORT(ptr, 2));
+ if (!HLPFILE_RtfAddControl(rd, tmp)) return FALSE;
ptr += 4;
size = fetch_ulong(&ptr); /* decompressed size */
@@ -780,23 +780,18 @@ static BOOL HLPFILE_RtfAddMetaFile(BYTE* beg, BYTE pack)
hsoff = GET_UINT(ptr, 4);
ptr += 8;
- WINE_TRACE("sz=%lu csz=%lu (%d,%d) offs=%lu/%u,%lu\n",
- size, csize, lpmfp->xExt, lpmfp->yExt, off, ptr - beg, hsoff);
+ WINE_TRACE("sz=%lu csz=%lu offs=%lu/%u,%lu\n",
+ size, csize, off, ptr - beg, hsoff);
bits = HLPFILE_DecompressGfx(beg + off, csize, size, pack);
if (!bits) return FALSE;
- paragraph->cookie = para_metafile;
-
- lpmfp->hMF = SetMetaFileBitsEx(size, bits);
-
- if (!lpmfp->hMF)
- WINE_FIXME("Couldn't load metafile\n");
+ ret = HLPFILE_RtfAddHexBytes(rd, bits, size) &&
+ HLPFILE_RtfAddControl(rd, "}");
if (bits != beg + off) HeapFree(GetProcessHeap(), 0, bits);
-#endif
- return TRUE;
+ return ret;
}
/******************************************************************
@@ -831,7 +826,7 @@ static BOOL HLPFILE_RtfAddGfxByAddr(struct RtfData* rd, HLPFILE *hlpfile,
HLPFILE_RtfAddBitmap(rd, beg, type, pack);
break;
case 8:
- HLPFILE_RtfAddMetaFile(beg, pack);
+ HLPFILE_RtfAddMetaFile(rd, beg, pack);
break;
default: WINE_FIXME("Unknown type %u\n", type); return FALSE;
}
More information about the wine-patches
mailing list