Commit 5811a2cc authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Use the official constants instead of the old Win9x magic numbers for GDI object types.

parent d0e77f8a
......@@ -281,8 +281,7 @@ HBITMAP WINAPI CreateBitmapIndirect( const BITMAP *bmp )
}
/* Create the BITMAPOBJ */
bmpobj = GDI_AllocObject( sizeof(BITMAPOBJ), BITMAP_MAGIC,
(HGDIOBJ *)&hbitmap, &bitmap_funcs );
bmpobj = GDI_AllocObject( sizeof(BITMAPOBJ), OBJ_BITMAP, (HGDIOBJ *)&hbitmap, &bitmap_funcs );
if (!bmpobj)
{
......@@ -325,7 +324,7 @@ LONG WINAPI GetBitmapBits(
LONG count, /* [in] Number of bytes to copy */
LPVOID bits) /* [out] Pointer to buffer to receive bits */
{
BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP );
LONG height, ret;
if (!bmp) return 0;
......@@ -436,7 +435,7 @@ LONG WINAPI SetBitmapBits(
LONG count, /* [in] Number of bytes in bitmap array */
LPCVOID bits) /* [in] Address of array with bitmap bits */
{
BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
BITMAPOBJ *bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP );
LONG height, ret;
if ((!bmp) || (!bits))
......@@ -540,7 +539,7 @@ BOOL BITMAP_SetOwnerDC( HBITMAP hbitmap, DC *dc )
/* never set the owner of the stock bitmap since it can be selected in multiple DCs */
if (hbitmap == GetStockObject(DEFAULT_BITMAP)) return TRUE;
if (!(bitmap = GDI_GetObjPtr( hbitmap, BITMAP_MAGIC ))) return FALSE;
if (!(bitmap = GDI_GetObjPtr( hbitmap, OBJ_BITMAP ))) return FALSE;
ret = TRUE;
if (!bitmap->funcs) /* not owned by a DC yet */
......@@ -578,7 +577,7 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
ret = dc->hBitmap;
if (handle == dc->hBitmap) goto done; /* nothing to do */
if (!(bitmap = GDI_GetObjPtr( handle, BITMAP_MAGIC )))
if (!(bitmap = GDI_GetObjPtr( handle, OBJ_BITMAP )))
{
ret = 0;
goto done;
......@@ -626,7 +625,7 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
*/
static BOOL BITMAP_DeleteObject( HGDIOBJ handle )
{
BITMAPOBJ *bmp = GDI_GetObjPtr( handle, BITMAP_MAGIC );
BITMAPOBJ *bmp = GDI_GetObjPtr( handle, OBJ_BITMAP );
if (!bmp) return FALSE;
......@@ -673,7 +672,7 @@ static BOOL BITMAP_DeleteObject( HGDIOBJ handle )
static INT BITMAP_GetObject( HGDIOBJ handle, INT count, LPVOID buffer )
{
INT ret;
BITMAPOBJ *bmp = GDI_GetObjPtr( handle, BITMAP_MAGIC );
BITMAPOBJ *bmp = GDI_GetObjPtr( handle, OBJ_BITMAP );
if (!bmp) return 0;
......@@ -735,7 +734,7 @@ BOOL WINAPI GetBitmapDimensionEx(
HBITMAP hbitmap, /* [in] Handle to bitmap */
LPSIZE size) /* [out] Address of struct receiving dimensions */
{
BITMAPOBJ * bmp = GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
BITMAPOBJ * bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP );
if (!bmp) return FALSE;
*size = bmp->size;
GDI_ReleaseObj( hbitmap );
......@@ -760,7 +759,7 @@ BOOL WINAPI SetBitmapDimensionEx(
INT y, /* [in] Bitmap height */
LPSIZE prevSize) /* [out] Address of structure for orig dims */
{
BITMAPOBJ * bmp = GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
BITMAPOBJ * bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP );
if (!bmp) return FALSE;
if (prevSize) *prevSize = bmp->size;
bmp->size.cx = x;
......
......@@ -104,8 +104,8 @@ HBRUSH WINAPI CreateBrushIndirect( const LOGBRUSH * brush )
BRUSHOBJ * ptr;
HBRUSH hbrush;
if (!(ptr = GDI_AllocObject( sizeof(BRUSHOBJ), BRUSH_MAGIC,
(HGDIOBJ *)&hbrush, &brush_funcs ))) return 0;
if (!(ptr = GDI_AllocObject( sizeof(BRUSHOBJ), OBJ_BRUSH, (HGDIOBJ *)&hbrush, &brush_funcs )))
return 0;
ptr->logbrush.lbStyle = brush->lbStyle;
ptr->logbrush.lbColor = brush->lbColor;
ptr->logbrush.lbHatch = brush->lbHatch;
......@@ -378,7 +378,7 @@ static HGDIOBJ BRUSH_SelectObject( HGDIOBJ handle, HDC hdc )
return 0;
}
if ((brush = GDI_GetObjPtr( handle, BRUSH_MAGIC )))
if ((brush = GDI_GetObjPtr( handle, OBJ_BRUSH )))
{
if (brush->logbrush.lbStyle == BS_PATTERN)
BITMAP_SetOwnerDC( (HBITMAP)brush->logbrush.lbHatch, dc );
......@@ -407,7 +407,7 @@ static HGDIOBJ BRUSH_SelectObject( HGDIOBJ handle, HDC hdc )
*/
static BOOL BRUSH_DeleteObject( HGDIOBJ handle )
{
BRUSHOBJ *brush = GDI_GetObjPtr( handle, BRUSH_MAGIC );
BRUSHOBJ *brush = GDI_GetObjPtr( handle, OBJ_BRUSH );
if (!brush) return FALSE;
switch(brush->logbrush.lbStyle)
......@@ -428,7 +428,7 @@ static BOOL BRUSH_DeleteObject( HGDIOBJ handle )
*/
static INT BRUSH_GetObject( HGDIOBJ handle, INT count, LPVOID buffer )
{
BRUSHOBJ *brush = GDI_GetObjPtr( handle, BRUSH_MAGIC );
BRUSHOBJ *brush = GDI_GetObjPtr( handle, OBJ_BRUSH );
if (!brush) return 0;
if (buffer)
......@@ -465,7 +465,7 @@ BOOL16 WINAPI SetSolidBrush16(HBRUSH16 hBrush, COLORREF newColor )
BOOL16 res = FALSE;
TRACE("(hBrush %04x, newColor %08x)\n", hBrush, newColor);
if (!(brushPtr = GDI_GetObjPtr( HBRUSH_32(hBrush), BRUSH_MAGIC )))
if (!(brushPtr = GDI_GetObjPtr( HBRUSH_32(hBrush), OBJ_BRUSH )))
return FALSE;
if (brushPtr->logbrush.lbStyle == BS_SOLID)
......
......@@ -85,7 +85,7 @@ static inline void create_default_clip_region( DC * dc )
{
UINT width, height;
if (GDIMAGIC( dc->header.wMagic ) == MEMORY_DC_MAGIC)
if (dc->header.type == OBJ_MEMDC)
{
BITMAP bitmap;
......
......@@ -53,13 +53,13 @@ static const struct gdi_obj_funcs dc_funcs =
static inline DC *get_dc_obj( HDC hdc )
{
DC *dc = GDI_GetObjPtr( hdc, MAGIC_DONTCARE );
DC *dc = GDI_GetObjPtr( hdc, 0 );
if (!dc) return NULL;
if ((GDIMAGIC(dc->header.wMagic) != DC_MAGIC) &&
(GDIMAGIC(dc->header.wMagic) != MEMORY_DC_MAGIC) &&
(GDIMAGIC(dc->header.wMagic) != METAFILE_DC_MAGIC) &&
(GDIMAGIC(dc->header.wMagic) != ENHMETAFILE_DC_MAGIC))
if ((dc->header.type != OBJ_DC) &&
(dc->header.type != OBJ_MEMDC) &&
(dc->header.type != OBJ_METADC) &&
(dc->header.type != OBJ_ENHMETADC))
{
GDI_ReleaseObj( hdc );
SetLastError( ERROR_INVALID_HANDLE );
......@@ -161,7 +161,7 @@ BOOL free_dc_ptr( DC *dc )
{
assert( dc->refcount == 1 );
/* grab the gdi lock again */
if (!GDI_GetObjPtr( dc->hSelf, MAGIC_DONTCARE )) return FALSE; /* shouldn't happen */
if (!GDI_GetObjPtr( dc->hSelf, 0 )) return FALSE; /* shouldn't happen */
return GDI_FreeObject( dc->hSelf, dc );
}
......@@ -332,7 +332,7 @@ static HDC GetDCState( HDC hdc )
HGDIOBJ handle;
if (!(dc = get_dc_ptr( hdc ))) return 0;
if (!(newdc = GDI_AllocObject( sizeof(DC), GDIMAGIC(dc->header.wMagic), &handle, &dc_funcs )))
if (!(newdc = GDI_AllocObject( sizeof(DC), dc->header.type, &handle, &dc_funcs )))
{
release_dc_ptr( dc );
return 0;
......@@ -673,7 +673,7 @@ HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
ERR( "no driver found for %s\n", debugstr_w(buf) );
return 0;
}
if (!(dc = alloc_dc_ptr( funcs, DC_MAGIC ))) goto error;
if (!(dc = alloc_dc_ptr( funcs, OBJ_DC ))) goto error;
hdc = dc->hSelf;
dc->hBitmap = GetStockObject( DEFAULT_BITMAP );
......@@ -789,7 +789,7 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
if (!funcs && !(funcs = DRIVER_load_driver( displayW ))) return 0;
if (!(dc = alloc_dc_ptr( funcs, MEMORY_DC_MAGIC ))) goto error;
if (!(dc = alloc_dc_ptr( funcs, OBJ_MEMDC ))) goto error;
TRACE("(%p): returning %p\n", hdc, dc->hSelf );
......
......@@ -235,7 +235,7 @@ INT WINAPI StretchDIBits(HDC hdc, INT xDst, INT yDst, INT widthDst,
dwRop == SRCCOPY)
{
BITMAPOBJ *bmp;
if ((bmp = GDI_GetObjPtr( hBitmap, BITMAP_MAGIC )))
if ((bmp = GDI_GetObjPtr( hBitmap, OBJ_BITMAP )))
{
if (bmp->bitmap.bmBitsPixel == bpp &&
bmp->bitmap.bmWidth == widthSrc &&
......@@ -344,7 +344,7 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
update_dc( dc );
if (!(bitmap = GDI_GetObjPtr( hbitmap, BITMAP_MAGIC )))
if (!(bitmap = GDI_GetObjPtr( hbitmap, OBJ_BITMAP )))
{
release_dc_ptr( dc );
return 0;
......@@ -411,7 +411,7 @@ UINT WINAPI SetDIBColorTable( HDC hdc, UINT startpos, UINT entries, CONST RGBQUA
if (!(dc = get_dc_ptr( hdc ))) return 0;
if ((bitmap = GDI_GetObjPtr( dc->hBitmap, BITMAP_MAGIC )))
if ((bitmap = GDI_GetObjPtr( dc->hBitmap, OBJ_BITMAP )))
{
/* Check if currently selected bitmap is a DIB */
if (bitmap->color_table)
......@@ -448,7 +448,7 @@ UINT WINAPI GetDIBColorTable( HDC hdc, UINT startpos, UINT entries, RGBQUAD *col
result = dc->funcs->pGetDIBColorTable(dc->physDev, startpos, entries, colors);
else
{
BITMAPOBJ *bitmap = GDI_GetObjPtr( dc->hBitmap, BITMAP_MAGIC );
BITMAPOBJ *bitmap = GDI_GetObjPtr( dc->hBitmap, OBJ_BITMAP );
if (bitmap)
{
/* Check if currently selected bitmap is a DIB */
......@@ -609,7 +609,7 @@ INT WINAPI GetDIBits(
return 0;
}
update_dc( dc );
if (!(bmp = GDI_GetObjPtr( hbitmap, BITMAP_MAGIC )))
if (!(bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP )))
{
release_dc_ptr( dc );
return 0;
......@@ -1153,7 +1153,7 @@ HBITMAP16 WINAPI CreateDIBSection16 (HDC16 hdc, const BITMAPINFO *bmi, UINT16 us
hbitmap = CreateDIBSection( HDC_32(hdc), bmi, usage, &bits32, section, offset );
if (hbitmap)
{
BITMAPOBJ *bmp = GDI_GetObjPtr(hbitmap, BITMAP_MAGIC);
BITMAPOBJ *bmp = GDI_GetObjPtr(hbitmap, OBJ_BITMAP);
if (bmp && bmp->dib && bits32)
{
const BITMAPINFOHEADER *bi = &bmi->bmiHeader;
......@@ -1385,7 +1385,7 @@ HBITMAP WINAPI CreateDIBSection(HDC hdc, CONST BITMAPINFO *bmi, UINT usage,
ret = CreateBitmap( dib->dsBm.bmWidth, dib->dsBm.bmHeight, 1,
(bpp == 1) ? 1 : GetDeviceCaps(hdc, BITSPIXEL), NULL );
if (ret && ((bmp = GDI_GetObjPtr(ret, BITMAP_MAGIC))))
if (ret && ((bmp = GDI_GetObjPtr(ret, OBJ_BITMAP))))
{
bmp->dib = dib;
bmp->funcs = dc->funcs;
......
......@@ -261,9 +261,7 @@ HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk )
return 0;
}
metaObj = GDI_AllocObject( sizeof(ENHMETAFILEOBJ),
ENHMETAFILE_MAGIC,
(HGDIOBJ *)&hmf, NULL );
metaObj = GDI_AllocObject( sizeof(ENHMETAFILEOBJ), OBJ_ENHMETAFILE, (HGDIOBJ *)&hmf, NULL );
if (metaObj)
{
metaObj->emh = emh;
......@@ -278,7 +276,7 @@ HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk )
*/
static BOOL EMF_Delete_HENHMETAFILE( HENHMETAFILE hmf )
{
ENHMETAFILEOBJ *metaObj = GDI_GetObjPtr( hmf, ENHMETAFILE_MAGIC );
ENHMETAFILEOBJ *metaObj = GDI_GetObjPtr( hmf, OBJ_ENHMETAFILE );
if(!metaObj) return FALSE;
......@@ -297,7 +295,7 @@ static BOOL EMF_Delete_HENHMETAFILE( HENHMETAFILE hmf )
static ENHMETAHEADER *EMF_GetEnhMetaHeader( HENHMETAFILE hmf )
{
ENHMETAHEADER *ret = NULL;
ENHMETAFILEOBJ *metaObj = GDI_GetObjPtr( hmf, ENHMETAFILE_MAGIC );
ENHMETAFILEOBJ *metaObj = GDI_GetObjPtr( hmf, OBJ_ENHMETAFILE );
TRACE("hmf %p -> enhmetaObj %p\n", hmf, metaObj);
if (metaObj)
{
......
......@@ -315,7 +315,7 @@ HDC WINAPI CreateEnhMetaFileW(
TRACE("%s\n", debugstr_w(filename) );
if (!(dc = alloc_dc_ptr( &EMFDRV_Funcs, ENHMETAFILE_DC_MAGIC ))) return 0;
if (!(dc = alloc_dc_ptr( &EMFDRV_Funcs, OBJ_ENHMETADC ))) return 0;
physDev = HeapAlloc(GetProcessHeap(),0,sizeof(*physDev));
if (!physDev) {
......@@ -438,7 +438,7 @@ HENHMETAFILE WINAPI CloseEnhMetaFile(HDC hdc) /* [in] metafile DC */
TRACE("(%p)\n", hdc );
if (!(dc = get_dc_ptr( hdc ))) return NULL;
if (GDIMAGIC(dc->header.wMagic) != ENHMETAFILE_DC_MAGIC)
if (dc->header.type != OBJ_ENHMETADC)
{
release_dc_ptr( dc );
return NULL;
......
......@@ -345,8 +345,8 @@ HFONT WINAPI CreateFontIndirectW( const LOGFONTW *plf )
if (!plf) return 0;
if (!(fontPtr = GDI_AllocObject( sizeof(FONTOBJ), FONT_MAGIC, (HGDIOBJ *)&hFont,
&font_funcs ))) return 0;
if (!(fontPtr = GDI_AllocObject( sizeof(FONTOBJ), OBJ_FONT, (HGDIOBJ *)&hFont, &font_funcs )))
return 0;
fontPtr->logfont = *plf;
......@@ -486,7 +486,7 @@ static HGDIOBJ FONT_SelectObject( HGDIOBJ handle, HDC hdc )
if (GetDeviceCaps( dc->hSelf, TEXTCAPS ) & TC_VA_ABLE)
{
FONTOBJ *font = GDI_GetObjPtr( handle, FONT_MAGIC ); /* to grab the GDI lock (FIXME) */
FONTOBJ *font = GDI_GetObjPtr( handle, OBJ_FONT ); /* to grab the GDI lock (FIXME) */
dc->gdiFont = WineEngCreateFontInstance( dc, handle );
if (font) GDI_ReleaseObj( handle );
}
......@@ -516,7 +516,7 @@ static HGDIOBJ FONT_SelectObject( HGDIOBJ handle, HDC hdc )
*/
static INT FONT_GetObjectA( HGDIOBJ handle, INT count, LPVOID buffer )
{
FONTOBJ *font = GDI_GetObjPtr( handle, FONT_MAGIC );
FONTOBJ *font = GDI_GetObjPtr( handle, OBJ_FONT );
LOGFONTA lfA;
if (!font) return 0;
......@@ -536,7 +536,7 @@ static INT FONT_GetObjectA( HGDIOBJ handle, INT count, LPVOID buffer )
*/
static INT FONT_GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer )
{
FONTOBJ *font = GDI_GetObjPtr( handle, FONT_MAGIC );
FONTOBJ *font = GDI_GetObjPtr( handle, OBJ_FONT );
if (!font) return 0;
if (buffer)
......@@ -555,7 +555,7 @@ static INT FONT_GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer )
*/
static BOOL FONT_DeleteObject( HGDIOBJ handle )
{
FONTOBJ *obj = GDI_GetObjPtr( handle, FONT_MAGIC ); /* to grab the GDI lock (FIXME) */
FONTOBJ *obj = GDI_GetObjPtr( handle, OBJ_FONT ); /* to grab the GDI lock (FIXME) */
if (!obj) return FALSE;
WineEngDestroyFontInstance( handle );
return GDI_FreeObject( handle, obj );
......@@ -838,7 +838,7 @@ INT WINAPI GetTextFaceW( HDC hdc, INT count, LPWSTR name )
if(dc->gdiFont)
ret = WineEngGetTextFace(dc->gdiFont, count, name);
else if ((font = GDI_GetObjPtr( dc->hFont, FONT_MAGIC )))
else if ((font = GDI_GetObjPtr( dc->hFont, OBJ_FONT )))
{
INT n = strlenW(font->logfont.lfFaceName) + 1;
if (name)
......
......@@ -42,33 +42,6 @@ typedef struct {
/* extra stock object: default 1x1 bitmap for memory DCs */
#define DEFAULT_BITMAP (STOCK_LAST+1)
/* GDI objects magic numbers */
#define FIRST_MAGIC 0x4f47
#define PEN_MAGIC 0x4f47
#define BRUSH_MAGIC 0x4f48
#define FONT_MAGIC 0x4f49
#define PALETTE_MAGIC 0x4f4a
#define BITMAP_MAGIC 0x4f4b
#define REGION_MAGIC 0x4f4c
#define DC_MAGIC 0x4f4d
#define DISABLED_DC_MAGIC 0x4f4e
#define META_DC_MAGIC 0x4f4f
#define METAFILE_MAGIC 0x4f50
#define METAFILE_DC_MAGIC 0x4f51
#define ENHMETAFILE_MAGIC 0x4f52
#define ENHMETAFILE_DC_MAGIC 0x4f53
#define MEMORY_DC_MAGIC 0x4f54
#define EXT_PEN_MAGIC 0x4f55
#define LAST_MAGIC 0x4f55
#define MAGIC_DONTCARE 0xffff
/* GDI constants for making objects private/system (naming undoc. !) */
#define OBJECT_PRIVATE 0x2000
#define OBJECT_NOSYSTEM 0x8000
#define GDIMAGIC(magic) ((magic) & ~(OBJECT_PRIVATE|OBJECT_NOSYSTEM))
struct gdi_obj_funcs
{
HGDIOBJ (*pSelectObject)( HGDIOBJ handle, HDC hdc );
......@@ -86,7 +59,8 @@ struct hdc_list
typedef struct tagGDIOBJHDR
{
WORD wMagic;
WORD type;
WORD system : 1;
DWORD dwCount;
const struct gdi_obj_funcs *funcs;
struct hdc_list *hdcs;
......
......@@ -444,14 +444,8 @@ static const struct DefaultFontInfo default_fonts[] =
*/
void CDECL __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set)
{
GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
/* touch the "system" bit of the wMagic field of a GDIOBJHDR */
if (set)
ptr->wMagic &= ~OBJECT_NOSYSTEM;
else
ptr->wMagic |= OBJECT_NOSYSTEM;
GDIOBJHDR *ptr = GDI_GetObjPtr( handle, 0 );
ptr->system = !!set;
GDI_ReleaseObj( handle );
}
......@@ -532,7 +526,7 @@ BOOL GDI_inc_ref_count( HGDIOBJ handle )
{
GDIOBJHDR *header;
if ((header = GDI_GetObjPtr( handle, MAGIC_DONTCARE )))
if ((header = GDI_GetObjPtr( handle, 0 )))
{
header->dwCount++;
GDI_ReleaseObj( handle );
......@@ -550,7 +544,7 @@ BOOL GDI_dec_ref_count( HGDIOBJ handle )
{
GDIOBJHDR *header;
if ((header = GDI_GetObjPtr( handle, MAGIC_DONTCARE )))
if ((header = GDI_GetObjPtr( handle, 0 )))
{
if (header->dwCount) header->dwCount--;
if (header->dwCount != 0x80000000) GDI_ReleaseObj( handle );
......@@ -666,14 +660,15 @@ static inline GDIOBJHDR *alloc_large_heap( WORD size, HGDIOBJ *handle )
/***********************************************************************
* GDI_AllocObject
*/
void *GDI_AllocObject( WORD size, WORD magic, HGDIOBJ *handle, const struct gdi_obj_funcs *funcs )
void *GDI_AllocObject( WORD size, WORD type, HGDIOBJ *handle, const struct gdi_obj_funcs *funcs )
{
GDIOBJHDR *obj = NULL;
_EnterSysLevel( &GDI_level );
if (!(obj = alloc_large_heap( size, handle ))) goto error;
obj->wMagic = magic|OBJECT_NOSYSTEM;
obj->type = type;
obj->system = 0;
obj->dwCount = 0;
obj->funcs = funcs;
obj->hdcs = NULL;
......@@ -723,8 +718,8 @@ BOOL GDI_FreeObject( HGDIOBJ handle, void *ptr )
GDIOBJHDR *object = ptr;
int i;
object->wMagic = 0; /* Mark it as invalid */
object->funcs = NULL;
object->type = 0; /* Mark it as invalid */
object->funcs = NULL;
i = ((ULONG_PTR)handle >> 2) - FIRST_LARGE_HANDLE;
if (i >= 0 && i < MAX_LARGE_HANDLES)
{
......@@ -745,7 +740,7 @@ BOOL GDI_FreeObject( HGDIOBJ handle, void *ptr )
* Return NULL if the object has the wrong magic number.
* The object must be released with GDI_ReleaseObj.
*/
void *GDI_GetObjPtr( HGDIOBJ handle, WORD magic )
void *GDI_GetObjPtr( HGDIOBJ handle, WORD type )
{
GDIOBJHDR *ptr = NULL;
int i;
......@@ -756,7 +751,7 @@ void *GDI_GetObjPtr( HGDIOBJ handle, WORD magic )
if (i >= 0 && i < MAX_LARGE_HANDLES)
{
ptr = large_handles[i];
if (ptr && (magic != MAGIC_DONTCARE) && (GDIMAGIC(ptr->wMagic) != magic)) ptr = NULL;
if (ptr && type && ptr->type != type) ptr = NULL;
}
if (!ptr)
......@@ -814,10 +809,9 @@ BOOL WINAPI DeleteObject( HGDIOBJ obj )
if (HIWORD(obj)) return FALSE;
if (!(header = GDI_GetObjPtr( obj, MAGIC_DONTCARE ))) return FALSE;
if (!(header = GDI_GetObjPtr( obj, 0 ))) return FALSE;
if (!(header->wMagic & OBJECT_NOSYSTEM)
&& (header->wMagic >= FIRST_MAGIC) && (header->wMagic <= LAST_MAGIC))
if (header->system)
{
TRACE("Preserving system object %p\n", obj);
GDI_ReleaseObj( obj );
......@@ -837,7 +831,7 @@ BOOL WINAPI DeleteObject( HGDIOBJ obj )
{
GDI_ReleaseObj( obj ); /* release the GDI lock */
dc->funcs->pDeleteObject( dc->physDev, obj );
header = GDI_GetObjPtr( obj, MAGIC_DONTCARE ); /* and grab it again */
header = GDI_GetObjPtr( obj, 0 ); /* and grab it again */
}
release_dc_ptr( dc );
}
......@@ -877,10 +871,9 @@ BOOL GDI_hdc_using_object(HGDIOBJ obj, HDC hdc)
TRACE("obj %p hdc %p\n", obj, hdc);
if (!(header = GDI_GetObjPtr( obj, MAGIC_DONTCARE ))) return FALSE;
if (!(header = GDI_GetObjPtr( obj, 0 ))) return FALSE;
if (!(header->wMagic & OBJECT_NOSYSTEM) &&
(header->wMagic >= FIRST_MAGIC) && (header->wMagic <= LAST_MAGIC))
if (header->system)
{
GDI_ReleaseObj(obj);
return FALSE;
......@@ -911,10 +904,9 @@ BOOL GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc)
TRACE("obj %p hdc %p\n", obj, hdc);
if (!(header = GDI_GetObjPtr( obj, MAGIC_DONTCARE ))) return FALSE;
if (!(header = GDI_GetObjPtr( obj, 0 ))) return FALSE;
if (!(header->wMagic & OBJECT_NOSYSTEM) &&
(header->wMagic >= FIRST_MAGIC) && (header->wMagic <= LAST_MAGIC))
if (header->system)
{
GDI_ReleaseObj(obj);
return FALSE;
......@@ -962,7 +954,7 @@ INT WINAPI GetObjectA( HGDIOBJ handle, INT count, LPVOID buffer )
TRACE("%p %d %p\n", handle, count, buffer );
if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) return 0;
if (!(ptr = GDI_GetObjPtr( handle, 0 ))) return 0;
funcs = ptr->funcs;
GDI_ReleaseObj( handle );
......@@ -984,7 +976,7 @@ INT WINAPI GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer )
INT result = 0;
TRACE("%p %d %p\n", handle, count, buffer );
if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) return 0;
if (!(ptr = GDI_GetObjPtr( handle, 0 ))) return 0;
funcs = ptr->funcs;
GDI_ReleaseObj( handle );
......@@ -1002,64 +994,16 @@ INT WINAPI GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer )
DWORD WINAPI GetObjectType( HGDIOBJ handle )
{
GDIOBJHDR * ptr;
INT result = 0;
TRACE("%p\n", handle );
DWORD result;
if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE )))
if (!(ptr = GDI_GetObjPtr( handle, 0 )))
{
SetLastError( ERROR_INVALID_HANDLE );
return 0;
}
switch(GDIMAGIC(ptr->wMagic))
{
case PEN_MAGIC:
result = OBJ_PEN;
break;
case EXT_PEN_MAGIC:
result = OBJ_EXTPEN;
break;
case BRUSH_MAGIC:
result = OBJ_BRUSH;
break;
case BITMAP_MAGIC:
result = OBJ_BITMAP;
break;
case FONT_MAGIC:
result = OBJ_FONT;
break;
case PALETTE_MAGIC:
result = OBJ_PAL;
break;
case REGION_MAGIC:
result = OBJ_REGION;
break;
case DC_MAGIC:
result = OBJ_DC;
break;
case META_DC_MAGIC:
result = OBJ_METADC;
break;
case METAFILE_MAGIC:
result = OBJ_METAFILE;
break;
case METAFILE_DC_MAGIC:
result = OBJ_METADC;
break;
case ENHMETAFILE_MAGIC:
result = OBJ_ENHMETAFILE;
break;
case ENHMETAFILE_DC_MAGIC:
result = OBJ_ENHMETADC;
break;
case MEMORY_DC_MAGIC:
result = OBJ_MEMDC;
break;
default:
FIXME("Magic %04x not implemented\n", GDIMAGIC(ptr->wMagic) );
break;
}
result = ptr->type;
GDI_ReleaseObj( handle );
TRACE("%p -> %u\n", handle, result );
return result;
}
......@@ -1134,7 +1078,7 @@ HGDIOBJ WINAPI SelectObject( HDC hdc, HGDIOBJ hObj )
TRACE( "(%p,%p)\n", hdc, hObj );
header = GDI_GetObjPtr( hObj, MAGIC_DONTCARE );
header = GDI_GetObjPtr( hObj, 0 );
if (header)
{
const struct gdi_obj_funcs *funcs = header->funcs;
......@@ -1151,7 +1095,7 @@ HGDIOBJ WINAPI SelectObject( HDC hdc, HGDIOBJ hObj )
BOOL WINAPI UnrealizeObject( HGDIOBJ obj )
{
BOOL result = FALSE;
GDIOBJHDR * header = GDI_GetObjPtr( obj, MAGIC_DONTCARE );
GDIOBJHDR * header = GDI_GetObjPtr( obj, 0 );
if (header)
{
......@@ -1259,21 +1203,10 @@ void WINAPI SetObjectOwner( HGDIOBJ handle, HANDLE owner )
* What does that mean ?
* Some little docu can be found in "Undocumented Windows",
* but this is basically useless.
* At least we know that this flags the GDI object's wMagic
* with 0x2000 (OBJECT_PRIVATE), so we just do it.
* But Wine doesn't react on that yet.
*/
void WINAPI MakeObjectPrivate16( HGDIOBJ16 handle16, BOOL16 private )
{
HGDIOBJ handle = HGDIOBJ_32( handle16 );
GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
if (!ptr)
{
ERR("invalid GDI object %p !\n", handle);
return;
}
ptr->wMagic |= OBJECT_PRIVATE;
GDI_ReleaseObj( handle );
FIXME( "stub: %x %u\n", handle16, private );
}
......
......@@ -108,8 +108,7 @@ static int MF_AddHandle(HANDLETABLE *ht, UINT htlen, HGDIOBJ hobj)
HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh)
{
HMETAFILE hmf = 0;
METAFILEOBJ *metaObj = GDI_AllocObject( sizeof(METAFILEOBJ), METAFILE_MAGIC,
(HGDIOBJ *)&hmf, NULL );
METAFILEOBJ *metaObj = GDI_AllocObject( sizeof(METAFILEOBJ), OBJ_METAFILE, (HGDIOBJ *)&hmf, NULL );
if (metaObj)
{
metaObj->mh = mh;
......@@ -126,7 +125,7 @@ HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh)
static METAHEADER *MF_GetMetaHeader( HMETAFILE hmf )
{
METAHEADER *ret = NULL;
METAFILEOBJ * metaObj = GDI_GetObjPtr( hmf, METAFILE_MAGIC );
METAFILEOBJ * metaObj = GDI_GetObjPtr( hmf, OBJ_METAFILE );
if (metaObj)
{
ret = metaObj->mh;
......@@ -164,7 +163,7 @@ static POINT *convert_points( UINT count, POINT16 *pt16 )
BOOL WINAPI DeleteMetaFile( HMETAFILE hmf )
{
METAFILEOBJ * metaObj = GDI_GetObjPtr( hmf, METAFILE_MAGIC );
METAFILEOBJ * metaObj = GDI_GetObjPtr( hmf, OBJ_METAFILE );
if (!metaObj) return FALSE;
HeapFree( GetProcessHeap(), 0, metaObj->mh );
GDI_FreeObject( hmf, metaObj );
......
......@@ -166,7 +166,7 @@ static DC *MFDRV_AllocMetaFile(void)
DC *dc;
METAFILEDRV_PDEVICE *physDev;
if (!(dc = alloc_dc_ptr( &MFDRV_Funcs, METAFILE_DC_MAGIC ))) return NULL;
if (!(dc = alloc_dc_ptr( &MFDRV_Funcs, OBJ_METADC ))) return NULL;
physDev = HeapAlloc(GetProcessHeap(),0,sizeof(*physDev));
if (!physDev)
......@@ -308,7 +308,7 @@ static DC *MFDRV_CloseMetaFile( HDC hdc )
TRACE("(%p)\n", hdc );
if (!(dc = get_dc_ptr( hdc ))) return NULL;
if (GDIMAGIC(dc->header.wMagic) != METAFILE_DC_MAGIC)
if (dc->header.type != OBJ_METADC)
{
release_dc_ptr( dc );
return NULL;
......
......@@ -150,8 +150,7 @@ HPALETTE WINAPI CreatePalette(
size = sizeof(LOGPALETTE) + (palette->palNumEntries - 1) * sizeof(PALETTEENTRY);
if (!(palettePtr = GDI_AllocObject( size + sizeof(int*) +sizeof(GDIOBJHDR),
PALETTE_MAGIC, (HGDIOBJ *)&hpalette,
&palette_funcs ))) return 0;
OBJ_PAL, (HGDIOBJ *)&hpalette, &palette_funcs ))) return 0;
memcpy( &palettePtr->logpalette, palette, size );
palettePtr->funcs = NULL;
GDI_ReleaseObj( hpalette );
......@@ -278,7 +277,7 @@ UINT WINAPI GetPaletteEntries(
TRACE("hpal = %p, count=%i\n", hpalette, count );
palPtr = GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
palPtr = GDI_GetObjPtr( hpalette, OBJ_PAL );
if (!palPtr) return 0;
/* NOTE: not documented but test show this to be the case */
......@@ -328,7 +327,7 @@ UINT WINAPI SetPaletteEntries(
TRACE("hpal=%p,start=%i,count=%i\n",hpalette,start,count );
if (hpalette == GetStockObject(DEFAULT_PALETTE)) return 0;
palPtr = GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
palPtr = GDI_GetObjPtr( hpalette, OBJ_PAL );
if (!palPtr) return 0;
numEntries = palPtr->logpalette.palNumEntries;
......@@ -359,7 +358,7 @@ BOOL WINAPI ResizePalette(
HPALETTE hPal, /* [in] Handle of logical palette */
UINT cEntries) /* [in] Number of entries in logical palette */
{
PALETTEOBJ * palPtr = GDI_GetObjPtr( hPal, PALETTE_MAGIC );
PALETTEOBJ * palPtr = GDI_GetObjPtr( hPal, OBJ_PAL );
UINT cPrevEnt, prevVer;
int prevsize, size = sizeof(LOGPALETTE) + (cEntries - 1) * sizeof(PALETTEENTRY);
......@@ -409,7 +408,7 @@ BOOL WINAPI AnimatePalette(
UINT pal_entries;
const PALETTEENTRY *pptr = PaletteColors;
palPtr = GDI_GetObjPtr( hPal, PALETTE_MAGIC );
palPtr = GDI_GetObjPtr( hPal, OBJ_PAL );
if (!palPtr) return 0;
pal_entries = palPtr->logpalette.palNumEntries;
......@@ -536,7 +535,7 @@ UINT WINAPI GetNearestPaletteIndex(
HPALETTE hpalette, /* [in] Handle of logical color palette */
COLORREF color) /* [in] Color to be matched */
{
PALETTEOBJ* palObj = GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
PALETTEOBJ* palObj = GDI_GetObjPtr( hpalette, OBJ_PAL );
UINT index = 0;
if( palObj )
......@@ -632,7 +631,7 @@ COLORREF WINAPI GetNearestColor(
*/
static INT PALETTE_GetObject( HGDIOBJ handle, INT count, LPVOID buffer )
{
PALETTEOBJ *palette = GDI_GetObjPtr( handle, PALETTE_MAGIC );
PALETTEOBJ *palette = GDI_GetObjPtr( handle, OBJ_PAL );
if (!palette) return 0;
......@@ -652,7 +651,7 @@ static INT PALETTE_GetObject( HGDIOBJ handle, INT count, LPVOID buffer )
*/
static BOOL PALETTE_UnrealizeObject( HGDIOBJ handle )
{
PALETTEOBJ *palette = GDI_GetObjPtr( handle, PALETTE_MAGIC );
PALETTEOBJ *palette = GDI_GetObjPtr( handle, OBJ_PAL );
if (palette)
{
......@@ -677,7 +676,7 @@ static BOOL PALETTE_DeleteObject( HGDIOBJ handle )
PALETTEOBJ *obj;
PALETTE_UnrealizeObject( handle );
if (!(obj = GDI_GetObjPtr( handle, PALETTE_MAGIC ))) return FALSE;
if (!(obj = GDI_GetObjPtr( handle, OBJ_PAL ))) return FALSE;
return GDI_FreeObject( handle, obj );
}
......@@ -732,7 +731,7 @@ UINT WINAPI GDIRealizePalette( HDC hdc )
{
if (dc->funcs->pRealizePalette)
{
PALETTEOBJ *palPtr = GDI_GetObjPtr( dc->hPalette, PALETTE_MAGIC );
PALETTEOBJ *palPtr = GDI_GetObjPtr( dc->hPalette, OBJ_PAL );
if (palPtr)
{
realized = dc->funcs->pRealizePalette( dc->physDev, dc->hPalette,
......
......@@ -87,8 +87,7 @@ HPEN WINAPI CreatePenIndirect( const LOGPEN * pen )
if (hpen) return hpen;
}
if (!(penPtr = GDI_AllocObject( sizeof(PENOBJ), PEN_MAGIC, (HGDIOBJ *)&hpen,
&pen_funcs ))) return 0;
if (!(penPtr = GDI_AllocObject( sizeof(PENOBJ), OBJ_PEN, (HGDIOBJ *)&hpen, &pen_funcs ))) return 0;
if (pen->lopnStyle == PS_USERSTYLE || pen->lopnStyle == PS_ALTERNATE)
penPtr->logpen.elpPenStyle = PS_SOLID;
else
......@@ -199,8 +198,7 @@ HPEN WINAPI ExtCreatePen( DWORD style, DWORD width,
if (!(penPtr = GDI_AllocObject( sizeof(PENOBJ) +
style_count * sizeof(DWORD) - sizeof(penPtr->logpen.elpStyleEntry),
EXT_PEN_MAGIC, (HGDIOBJ *)&hpen,
&pen_funcs ))) return 0;
OBJ_EXTPEN, (HGDIOBJ *)&hpen, &pen_funcs ))) return 0;
penPtr->logpen.elpPenStyle = style;
penPtr->logpen.elpWidth = abs(width);
......@@ -256,7 +254,7 @@ static HGDIOBJ PEN_SelectObject( HGDIOBJ handle, HDC hdc )
*/
static BOOL PEN_DeleteObject( HGDIOBJ handle )
{
PENOBJ *pen = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
PENOBJ *pen = GDI_GetObjPtr( handle, 0 );
if (!pen) return FALSE;
return GDI_FreeObject( handle, pen );
......@@ -268,14 +266,14 @@ static BOOL PEN_DeleteObject( HGDIOBJ handle )
*/
static INT PEN_GetObject( HGDIOBJ handle, INT count, LPVOID buffer )
{
PENOBJ *pen = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
PENOBJ *pen = GDI_GetObjPtr( handle, 0 );
INT ret = 0;
if (!pen) return 0;
switch (GDIMAGIC(pen->header.wMagic))
switch (pen->header.type)
{
case PEN_MAGIC:
case OBJ_PEN:
{
LOGPEN *lp;
......@@ -300,7 +298,7 @@ static INT PEN_GetObject( HGDIOBJ handle, INT count, LPVOID buffer )
break;
}
case EXT_PEN_MAGIC:
case OBJ_EXTPEN:
ret = sizeof(EXTLOGPEN) + pen->logpen.elpNumEntries * sizeof(DWORD) - sizeof(pen->logpen.elpStyleEntry);
if (buffer)
{
......
......@@ -513,8 +513,7 @@ static HRGN REGION_CreateRegion( INT n )
HRGN hrgn;
RGNOBJ *obj;
if(!(obj = GDI_AllocObject( sizeof(RGNOBJ), REGION_MAGIC, (HGDIOBJ *)&hrgn,
&region_funcs ))) return 0;
if(!(obj = GDI_AllocObject( sizeof(RGNOBJ), OBJ_REGION, (HGDIOBJ *)&hrgn, &region_funcs ))) return 0;
if(!(obj->rgn = REGION_AllocWineRegion(n))) {
GDI_FreeObject( hrgn, obj );
return 0;
......@@ -537,7 +536,7 @@ static void REGION_DestroyWineRegion( WINEREGION* pReg )
*/
static BOOL REGION_DeleteObject( HGDIOBJ handle )
{
RGNOBJ *rgn = GDI_GetObjPtr( handle, REGION_MAGIC );
RGNOBJ *rgn = GDI_GetObjPtr( handle, OBJ_REGION );
if (!rgn) return FALSE;
REGION_DestroyWineRegion( rgn->rgn );
......@@ -602,7 +601,7 @@ static void REGION_OffsetRegion( WINEREGION *rgn, WINEREGION *srcrgn,
*/
INT WINAPI OffsetRgn( HRGN hrgn, INT x, INT y )
{
RGNOBJ * obj = GDI_GetObjPtr( hrgn, REGION_MAGIC );
RGNOBJ * obj = GDI_GetObjPtr( hrgn, OBJ_REGION );
INT ret;
TRACE("%p %d,%d\n", hrgn, x, y);
......@@ -637,7 +636,7 @@ INT WINAPI OffsetRgn( HRGN hrgn, INT x, INT y )
*/
INT WINAPI GetRgnBox( HRGN hrgn, LPRECT rect )
{
RGNOBJ * obj = GDI_GetObjPtr( hrgn, REGION_MAGIC );
RGNOBJ * obj = GDI_GetObjPtr( hrgn, OBJ_REGION );
if (obj)
{
INT ret;
......@@ -728,7 +727,7 @@ BOOL WINAPI SetRectRgn( HRGN hrgn, INT left, INT top,
TRACE("%p %d,%d-%d,%d\n", hrgn, left, top, right, bottom );
if (!(obj = GDI_GetObjPtr( hrgn, REGION_MAGIC ))) return FALSE;
if (!(obj = GDI_GetObjPtr( hrgn, OBJ_REGION ))) return FALSE;
if (left > right) { INT tmp = left; left = right; right = tmp; }
if (top > bottom) { INT tmp = top; top = bottom; bottom = tmp; }
......@@ -801,7 +800,7 @@ HRGN WINAPI CreateRoundRectRgn( INT left, INT top,
d = (ellipse_height < 128) ? ((3 * ellipse_height) >> 2) : 64;
if (!(hrgn = REGION_CreateRegion(d))) return 0;
if (!(obj = GDI_GetObjPtr( hrgn, REGION_MAGIC ))) return 0;
if (!(obj = GDI_GetObjPtr( hrgn, OBJ_REGION ))) return 0;
TRACE("(%d,%d-%d,%d %dx%d): ret=%p\n",
left, top, right, bottom, ellipse_width, ellipse_height, hrgn );
......@@ -952,7 +951,7 @@ HRGN WINAPI CreateEllipticRgnIndirect( const RECT *rect )
DWORD WINAPI GetRegionData(HRGN hrgn, DWORD count, LPRGNDATA rgndata)
{
DWORD size;
RGNOBJ *obj = GDI_GetObjPtr( hrgn, REGION_MAGIC );
RGNOBJ *obj = GDI_GetObjPtr( hrgn, OBJ_REGION );
TRACE(" %p count = %d, rgndata = %p\n", hrgn, count, rgndata);
......@@ -1066,7 +1065,7 @@ HRGN WINAPI ExtCreateRegion( const XFORM* lpXform, DWORD dwCount, const RGNDATA*
if( (hrgn = REGION_CreateRegion( rgndata->rdh.nCount )) )
{
RECT *pCurRect, *pEndRect;
RGNOBJ *obj = GDI_GetObjPtr( hrgn, REGION_MAGIC );
RGNOBJ *obj = GDI_GetObjPtr( hrgn, OBJ_REGION );
if (obj) {
pEndRect = (RECT *)rgndata->Buffer + rgndata->rdh.nCount;
......@@ -1105,7 +1104,7 @@ BOOL WINAPI PtInRegion( HRGN hrgn, INT x, INT y )
RGNOBJ * obj;
BOOL ret = FALSE;
if ((obj = GDI_GetObjPtr( hrgn, REGION_MAGIC )))
if ((obj = GDI_GetObjPtr( hrgn, OBJ_REGION )))
{
int i;
......@@ -1140,7 +1139,7 @@ BOOL WINAPI RectInRegion( HRGN hrgn, const RECT *rect )
RGNOBJ * obj;
BOOL ret = FALSE;
if ((obj = GDI_GetObjPtr( hrgn, REGION_MAGIC )))
if ((obj = GDI_GetObjPtr( hrgn, OBJ_REGION )))
{
RECT *pCurRect, *pRectEnd;
......@@ -1190,9 +1189,9 @@ BOOL WINAPI EqualRgn( HRGN hrgn1, HRGN hrgn2 )
RGNOBJ *obj1, *obj2;
BOOL ret = FALSE;
if ((obj1 = GDI_GetObjPtr( hrgn1, REGION_MAGIC )))
if ((obj1 = GDI_GetObjPtr( hrgn1, OBJ_REGION )))
{
if ((obj2 = GDI_GetObjPtr( hrgn2, REGION_MAGIC )))
if ((obj2 = GDI_GetObjPtr( hrgn2, OBJ_REGION )))
{
int i;
......@@ -1250,12 +1249,12 @@ static void REGION_UnionRectWithRegion(const RECT *rect, WINEREGION *rgn)
BOOL REGION_FrameRgn( HRGN hDest, HRGN hSrc, INT x, INT y )
{
BOOL bRet;
RGNOBJ *srcObj = GDI_GetObjPtr( hSrc, REGION_MAGIC );
RGNOBJ *srcObj = GDI_GetObjPtr( hSrc, OBJ_REGION );
if (!srcObj) return FALSE;
if (srcObj->rgn->numRects != 0)
{
RGNOBJ* destObj = GDI_GetObjPtr( hDest, REGION_MAGIC );
RGNOBJ* destObj = GDI_GetObjPtr( hDest, OBJ_REGION );
WINEREGION *tmprgn = REGION_AllocWineRegion( srcObj->rgn->numRects);
REGION_OffsetRegion( destObj->rgn, srcObj->rgn, -x, 0);
......@@ -1308,13 +1307,13 @@ BOOL REGION_FrameRgn( HRGN hDest, HRGN hSrc, INT x, INT y )
*/
INT WINAPI CombineRgn(HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode)
{
RGNOBJ *destObj = GDI_GetObjPtr( hDest, REGION_MAGIC);
RGNOBJ *destObj = GDI_GetObjPtr( hDest, OBJ_REGION );
INT result = ERROR;
TRACE(" %p,%p -> %p mode=%x\n", hSrc1, hSrc2, hDest, mode );
if (destObj)
{
RGNOBJ *src1Obj = GDI_GetObjPtr( hSrc1, REGION_MAGIC);
RGNOBJ *src1Obj = GDI_GetObjPtr( hSrc1, OBJ_REGION );
if (src1Obj)
{
......@@ -1328,7 +1327,7 @@ INT WINAPI CombineRgn(HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode)
}
else
{
RGNOBJ *src2Obj = GDI_GetObjPtr( hSrc2, REGION_MAGIC);
RGNOBJ *src2Obj = GDI_GetObjPtr( hSrc2, OBJ_REGION );
if (src2Obj)
{
......@@ -2788,7 +2787,7 @@ HRGN WINAPI CreatePolyPolygonRgn(const POINT *Pts, const INT *Count,
if(!(hrgn = REGION_CreateRegion(nbpolygons)))
return 0;
obj = GDI_GetObjPtr( hrgn, REGION_MAGIC );
obj = GDI_GetObjPtr( hrgn, OBJ_REGION );
region = obj->rgn;
/* special case a rectangle */
......
......@@ -144,7 +144,7 @@ HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 hdc, BITMAPINFO *bmpi,
*/
SEGPTR WINAPI WinGGetDIBPointer16(HBITMAP16 hWinGBitmap, BITMAPINFO* bmpi)
{
BITMAPOBJ* bmp = GDI_GetObjPtr( HBITMAP_32(hWinGBitmap), BITMAP_MAGIC );
BITMAPOBJ* bmp = GDI_GetObjPtr( HBITMAP_32(hWinGBitmap), OBJ_BITMAP );
SEGPTR res = 0;
TRACE("(%d,%p)\n", hWinGBitmap, bmpi);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment