Module: wine Branch: master Commit: 5da401950c65a250af986f1469515313cca2ef47 URL: http://source.winehq.org/git/wine.git/?a=commit;h=5da401950c65a250af986f1469...
Author: Eric Pouech eric.pouech@orange.fr Date: Thu Apr 24 22:06:34 2008 +0200
winhelp: Emit the proper RTF stream for a metafile to RichEdit.
---
programs/winhelp/hlpfile.c | 38 +++++++++++++++++++++++++++++++++++++- 1 files changed, 37 insertions(+), 1 deletions(-)
diff --git a/programs/winhelp/hlpfile.c b/programs/winhelp/hlpfile.c index 6417c90..f5935a1 100644 --- a/programs/winhelp/hlpfile.c +++ b/programs/winhelp/hlpfile.c @@ -806,7 +806,43 @@ done: */ static BOOL HLPFILE_RtfAddMetaFile(struct RtfData* rd, BYTE* beg, BYTE pack) { - return TRUE; + BYTE* ptr; + unsigned long size, csize; + unsigned long off, hsoff; + BYTE* bits; + char tmp[256]; + unsigned mm; + BOOL ret; + + WINE_TRACE("Loading metafile\n"); + + ptr = beg + 2; /* for type and pack */ + + 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 */ + csize = fetch_ulong(&ptr); /* compressed size */ + fetch_ulong(&ptr); /* hotspot size */ + off = GET_UINT(ptr, 0); + hsoff = GET_UINT(ptr, 4); + ptr += 8; + + 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; + + ret = HLPFILE_RtfAddHexBytes(rd, bits, size) && + HLPFILE_RtfAddControl(rd, "}"); + + if (bits != beg + off) HeapFree(GetProcessHeap(), 0, bits); + + return ret; }
/******************************************************************