From ed29c905a8090c5a2fbe6028fa73dd17cd9659e8 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 17 Dec 2001 21:01:58 +0000 Subject: [PATCH] Changed 16-bit GDI Enum* functions to not use thunks, now that 16-bit Winelib is no longer supported. --- dlls/gdi/.cvsignore | 7 ++-- dlls/gdi/Makefile.in | 3 +- dlls/gdi/gdi.spec | 10 +++--- dlls/gdi/thunk.c | 85 -------------------------------------------- objects/font.c | 11 ++++-- objects/gdiobj.c | 9 +++-- objects/linedda.c | 29 +++++++++++++++ objects/metafile.c | 11 ++++-- 8 files changed, 61 insertions(+), 104 deletions(-) delete mode 100644 dlls/gdi/thunk.c diff --git a/dlls/gdi/.cvsignore b/dlls/gdi/.cvsignore index e290b63ef00..c72e4305c2c 100644 --- a/dlls/gdi/.cvsignore +++ b/dlls/gdi/.cvsignore @@ -1,7 +1,8 @@ -*.spec.c -*.spec.glue.s Makefile +dispdib.spec.c +gdi.spec.c +gdi32.spec.c printdrv.glue.c -thunk.glue.c version.res version16.res +wing.spec.c diff --git a/dlls/gdi/Makefile.in b/dlls/gdi/Makefile.in index d7450ae99c2..ae344c07ff7 100644 --- a/dlls/gdi/Makefile.in +++ b/dlls/gdi/Makefile.in @@ -15,7 +15,6 @@ C_SRCS = \ freetype.c \ gdi_main.c \ printdrv.c \ - thunk.c \ wing.c RC_SRCS= \ @@ -24,7 +23,7 @@ RC_SRCS= \ RC_SRCS16= \ version16.rc -GLUE = printdrv.c thunk.c +GLUE = printdrv.c EXTRA_OBJS = \ $(TOPOBJDIR)/graphics/graphics.o \ diff --git a/dlls/gdi/gdi.spec b/dlls/gdi/gdi.spec index 155bd5b01e7..3154b2b6daa 100644 --- a/dlls/gdi/gdi.spec +++ b/dlls/gdi/gdi.spec @@ -80,8 +80,8 @@ rsrc version16.res 67 pascal16 DPtoLP(word ptr s_word) DPtoLP16 68 pascal16 DeleteDC(word) DeleteDC16 69 pascal16 DeleteObject(word) DeleteObject16 -70 pascal16 EnumFonts(word str segptr long) THUNK_EnumFonts16 -71 pascal16 EnumObjects(word word segptr long) THUNK_EnumObjects16 +70 pascal16 EnumFonts(word str segptr long) EnumFonts16 +71 pascal16 EnumObjects(word word segptr long) EnumObjects16 72 pascal16 EqualRgn(word word) EqualRgn16 73 pascal16 ExcludeVisRect(word s_word s_word s_word s_word) ExcludeVisRect16 74 pascal GetBitmapBits(word long ptr) GetBitmapBits16 @@ -175,7 +175,7 @@ rsrc version16.res 172 pascal16 SetRectRgn(word s_word s_word s_word s_word) SetRectRgn16 173 pascal16 GetClipRgn(word) GetClipRgn16 174 stub BLOAT # W2.0 (only ?) ROTFL ! ;-)) -175 pascal16 EnumMetaFile(word word segptr long) THUNK_EnumMetaFile16 +175 pascal16 EnumMetaFile(word word segptr long) EnumMetaFile16 176 pascal16 PlayMetaFileRecord(word ptr ptr word) PlayMetaFileRecord16 177 stub RCOS # W2.0 (only ?) 178 stub RSIN # W2.0 (only ?) @@ -259,7 +259,7 @@ rsrc version16.res 315 pascal EngineRealizeFontExt(long long long long) EngineRealizeFontExt16 316 stub EngineGetCharWidthStr 317 stub EngineGetGlyphBmpExt -330 pascal16 EnumFontFamilies(word str segptr long) THUNK_EnumFontFamilies16 +330 pascal16 EnumFontFamilies(word str segptr long) EnumFontFamilies16 332 pascal16 GetKerningPairs(word word ptr) GetKerningPairs16 345 pascal16 GetTextAlign(word) GetTextAlign16 346 pascal16 SetTextAlign(word word) SetTextAlign16 @@ -418,7 +418,7 @@ rsrc version16.res 610 pascal16 GdiSignalProc32(long long long word) GdiSignalProc 611 stub GetRandomRgn 612 pascal16 GetTextCharset(word) GetTextCharset16 -613 pascal16 EnumFontFamiliesEx(word ptr segptr long long) THUNK_EnumFontFamiliesEx16 +613 pascal16 EnumFontFamiliesEx(word ptr segptr long long) EnumFontFamiliesEx16 614 stub AddLpkToGDI 615 stub GetCharacterPlacement 616 pascal GetFontLanguageInfo(word) GetFontLanguageInfo16 diff --git a/dlls/gdi/thunk.c b/dlls/gdi/thunk.c deleted file mode 100644 index 63d2611e727..00000000000 --- a/dlls/gdi/thunk.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * GDI 16-bit thunks - * - * Copyright 1996, 1997 Alexandre Julliard - * Copyright 1998 Ulrich Weigand - */ - -#include "windef.h" -#include "wingdi.h" -#include "wine/wingdi16.h" -#include "callback.h" - -/* ### start build ### */ -extern WORD CALLBACK THUNK_CallTo16_word_ll (FARPROC16,LONG,LONG); -extern WORD CALLBACK THUNK_CallTo16_word_llwl (FARPROC16,LONG,LONG,WORD,LONG); -extern WORD CALLBACK THUNK_CallTo16_word_wllwl(FARPROC16,WORD,LONG,LONG,WORD,LONG); -extern WORD CALLBACK THUNK_CallTo16_word_wwl (FARPROC16,WORD,WORD,LONG); -/* ### stop build ### */ - - -/*********************************************************************** - * EnumObjects (GDI.71) - */ -INT16 WINAPI THUNK_EnumObjects16( HDC16 hdc, INT16 nObjType, - GOBJENUMPROC16 func, LPARAM lParam ) -{ - DECL_THUNK( thunk, func, THUNK_CallTo16_word_ll ); - return EnumObjects16( hdc, nObjType, (GOBJENUMPROC16)&thunk, lParam ); -} - - -/************************************************************************* - * EnumFonts (GDI.70) - */ -INT16 WINAPI THUNK_EnumFonts16( HDC16 hdc, LPCSTR lpFaceName, - FONTENUMPROC16 func, LPARAM lParam ) -{ - DECL_THUNK( thunk, func, THUNK_CallTo16_word_llwl ); - return EnumFonts16( hdc, lpFaceName, (FONTENUMPROC16)&thunk, lParam ); -} - -/****************************************************************** - * EnumMetaFile (GDI.175) - */ -BOOL16 WINAPI THUNK_EnumMetaFile16( HDC16 hdc, HMETAFILE16 hmf, - MFENUMPROC16 func, LPARAM lParam ) -{ - DECL_THUNK( thunk, func, THUNK_CallTo16_word_wllwl ); - return EnumMetaFile16( hdc, hmf, (MFENUMPROC16)&thunk, lParam ); -} - - -/************************************************************************* - * EnumFontFamilies (GDI.330) - */ -INT16 WINAPI THUNK_EnumFontFamilies16( HDC16 hdc, LPCSTR lpszFamily, - FONTENUMPROC16 func, LPARAM lParam ) -{ - DECL_THUNK( thunk, func, THUNK_CallTo16_word_llwl ); - return EnumFontFamilies16(hdc, lpszFamily, (FONTENUMPROC16)&thunk, lParam); -} - - -/************************************************************************* - * EnumFontFamiliesEx (GDI.613) - */ -INT16 WINAPI THUNK_EnumFontFamiliesEx16( HDC16 hdc, LPLOGFONT16 lpLF, - FONTENUMPROCEX16 func, LPARAM lParam, - DWORD reserved ) -{ - DECL_THUNK( thunk, func, THUNK_CallTo16_word_llwl ); - return EnumFontFamiliesEx16( hdc, lpLF, (FONTENUMPROCEX16)&thunk, - lParam, reserved ); -} - - -/********************************************************************** - * LineDDA (GDI.100) - */ -void WINAPI LineDDA16( INT16 nXStart, INT16 nYStart, INT16 nXEnd, - INT16 nYEnd, LINEDDAPROC16 func, LPARAM lParam ) -{ - DECL_THUNK( thunk, func, THUNK_CallTo16_word_wwl ); - LineDDA( nXStart, nYStart, nXEnd, nYEnd, (LINEDDAPROC)&thunk, lParam ); -} diff --git a/objects/font.c b/objects/font.c index 0450715df78..3bbcea1387a 100644 --- a/objects/font.c +++ b/objects/font.c @@ -87,6 +87,10 @@ static CHARSETINFO FONT_tci[MAXTCIINDEX] = { { DEFAULT_CHARSET, 0, FS(0)}, }; +/* ### start build ### */ +extern WORD CALLBACK FONT_CallTo16_word_llwl(FONTENUMPROCEX16,LONG,LONG,WORD,LONG); +/* ### stop build ### */ + /*********************************************************************** * LOGFONT conversion functions. */ @@ -630,8 +634,9 @@ static INT FONT_EnumInstance16( LPENUMLOGFONTEXW plf, LPNEWTEXTMETRICEXW ptm, { FONT_EnumLogFontExWTo16(plf, pfe->lpLogFont); FONT_NewTextMetricExWTo16(ptm, pfe->lpTextMetric); - return pfe->lpEnumFunc( pfe->segLogFont, pfe->segTextMetric, - (UINT16)fType, (LPARAM)(pfe->lpData) ); + + return FONT_CallTo16_word_llwl( pfe->lpEnumFunc, pfe->segLogFont, pfe->segTextMetric, + (UINT16)fType, (LPARAM)pfe->lpData ); } #undef pfe return 1; @@ -787,7 +792,7 @@ INT16 WINAPI EnumFontFamilies16( HDC16 hDC, LPCSTR lpFamily, if( lpFamily ) lstrcpynA( lf.lfFaceName, lpFamily, LF_FACESIZE ); else lf.lfFaceName[0] = '\0'; - return EnumFontFamiliesEx16( hDC, &lf, (FONTENUMPROCEX16)efproc, lpData, 0 ); + return EnumFontFamiliesEx16( hDC, &lf, efproc, lpData, 0 ); } /*********************************************************************** diff --git a/objects/gdiobj.c b/objects/gdiobj.c index 1d1f8646df1..bdea0f3f312 100644 --- a/objects/gdiobj.c +++ b/objects/gdiobj.c @@ -29,6 +29,9 @@ DEFAULT_DEBUG_CHANNEL(gdi); +/* ### start build ### */ +extern WORD CALLBACK GDI_CallTo16_word_ll(GOBJENUMPROC16,LONG,LONG); +/* ### stop build ### */ /*********************************************************************** * GDI stock objects @@ -886,7 +889,7 @@ INT16 WINAPI EnumObjects16( HDC16 hdc, INT16 nObjType, pen->lopnWidth.x = 1; pen->lopnWidth.y = 0; pen->lopnColor = solid_colors[i]; - retval = lpEnumFunc( SEGPTR_GET(pen), lParam ); + retval = GDI_CallTo16_word_ll( lpEnumFunc, SEGPTR_GET(pen), lParam ); TRACE("solid pen %08lx, ret=%d\n", solid_colors[i], retval); if (!retval) break; @@ -902,7 +905,7 @@ INT16 WINAPI EnumObjects16( HDC16 hdc, INT16 nObjType, brush->lbStyle = BS_SOLID; brush->lbColor = solid_colors[i]; brush->lbHatch = 0; - retval = lpEnumFunc( SEGPTR_GET(brush), lParam ); + retval = GDI_CallTo16_word_ll( lpEnumFunc, SEGPTR_GET(brush), lParam ); TRACE("solid brush %08lx, ret=%d\n", solid_colors[i], retval); if (!retval) break; @@ -914,7 +917,7 @@ INT16 WINAPI EnumObjects16( HDC16 hdc, INT16 nObjType, brush->lbStyle = BS_HATCHED; brush->lbColor = RGB(0,0,0); brush->lbHatch = i; - retval = lpEnumFunc( SEGPTR_GET(brush), lParam ); + retval = GDI_CallTo16_word_ll( lpEnumFunc, SEGPTR_GET(brush), lParam ); TRACE("hatched brush %d, ret=%d\n", i, retval); if (!retval) break; diff --git a/objects/linedda.c b/objects/linedda.c index 9b7602c7814..f02531677f8 100644 --- a/objects/linedda.c +++ b/objects/linedda.c @@ -9,6 +9,22 @@ #include "wingdi.h" #include "wine/wingdi16.h" +/* ### start build ### */ +extern WORD CALLBACK DDA_CallTo16_word_wwl(LINEDDAPROC16,WORD,WORD,LONG); +/* ### stop build ### */ + +struct linedda16_info +{ + LINEDDAPROC16 proc; + LPARAM param; +}; + + +static void CALLBACK DDA_callback( INT x, INT y, LPARAM param ) +{ + const struct linedda16_info *info = (struct linedda16_info *)param; + DDA_CallTo16_word_wwl( info->proc, x, y, info->param ); +} /********************************************************************** * LineDDA (GDI32.@) @@ -55,3 +71,16 @@ BOOL WINAPI LineDDA(INT nXStart, INT nYStart, INT nXEnd, INT nYEnd, } return TRUE; } + + +/********************************************************************** + * LineDDA (GDI.100) + */ +void WINAPI LineDDA16( INT16 nXStart, INT16 nYStart, INT16 nXEnd, + INT16 nYEnd, LINEDDAPROC16 proc, LPARAM lParam ) +{ + struct linedda16_info info; + info.proc = proc; + info.param = lParam; + LineDDA( nXStart, nYStart, nXEnd, nYEnd, DDA_callback, (LPARAM)&info ); +} diff --git a/objects/metafile.c b/objects/metafile.c index 614953fd9e5..b6b917a703e 100644 --- a/objects/metafile.c +++ b/objects/metafile.c @@ -58,6 +58,10 @@ typedef struct #define MFHEADERSIZE (sizeof(METAHEADER)) #define MFVERSION 0x300 +/* ### start build ### */ +extern WORD CALLBACK MF_CallTo16_word_wllwl(MFENUMPROC16,WORD,LONG,LONG,WORD,LONG); +/* ### stop build ### */ + /****************************************************************** * MF_AddHandle * @@ -614,9 +618,10 @@ BOOL16 WINAPI EnumMetaFile16( HDC16 hdc, HMETAFILE16 hmf, while (offset < (mh->mtSize * 2)) { mr = (METARECORD *)((char *)mh + offset); - if (!lpEnumFunc( hdc, (HANDLETABLE16 *)spht, - (METARECORD *)MAKESEGPTR( seg + (HIWORD(offset) << __AHSHIFT), LOWORD(offset) ), - mh->mtNoObjects, (LONG)lpData )) + + if (!MF_CallTo16_word_wllwl( lpEnumFunc, hdc, spht, + MAKESEGPTR( seg + (HIWORD(offset) << __AHSHIFT), LOWORD(offset) ), + mh->mtNoObjects, (LONG)lpData )) { result = FALSE; break;