Moved EnumObjects16, LineDDA16 and associated glue code to gdi16.c.

This commit is contained in:
Alexandre Julliard 2002-10-18 23:33:41 +00:00
parent 9a8de13d77
commit fdd6db2384
3 changed files with 89 additions and 99 deletions

View File

@ -30,6 +30,60 @@ WINE_DEFAULT_DEBUG_CHANNEL(gdi);
#define HGDIOBJ_32(handle16) ((HGDIOBJ)(ULONG_PTR)(handle16))
#define HGDIOBJ_16(handle32) ((HGDIOBJ16)(ULONG_PTR)(handle32))
/* ### start build ### */
extern WORD CALLBACK GDI_CallTo16_word_ll(FARPROC16,LONG,LONG);
extern WORD CALLBACK GDI_CallTo16_word_wwl(FARPROC16,WORD,WORD,LONG);
/* ### stop build ### */
struct callback16_info
{
FARPROC16 proc;
LPARAM param;
};
/* callback for LineDDA16 */
static void CALLBACK linedda_callback( INT x, INT y, LPARAM param )
{
const struct callback16_info *info = (struct callback16_info *)param;
GDI_CallTo16_word_wwl( info->proc, x, y, info->param );
}
/* callback for EnumObjects16 */
static INT CALLBACK enum_pens_callback( void *ptr, LPARAM param )
{
const struct callback16_info *info = (struct callback16_info *)param;
LOGPEN *pen = ptr;
LOGPEN16 pen16;
SEGPTR segptr;
INT ret;
pen16.lopnStyle = pen->lopnStyle;
pen16.lopnWidth.x = pen->lopnWidth.x;
pen16.lopnWidth.y = pen->lopnWidth.y;
pen16.lopnColor = pen->lopnColor;
segptr = MapLS( &pen16 );
ret = GDI_CallTo16_word_ll( info->proc, segptr, info->param );
UnMapLS( segptr );
return ret;
}
/* callback for EnumObjects16 */
static INT CALLBACK enum_brushes_callback( void *ptr, LPARAM param )
{
const struct callback16_info *info = (struct callback16_info *)param;
LOGBRUSH *brush = ptr;
LOGBRUSH16 brush16;
SEGPTR segptr;
INT ret;
brush16.lbStyle = brush->lbStyle;
brush16.lbColor = brush->lbColor;
brush16.lbHatch = brush->lbHatch;
segptr = MapLS( &brush16 );
ret = GDI_CallTo16_word_ll( info->proc, segptr, info->param );
UnMapLS( segptr );
return ret;
}
/* convert a LOGFONT16 to a LOGFONTW */
static void logfont_16_to_W( const LOGFONT16 *font16, LPLOGFONTW font32 )
@ -940,6 +994,26 @@ BOOL16 WINAPI DeleteObject16( HGDIOBJ16 obj )
}
/***********************************************************************
* EnumObjects (GDI.71)
*/
INT16 WINAPI EnumObjects16( HDC16 hdc, INT16 obj, GOBJENUMPROC16 proc, LPARAM lParam )
{
struct callback16_info info;
info.proc = (FARPROC16)proc;
info.param = lParam;
switch(obj)
{
case OBJ_PEN:
return EnumObjects( HDC_32(hdc), OBJ_PEN, enum_pens_callback, (LPARAM)&info );
case OBJ_BRUSH:
return EnumObjects( HDC_32(hdc), OBJ_BRUSH, enum_brushes_callback, (LPARAM)&info );
}
return 0;
}
/***********************************************************************
* EqualRgn (GDI.72)
*/
@ -1207,6 +1281,21 @@ DWORD WINAPI GetWindowOrg16( HDC16 hdc )
}
/**********************************************************************
* LineDDA (GDI.100)
*/
void WINAPI LineDDA16( INT16 nXStart, INT16 nYStart, INT16 nXEnd,
INT16 nYEnd, LINEDDAPROC16 proc, LPARAM lParam )
{
struct callback16_info info;
info.proc = (FARPROC16)proc;
info.param = lParam;
LineDDA( nXStart, nYStart, nXEnd, nYEnd, linedda_callback, (LPARAM)&info );
}
/***********************************************************************
* OffsetRgn (GDI.101)
*/

View File

@ -28,7 +28,6 @@
#include "wingdi.h"
#include "winreg.h"
#include "winerror.h"
#include "wine/winbase16.h"
#include "bitmap.h"
#include "font.h"
@ -39,9 +38,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(gdi);
/* ### start build ### */
extern WORD CALLBACK GDI_CallTo16_word_ll(GOBJENUMPROC16,LONG,LONG);
/* ### stop build ### */
/***********************************************************************
* GDI stock objects
@ -1116,70 +1112,6 @@ RGB(0x80,0x00,0x80), RGB(0x00,0x80,0x80),
RGB(0x80,0x80,0x80), RGB(0xc0,0xc0,0xc0)
};
/***********************************************************************
* EnumObjects (GDI.71)
*/
INT16 WINAPI EnumObjects16( HDC16 hdc, INT16 nObjType,
GOBJENUMPROC16 lpEnumFunc, LPARAM lParam )
{
INT16 i, retval = 0;
LOGPEN16 pen;
LOGBRUSH16 brush;
SEGPTR segptr;
TRACE("%04x %d %08lx %08lx\n",
hdc, nObjType, (DWORD)lpEnumFunc, lParam );
switch(nObjType)
{
case OBJ_PEN:
/* Enumerate solid pens */
segptr = MapLS( &pen );
for (i = 0; i < sizeof(solid_colors)/sizeof(solid_colors[0]); i++)
{
pen.lopnStyle = PS_SOLID;
pen.lopnWidth.x = 1;
pen.lopnWidth.y = 0;
pen.lopnColor = solid_colors[i];
retval = GDI_CallTo16_word_ll( lpEnumFunc, segptr, lParam );
TRACE("solid pen %08lx, ret=%d\n", solid_colors[i], retval);
if (!retval) break;
}
UnMapLS( segptr );
break;
case OBJ_BRUSH:
/* Enumerate solid brushes */
segptr = MapLS( &brush );
for (i = 0; i < sizeof(solid_colors)/sizeof(solid_colors[0]); i++)
{
brush.lbStyle = BS_SOLID;
brush.lbColor = solid_colors[i];
brush.lbHatch = 0;
retval = GDI_CallTo16_word_ll( lpEnumFunc, segptr, lParam );
TRACE("solid brush %08lx, ret=%d\n", solid_colors[i], retval);
if (!retval) break;
}
/* Now enumerate hatched brushes */
if (retval) for (i = HS_HORIZONTAL; i <= HS_DIAGCROSS; i++)
{
brush.lbStyle = BS_HATCHED;
brush.lbColor = RGB(0,0,0);
brush.lbHatch = i;
retval = GDI_CallTo16_word_ll( lpEnumFunc, segptr, lParam );
TRACE("hatched brush %d, ret=%d\n", i, retval);
if (!retval) break;
}
UnMapLS( segptr );
break;
default:
WARN("(%d): Invalid type\n", nObjType );
break;
}
return retval;
}
/***********************************************************************
* EnumObjects (GDI32.@)

View File

@ -21,24 +21,6 @@
#include <stdlib.h>
#include "windef.h"
#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.@)
@ -85,16 +67,3 @@ 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 );
}