mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-14 17:46:23 +00:00
winhelp: Improved metafile support.
This commit is contained in:
parent
e852f195a0
commit
f9bfbe2e31
|
@ -654,16 +654,17 @@ static BOOL HLPFILE_LoadMetaFile(BYTE* beg, BYTE pack, HLPFILE_PARAGRAPH* pa
|
|||
unsigned long size, csize;
|
||||
unsigned long off, hsoff;
|
||||
BYTE* bits;
|
||||
METAFILEPICT mfp;
|
||||
LPMETAFILEPICT lpmfp;
|
||||
|
||||
WINE_TRACE("Loading metafile\n");
|
||||
|
||||
ptr = beg + 2; /* for type and pack */
|
||||
|
||||
mfp.mm = fetch_ushort(&ptr); /* mapping mode */
|
||||
lpmfp = ¶graph->u.gfx.u.mfp;
|
||||
lpmfp->mm = fetch_ushort(&ptr); /* mapping mode */
|
||||
|
||||
mfp.xExt = GET_USHORT(ptr, 0);
|
||||
mfp.yExt = GET_USHORT(ptr, 2);
|
||||
lpmfp->xExt = GET_USHORT(ptr, 0);
|
||||
lpmfp->yExt = GET_USHORT(ptr, 2);
|
||||
ptr += 4;
|
||||
|
||||
size = fetch_ulong(&ptr); /* decompressed size */
|
||||
|
@ -674,25 +675,20 @@ static BOOL HLPFILE_LoadMetaFile(BYTE* beg, BYTE pack, HLPFILE_PARAGRAPH* pa
|
|||
ptr += 8;
|
||||
|
||||
WINE_TRACE("sz=%lu csz=%lu (%d,%d) offs=%lu/%u,%lu\n",
|
||||
size, csize, mfp.xExt, mfp.yExt, off, ptr - beg, hsoff);
|
||||
size, csize, lpmfp->xExt, lpmfp->yExt, off, ptr - beg, hsoff);
|
||||
|
||||
bits = HLPFILE_DecompressGfx(beg + off, csize, size, pack);
|
||||
if (!bits) return FALSE;
|
||||
|
||||
paragraph->cookie = para_metafile;
|
||||
|
||||
mfp.hMF = NULL;
|
||||
lpmfp->hMF = SetMetaFileBitsEx(size, bits);
|
||||
|
||||
paragraph->u.gfx.u.mf.hMetaFile = SetMetaFileBitsEx(size, bits);
|
||||
|
||||
if (!paragraph->u.gfx.u.mf.hMetaFile)
|
||||
if (!lpmfp->hMF)
|
||||
WINE_FIXME("Couldn't load metafile\n");
|
||||
|
||||
if (bits != beg + off) HeapFree(GetProcessHeap(), 0, bits);
|
||||
|
||||
paragraph->u.gfx.u.mf.mfSize.cx = mfp.xExt;
|
||||
paragraph->u.gfx.u.mf.mfSize.cy = mfp.yExt;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1930,7 +1926,7 @@ static void HLPFILE_DeleteParagraph(HLPFILE_PARAGRAPH* paragraph)
|
|||
next = paragraph->next;
|
||||
|
||||
if (paragraph->cookie == para_metafile)
|
||||
DeleteMetaFile(paragraph->u.gfx.u.mf.hMetaFile);
|
||||
DeleteMetaFile(paragraph->u.gfx.u.mfp.hMF);
|
||||
|
||||
HLPFILE_FreeLink(paragraph->link);
|
||||
|
||||
|
|
|
@ -69,11 +69,7 @@ typedef struct tagHlpFileParagraph
|
|||
{
|
||||
HBITMAP hBitmap;
|
||||
} bmp;
|
||||
struct
|
||||
{
|
||||
HMETAFILE hMetaFile;
|
||||
SIZE mfSize;
|
||||
} mf;
|
||||
METAFILEPICT mfp;
|
||||
} u;
|
||||
} gfx; /* for bitmaps and metafiles */
|
||||
} u;
|
||||
|
|
|
@ -1051,11 +1051,35 @@ static LRESULT CALLBACK WINHELP_TextWndProc(HWND hWnd, UINT msg, WPARAM wParam,
|
|||
break;
|
||||
case hlp_line_part_metafile:
|
||||
{
|
||||
POINT pt;
|
||||
HDC hMemDC;
|
||||
HBITMAP hBitmap;
|
||||
SIZE sz;
|
||||
RECT rc;
|
||||
|
||||
SetViewportOrgEx(hDc, part->rect.left, part->rect.top - scroll_pos, &pt);
|
||||
PlayMetaFile(hDc, part->u.metafile.hMetaFile);
|
||||
SetViewportOrgEx(hDc, pt.x, pt.y, NULL);
|
||||
sz.cx = part->rect.right - part->rect.left;
|
||||
sz.cy = part->rect.bottom - part->rect.top;
|
||||
hMemDC = CreateCompatibleDC(hDc);
|
||||
hBitmap = CreateCompatibleBitmap(hDc, sz.cx, sz.cy);
|
||||
SelectObject(hMemDC, hBitmap);
|
||||
SelectObject(hMemDC, win->hBrush);
|
||||
rc.left = 0;
|
||||
rc.top = 0;
|
||||
rc.right = sz.cx;
|
||||
rc.bottom = sz.cy;
|
||||
FillRect(hMemDC, &rc, win->hBrush);
|
||||
SetMapMode(hMemDC, part->u.metafile.mm);
|
||||
SetWindowExtEx(hMemDC, sz.cx, sz.cy, 0);
|
||||
SetViewportExtEx(hMemDC, sz.cx, sz.cy, 0);
|
||||
SetWindowOrgEx(hMemDC, 0, 0, 0);
|
||||
SetViewportOrgEx(hMemDC, 0, 0, 0);
|
||||
PlayMetaFile(hMemDC, part->u.metafile.hMetaFile);
|
||||
SetMapMode(hMemDC, MM_TEXT);
|
||||
SetWindowOrgEx(hMemDC, 0, 0, 0);
|
||||
SetViewportOrgEx(hMemDC, 0, 0, 0);
|
||||
BitBlt(hDc, part->rect.left, part->rect.top - scroll_pos,
|
||||
sz.cx, sz.cy, hMemDC, 0, 0, SRCCOPY);
|
||||
DeleteDC(hMemDC);
|
||||
DeleteObject(hBitmap);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1578,8 +1602,23 @@ static BOOL WINHELP_SplitLines(HWND hWnd, LPSIZE newsize)
|
|||
gfxSize.cx = dibs.dsBm.bmWidth;
|
||||
gfxSize.cy = dibs.dsBm.bmHeight;
|
||||
}
|
||||
else gfxSize = p->u.gfx.u.mf.mfSize;
|
||||
|
||||
else
|
||||
{
|
||||
LPMETAFILEPICT lpmfp = &p->u.gfx.u.mfp;
|
||||
if (lpmfp->mm == MM_ANISOTROPIC || lpmfp->mm == MM_ISOTROPIC)
|
||||
{
|
||||
gfxSize.cx = MulDiv(lpmfp->xExt, GetDeviceCaps(hDc, HORZRES),
|
||||
100*GetDeviceCaps(hDc, HORZSIZE));
|
||||
gfxSize.cy = MulDiv(lpmfp->yExt, GetDeviceCaps(hDc, VERTRES),
|
||||
100*GetDeviceCaps(hDc, VERTSIZE));
|
||||
}
|
||||
else
|
||||
{
|
||||
gfxSize.cx = lpmfp->xExt;
|
||||
gfxSize.cy = lpmfp->yExt;
|
||||
}
|
||||
}
|
||||
|
||||
free_width = rect.right - ((part && *line) ? (*line)->rect.right : rect.left) - space.cx;
|
||||
if (free_width <= 0)
|
||||
{
|
||||
|
@ -1601,7 +1640,8 @@ static BOOL WINHELP_SplitLines(HWND hWnd, LPSIZE newsize)
|
|||
else
|
||||
{
|
||||
ref_part->cookie = hlp_line_part_metafile;
|
||||
ref_part->u.metafile.hMetaFile = p->u.gfx.u.mf.hMetaFile;
|
||||
ref_part->u.metafile.hMetaFile = p->u.gfx.u.mfp.hMF;
|
||||
ref_part->u.metafile.mm = p->u.gfx.u.mfp.mm;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -62,6 +62,7 @@ typedef struct tagHelpLinePart
|
|||
struct
|
||||
{
|
||||
HMETAFILE hMetaFile;
|
||||
INT mm;
|
||||
} metafile;
|
||||
} u;
|
||||
HLPFILE_LINK* link;
|
||||
|
|
Loading…
Reference in a new issue