Use a different magic for memory DCs and get rid of the DC_MEMORY
flag.
This commit is contained in:
parent
ad9121c4ad
commit
e1147baa00
|
@ -284,8 +284,7 @@ HDC WINAPI CreateEnhMetaFileW(
|
||||||
|
|
||||||
TRACE("%s\n", debugstr_w(filename) );
|
TRACE("%s\n", debugstr_w(filename) );
|
||||||
|
|
||||||
if (!(dc = DC_AllocDC( &EMFDRV_Funcs ))) return 0;
|
if (!(dc = DC_AllocDC( &EMFDRV_Funcs, ENHMETAFILE_DC_MAGIC ))) return 0;
|
||||||
dc->header.wMagic = ENHMETAFILE_DC_MAGIC;
|
|
||||||
|
|
||||||
physDev = (EMFDRV_PDEVICE *)HeapAlloc(GetProcessHeap(),0,sizeof(*physDev));
|
physDev = (EMFDRV_PDEVICE *)HeapAlloc(GetProcessHeap(),0,sizeof(*physDev));
|
||||||
if (!physDev) {
|
if (!physDev) {
|
||||||
|
|
|
@ -154,8 +154,7 @@ static DC *MFDRV_AllocMetaFile(void)
|
||||||
DC *dc;
|
DC *dc;
|
||||||
METAFILEDRV_PDEVICE *physDev;
|
METAFILEDRV_PDEVICE *physDev;
|
||||||
|
|
||||||
if (!(dc = DC_AllocDC( &MFDRV_Funcs ))) return NULL;
|
if (!(dc = DC_AllocDC( &MFDRV_Funcs, METAFILE_DC_MAGIC ))) return NULL;
|
||||||
dc->header.wMagic = METAFILE_DC_MAGIC;
|
|
||||||
|
|
||||||
physDev = (METAFILEDRV_PDEVICE *)HeapAlloc(GetProcessHeap(),0,sizeof(*physDev));
|
physDev = (METAFILEDRV_PDEVICE *)HeapAlloc(GetProcessHeap(),0,sizeof(*physDev));
|
||||||
if (!physDev)
|
if (!physDev)
|
||||||
|
|
|
@ -57,7 +57,7 @@ BOOL TTYDRV_DC_CreateDC(DC *dc, TTYDRV_PDEVICE **pdev, LPCSTR driver, LPCSTR dev
|
||||||
physDev->hdc = dc->hSelf;
|
physDev->hdc = dc->hSelf;
|
||||||
physDev->org.x = physDev->org.y = 0;
|
physDev->org.x = physDev->org.y = 0;
|
||||||
|
|
||||||
if(dc->flags & DC_MEMORY){
|
if(GetObjectType(dc->hSelf) == OBJ_MEMDC) {
|
||||||
physDev->window = NULL;
|
physDev->window = NULL;
|
||||||
physDev->cellWidth = 1;
|
physDev->cellWidth = 1;
|
||||||
physDev->cellHeight = 1;
|
physDev->cellHeight = 1;
|
||||||
|
|
|
@ -953,7 +953,7 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe
|
||||||
}
|
}
|
||||||
else /* color -> color */
|
else /* color -> color */
|
||||||
{
|
{
|
||||||
if (dcSrc->flags & DC_MEMORY)
|
if (GetObjectType(physDevSrc->hdc) == OBJ_MEMDC)
|
||||||
imageSrc = XGetImage( gdi_display, physDevSrc->drawable,
|
imageSrc = XGetImage( gdi_display, physDevSrc->drawable,
|
||||||
physDevSrc->org.x + visRectSrc->left,
|
physDevSrc->org.x + visRectSrc->left,
|
||||||
physDevSrc->org.y + visRectSrc->top,
|
physDevSrc->org.y + visRectSrc->top,
|
||||||
|
@ -1047,7 +1047,7 @@ static int BITBLT_GetDstArea(X11DRV_PDEVICE *physDev, Pixmap pixmap, GC gc, RECT
|
||||||
register INT x, y;
|
register INT x, y;
|
||||||
XImage *image;
|
XImage *image;
|
||||||
|
|
||||||
if (physDev->dc->flags & DC_MEMORY)
|
if (GetObjectType( physDev->hdc ) == OBJ_MEMDC)
|
||||||
image = XGetImage( gdi_display, physDev->drawable,
|
image = XGetImage( gdi_display, physDev->drawable,
|
||||||
physDev->org.x + visRectDst->left,
|
physDev->org.x + visRectDst->left,
|
||||||
physDev->org.y + visRectDst->top,
|
physDev->org.y + visRectDst->top,
|
||||||
|
|
|
@ -5209,7 +5209,7 @@ void X11DRV_DIB_CopyDIBSection(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physD
|
||||||
xSrc, ySrc, xDest, yDest, width, height);
|
xSrc, ySrc, xDest, yDest, width, height);
|
||||||
/* this function is meant as an optimization for BitBlt,
|
/* this function is meant as an optimization for BitBlt,
|
||||||
* not to be called otherwise */
|
* not to be called otherwise */
|
||||||
if (!(dcSrc->flags & DC_MEMORY)) {
|
if (GetObjectType( physDevSrc->hdc ) != OBJ_MEMDC) {
|
||||||
ERR("called for non-memory source DC!?\n");
|
ERR("called for non-memory source DC!?\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -5621,7 +5621,7 @@ INT X11DRV_CoerceDIBSection(X11DRV_PDEVICE *physDev, INT req, BOOL lossy)
|
||||||
INT X11DRV_LockDIBSection(X11DRV_PDEVICE *physDev, INT req, BOOL lossy)
|
INT X11DRV_LockDIBSection(X11DRV_PDEVICE *physDev, INT req, BOOL lossy)
|
||||||
{
|
{
|
||||||
if (!physDev) return DIB_Status_None;
|
if (!physDev) return DIB_Status_None;
|
||||||
if (!(physDev->dc->flags & DC_MEMORY)) return DIB_Status_None;
|
if (GetObjectType( physDev->hdc ) != OBJ_MEMDC) return DIB_Status_None;
|
||||||
|
|
||||||
return X11DRV_LockDIBSection2( physDev->dc->hBitmap, req, lossy );
|
return X11DRV_LockDIBSection2( physDev->dc->hBitmap, req, lossy );
|
||||||
}
|
}
|
||||||
|
@ -5632,7 +5632,7 @@ INT X11DRV_LockDIBSection(X11DRV_PDEVICE *physDev, INT req, BOOL lossy)
|
||||||
void X11DRV_UnlockDIBSection(X11DRV_PDEVICE *physDev, BOOL commit)
|
void X11DRV_UnlockDIBSection(X11DRV_PDEVICE *physDev, BOOL commit)
|
||||||
{
|
{
|
||||||
if (!physDev) return;
|
if (!physDev) return;
|
||||||
if (!(physDev->dc->flags & DC_MEMORY)) return;
|
if (GetObjectType( physDev->hdc ) != OBJ_MEMDC) return;
|
||||||
|
|
||||||
X11DRV_UnlockDIBSection2( physDev->dc->hBitmap, commit );
|
X11DRV_UnlockDIBSection2( physDev->dc->hBitmap, commit );
|
||||||
}
|
}
|
||||||
|
|
|
@ -898,6 +898,7 @@ X11DRV_GetPixel( X11DRV_PDEVICE *physDev, INT x, INT y )
|
||||||
XImage * image;
|
XImage * image;
|
||||||
int pixel;
|
int pixel;
|
||||||
POINT pt;
|
POINT pt;
|
||||||
|
BOOL memdc = (GetObjectType(physDev->hdc) == OBJ_MEMDC);
|
||||||
DC *dc = physDev->dc;
|
DC *dc = physDev->dc;
|
||||||
|
|
||||||
pt.x = x;
|
pt.x = x;
|
||||||
|
@ -908,7 +909,7 @@ X11DRV_GetPixel( X11DRV_PDEVICE *physDev, INT x, INT y )
|
||||||
X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE);
|
X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE);
|
||||||
|
|
||||||
wine_tsx11_lock();
|
wine_tsx11_lock();
|
||||||
if (dc->flags & DC_MEMORY)
|
if (memdc)
|
||||||
{
|
{
|
||||||
image = XGetImage( gdi_display, physDev->drawable,
|
image = XGetImage( gdi_display, physDev->drawable,
|
||||||
physDev->org.x + pt.x, physDev->org.y + pt.y,
|
physDev->org.x + pt.x, physDev->org.y + pt.y,
|
||||||
|
|
|
@ -103,7 +103,7 @@ BOOL X11DRV_CreateDC( DC *dc, X11DRV_PDEVICE **pdev, LPCSTR driver, LPCSTR devic
|
||||||
physDev->hdc = dc->hSelf;
|
physDev->hdc = dc->hSelf;
|
||||||
physDev->dc = dc; /* FIXME */
|
physDev->dc = dc; /* FIXME */
|
||||||
|
|
||||||
if (dc->flags & DC_MEMORY)
|
if (GetObjectType( dc->hSelf ) == OBJ_MEMDC)
|
||||||
{
|
{
|
||||||
physDev->drawable = BITMAP_stock_pixmap;
|
physDev->drawable = BITMAP_stock_pixmap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1233,10 +1233,9 @@ UINT X11DRV_RealizePalette( X11DRV_PDEVICE *physDev, HPALETTE hpal, BOOL primary
|
||||||
*/
|
*/
|
||||||
UINT X11DRV_RealizeDefaultPalette( X11DRV_PDEVICE *physDev )
|
UINT X11DRV_RealizeDefaultPalette( X11DRV_PDEVICE *physDev )
|
||||||
{
|
{
|
||||||
DC *dc = physDev->dc;
|
|
||||||
UINT ret = 0;
|
UINT ret = 0;
|
||||||
|
|
||||||
if (palette_size && !(dc->flags & DC_MEMORY))
|
if (palette_size && GetObjectType(physDev->hdc) != OBJ_MEMDC)
|
||||||
{
|
{
|
||||||
PALETTEOBJ* palPtr = GDI_GetObjPtr( GetStockObject(DEFAULT_PALETTE), PALETTE_MAGIC );
|
PALETTEOBJ* palPtr = GDI_GetObjPtr( GetStockObject(DEFAULT_PALETTE), PALETTE_MAGIC );
|
||||||
if (palPtr)
|
if (palPtr)
|
||||||
|
|
|
@ -41,7 +41,8 @@
|
||||||
#define METAFILE_DC_MAGIC 0x4f51
|
#define METAFILE_DC_MAGIC 0x4f51
|
||||||
#define ENHMETAFILE_MAGIC 0x4f52
|
#define ENHMETAFILE_MAGIC 0x4f52
|
||||||
#define ENHMETAFILE_DC_MAGIC 0x4f53
|
#define ENHMETAFILE_DC_MAGIC 0x4f53
|
||||||
#define LAST_MAGIC 0x4f53
|
#define MEMORY_DC_MAGIC 0x4f54
|
||||||
|
#define LAST_MAGIC 0x4f54
|
||||||
|
|
||||||
#define MAGIC_DONTCARE 0xffff
|
#define MAGIC_DONTCARE 0xffff
|
||||||
|
|
||||||
|
@ -296,7 +297,6 @@ typedef struct tagDC_FUNCS
|
||||||
#define DCHF_VALIDATEVISRGN 0x0002
|
#define DCHF_VALIDATEVISRGN 0x0002
|
||||||
|
|
||||||
/* DC flags */
|
/* DC flags */
|
||||||
#define DC_MEMORY 0x0001 /* It is a memory DC */
|
|
||||||
#define DC_SAVED 0x0002 /* It is a saved DC */
|
#define DC_SAVED 0x0002 /* It is a saved DC */
|
||||||
#define DC_DIRTY 0x0004 /* hVisRgn has to be updated */
|
#define DC_DIRTY 0x0004 /* hVisRgn has to be updated */
|
||||||
#define DC_THUNKHOOK 0x0008 /* DC hook is in the 16-bit code */
|
#define DC_THUNKHOOK 0x0008 /* DC hook is in the 16-bit code */
|
||||||
|
@ -455,7 +455,7 @@ extern BOOL DRIVER_GetDriverName( LPCSTR device, LPSTR driver, DWORD size );
|
||||||
|
|
||||||
extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut );
|
extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut );
|
||||||
|
|
||||||
extern DC * DC_AllocDC( const DC_FUNCTIONS *funcs );
|
extern DC * DC_AllocDC( const DC_FUNCTIONS *funcs, WORD magic );
|
||||||
extern DC * DC_GetDCPtr( HDC hdc );
|
extern DC * DC_GetDCPtr( HDC hdc );
|
||||||
extern DC * DC_GetDCUpdate( HDC hdc );
|
extern DC * DC_GetDCUpdate( HDC hdc );
|
||||||
extern void DC_InitDC( DC * dc );
|
extern void DC_InitDC( DC * dc );
|
||||||
|
|
|
@ -407,7 +407,7 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, void *obj, HDC hdc )
|
||||||
DC *dc = DC_GetDCPtr( hdc );
|
DC *dc = DC_GetDCPtr( hdc );
|
||||||
|
|
||||||
if (!dc) return 0;
|
if (!dc) return 0;
|
||||||
if (!(dc->flags & DC_MEMORY))
|
if (GetObjectType( hdc ) != OBJ_MEMDC)
|
||||||
{
|
{
|
||||||
GDI_ReleaseObj( hdc );
|
GDI_ReleaseObj( hdc );
|
||||||
return 0;
|
return 0;
|
||||||
|
|
73
objects/dc.c
73
objects/dc.c
|
@ -48,12 +48,12 @@ static const struct gdi_obj_funcs dc_funcs =
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* DC_AllocDC
|
* DC_AllocDC
|
||||||
*/
|
*/
|
||||||
DC *DC_AllocDC( const DC_FUNCTIONS *funcs )
|
DC *DC_AllocDC( const DC_FUNCTIONS *funcs, WORD magic )
|
||||||
{
|
{
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
DC *dc;
|
DC *dc;
|
||||||
|
|
||||||
if (!(dc = GDI_AllocObject( sizeof(*dc), DC_MAGIC, (HGDIOBJ*)&hdc, &dc_funcs ))) return NULL;
|
if (!(dc = GDI_AllocObject( sizeof(*dc), magic, (HGDIOBJ*)&hdc, &dc_funcs ))) return NULL;
|
||||||
|
|
||||||
dc->hSelf = hdc;
|
dc->hSelf = hdc;
|
||||||
dc->funcs = funcs;
|
dc->funcs = funcs;
|
||||||
|
@ -130,8 +130,9 @@ DC *DC_GetDCPtr( HDC hdc )
|
||||||
GDIOBJHDR *ptr = GDI_GetObjPtr( hdc, MAGIC_DONTCARE );
|
GDIOBJHDR *ptr = GDI_GetObjPtr( hdc, MAGIC_DONTCARE );
|
||||||
if (!ptr) return NULL;
|
if (!ptr) return NULL;
|
||||||
if ((GDIMAGIC(ptr->wMagic) == DC_MAGIC) ||
|
if ((GDIMAGIC(ptr->wMagic) == DC_MAGIC) ||
|
||||||
(GDIMAGIC(ptr->wMagic) == METAFILE_DC_MAGIC) ||
|
(GDIMAGIC(ptr->wMagic) == MEMORY_DC_MAGIC) ||
|
||||||
(GDIMAGIC(ptr->wMagic) == ENHMETAFILE_DC_MAGIC))
|
(GDIMAGIC(ptr->wMagic) == METAFILE_DC_MAGIC) ||
|
||||||
|
(GDIMAGIC(ptr->wMagic) == ENHMETAFILE_DC_MAGIC))
|
||||||
return (DC *)ptr;
|
return (DC *)ptr;
|
||||||
GDI_ReleaseObj( hdc );
|
GDI_ReleaseObj( hdc );
|
||||||
SetLastError( ERROR_INVALID_HANDLE );
|
SetLastError( ERROR_INVALID_HANDLE );
|
||||||
|
@ -151,18 +152,15 @@ DC *DC_GetDCUpdate( HDC hdc )
|
||||||
if (!dc) return NULL;
|
if (!dc) return NULL;
|
||||||
while (dc->flags & DC_DIRTY)
|
while (dc->flags & DC_DIRTY)
|
||||||
{
|
{
|
||||||
|
DCHOOKPROC proc = dc->hookThunk;
|
||||||
dc->flags &= ~DC_DIRTY;
|
dc->flags &= ~DC_DIRTY;
|
||||||
if (!(dc->flags & (DC_SAVED | DC_MEMORY)))
|
if (proc)
|
||||||
{
|
{
|
||||||
DCHOOKPROC proc = dc->hookThunk;
|
DWORD data = dc->dwHookData;
|
||||||
if (proc)
|
GDI_ReleaseObj( hdc );
|
||||||
{
|
proc( HDC_16(hdc), DCHC_INVALIDVISRGN, data, 0 );
|
||||||
DWORD data = dc->dwHookData;
|
if (!(dc = DC_GetDCPtr( hdc ))) break;
|
||||||
GDI_ReleaseObj( hdc );
|
/* otherwise restart the loop in case it became dirty again in the meantime */
|
||||||
proc( HDC_16(hdc), DCHC_INVALIDVISRGN, data, 0 );
|
|
||||||
if (!(dc = DC_GetDCPtr( hdc ))) break;
|
|
||||||
/* otherwise restart the loop in case it became dirty again in the meantime */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dc;
|
return dc;
|
||||||
|
@ -271,7 +269,7 @@ HDC WINAPI GetDCState( HDC hdc )
|
||||||
HGDIOBJ handle;
|
HGDIOBJ handle;
|
||||||
|
|
||||||
if (!(dc = DC_GetDCPtr( hdc ))) return 0;
|
if (!(dc = DC_GetDCPtr( hdc ))) return 0;
|
||||||
if (!(newdc = GDI_AllocObject( sizeof(DC), DC_MAGIC, &handle, &dc_funcs )))
|
if (!(newdc = GDI_AllocObject( sizeof(DC), GDIMAGIC(dc->header.wMagic), &handle, &dc_funcs )))
|
||||||
{
|
{
|
||||||
GDI_ReleaseObj( hdc );
|
GDI_ReleaseObj( hdc );
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -409,7 +407,7 @@ void WINAPI SetDCState( HDC hdc, HDC hdcs )
|
||||||
dc->vportExtX = dcs->vportExtX;
|
dc->vportExtX = dcs->vportExtX;
|
||||||
dc->vportExtY = dcs->vportExtY;
|
dc->vportExtY = dcs->vportExtY;
|
||||||
|
|
||||||
if (!(dc->flags & DC_MEMORY)) dc->bitsPerPixel = dcs->bitsPerPixel;
|
if (GDIMAGIC(dc->header.wMagic) != MEMORY_DC_MAGIC) dc->bitsPerPixel = dcs->bitsPerPixel;
|
||||||
|
|
||||||
if (dcs->hClipRgn)
|
if (dcs->hClipRgn)
|
||||||
{
|
{
|
||||||
|
@ -586,13 +584,12 @@ HDC WINAPI CreateDCA( LPCSTR driver, LPCSTR device, LPCSTR output,
|
||||||
ERR( "no driver found for %s\n", buf );
|
ERR( "no driver found for %s\n", buf );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!(dc = DC_AllocDC( funcs )))
|
if (!(dc = DC_AllocDC( funcs, DC_MAGIC )))
|
||||||
{
|
{
|
||||||
DRIVER_release_driver( funcs );
|
DRIVER_release_driver( funcs );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc->flags = 0;
|
|
||||||
dc->hBitmap = GetStockObject( DEFAULT_BITMAP );
|
dc->hBitmap = GetStockObject( DEFAULT_BITMAP );
|
||||||
|
|
||||||
TRACE("(driver=%s, device=%s, output=%s): returning %p\n",
|
TRACE("(driver=%s, device=%s, output=%s): returning %p\n",
|
||||||
|
@ -667,20 +664,26 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
|
||||||
{
|
{
|
||||||
DC *dc, *origDC;
|
DC *dc, *origDC;
|
||||||
const DC_FUNCTIONS *funcs;
|
const DC_FUNCTIONS *funcs;
|
||||||
|
PHYSDEV physDev;
|
||||||
|
|
||||||
GDI_CheckNotLock();
|
GDI_CheckNotLock();
|
||||||
|
|
||||||
if ((origDC = GDI_GetObjPtr( hdc, DC_MAGIC )))
|
if ((origDC = GDI_GetObjPtr( hdc, DC_MAGIC )))
|
||||||
{
|
{
|
||||||
funcs = origDC->funcs;
|
funcs = origDC->funcs;
|
||||||
|
physDev = origDC->physDev;
|
||||||
GDI_ReleaseObj( hdc ); /* can't hold the lock while loading the driver */
|
GDI_ReleaseObj( hdc ); /* can't hold the lock while loading the driver */
|
||||||
funcs = DRIVER_get_driver( funcs );
|
funcs = DRIVER_get_driver( funcs );
|
||||||
}
|
}
|
||||||
else funcs = DRIVER_load_driver( "DISPLAY" );
|
else
|
||||||
|
{
|
||||||
|
funcs = DRIVER_load_driver( "DISPLAY" );
|
||||||
|
physDev = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!funcs) return 0;
|
if (!funcs) return 0;
|
||||||
|
|
||||||
if (!(dc = DC_AllocDC( funcs )))
|
if (!(dc = DC_AllocDC( funcs, MEMORY_DC_MAGIC )))
|
||||||
{
|
{
|
||||||
DRIVER_release_driver( funcs );
|
DRIVER_release_driver( funcs );
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -688,21 +691,19 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
|
||||||
|
|
||||||
TRACE("(%p): returning %p\n", hdc, dc->hSelf );
|
TRACE("(%p): returning %p\n", hdc, dc->hSelf );
|
||||||
|
|
||||||
dc->flags = DC_MEMORY;
|
|
||||||
dc->bitsPerPixel = 1;
|
dc->bitsPerPixel = 1;
|
||||||
dc->hBitmap = GetStockObject( DEFAULT_BITMAP );
|
dc->hBitmap = GetStockObject( DEFAULT_BITMAP );
|
||||||
|
|
||||||
/* Copy the driver-specific physical device info into
|
/* Copy the driver-specific physical device info into
|
||||||
* the new DC. The driver may use this read-only info
|
* the new DC. The driver may use this read-only info
|
||||||
* while creating the compatible DC below. */
|
* while creating the compatible DC below. */
|
||||||
if ((origDC = GDI_GetObjPtr( hdc, DC_MAGIC ))) dc->physDev = origDC->physDev;
|
dc->physDev = physDev;
|
||||||
|
|
||||||
if (dc->funcs->pCreateDC &&
|
if (dc->funcs->pCreateDC &&
|
||||||
!dc->funcs->pCreateDC( dc, &dc->physDev, NULL, NULL, NULL, NULL ))
|
!dc->funcs->pCreateDC( dc, &dc->physDev, NULL, NULL, NULL, NULL ))
|
||||||
{
|
{
|
||||||
WARN("creation aborted by device\n");
|
WARN("creation aborted by device\n");
|
||||||
GDI_FreeObject( dc->hSelf, dc );
|
GDI_FreeObject( dc->hSelf, dc );
|
||||||
if (origDC) GDI_ReleaseObj( hdc );
|
|
||||||
DRIVER_release_driver( funcs );
|
DRIVER_release_driver( funcs );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -715,7 +716,6 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
|
||||||
|
|
||||||
DC_InitDC( dc );
|
DC_InitDC( dc );
|
||||||
GDI_ReleaseObj( dc->hSelf );
|
GDI_ReleaseObj( dc->hSelf );
|
||||||
if (origDC) GDI_ReleaseObj( hdc );
|
|
||||||
return dc->hSelf;
|
return dc->hSelf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -732,19 +732,16 @@ BOOL WINAPI DeleteDC( HDC hdc )
|
||||||
|
|
||||||
GDI_CheckNotLock();
|
GDI_CheckNotLock();
|
||||||
|
|
||||||
if (!(dc = GDI_GetObjPtr( hdc, DC_MAGIC ))) return FALSE;
|
if (!(dc = DC_GetDCPtr( hdc ))) return FALSE;
|
||||||
|
|
||||||
/* Call hook procedure to check whether is it OK to delete this DC */
|
/* Call hook procedure to check whether is it OK to delete this DC */
|
||||||
if (dc->hookThunk && !(dc->flags & (DC_SAVED | DC_MEMORY)))
|
if (dc->hookThunk)
|
||||||
{
|
{
|
||||||
DCHOOKPROC proc = dc->hookThunk;
|
DCHOOKPROC proc = dc->hookThunk;
|
||||||
if (proc)
|
DWORD data = dc->dwHookData;
|
||||||
{
|
GDI_ReleaseObj( hdc );
|
||||||
DWORD data = dc->dwHookData;
|
if (!proc( HDC_16(hdc), DCHC_DELETEDC, data, 0 )) return FALSE;
|
||||||
GDI_ReleaseObj( hdc );
|
if (!(dc = DC_GetDCPtr( hdc ))) return TRUE; /* deleted by the hook */
|
||||||
if (!proc( HDC_16(hdc), DCHC_DELETEDC, data, 0 )) return FALSE;
|
|
||||||
if (!(dc = DC_GetDCPtr( hdc ))) return TRUE; /* deleted by the hook */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (dc->saveLevel)
|
while (dc->saveLevel)
|
||||||
|
@ -1141,11 +1138,15 @@ BOOL WINAPI CombineTransform( LPXFORM xformResult, const XFORM *xform1,
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI SetDCHook( HDC hdc, DCHOOKPROC hookProc, DWORD dwHookData )
|
BOOL WINAPI SetDCHook( HDC hdc, DCHOOKPROC hookProc, DWORD dwHookData )
|
||||||
{
|
{
|
||||||
DC *dc = DC_GetDCPtr( hdc );
|
DC *dc = GDI_GetObjPtr( hdc, DC_MAGIC );
|
||||||
|
|
||||||
if (!dc) return FALSE;
|
if (!dc) return FALSE;
|
||||||
dc->dwHookData = dwHookData;
|
|
||||||
dc->hookThunk = hookProc;
|
if (!(dc->flags & DC_SAVED))
|
||||||
|
{
|
||||||
|
dc->dwHookData = dwHookData;
|
||||||
|
dc->hookThunk = hookProc;
|
||||||
|
}
|
||||||
GDI_ReleaseObj( hdc );
|
GDI_ReleaseObj( hdc );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -692,6 +692,7 @@ void *GDI_AllocObject( WORD size, WORD magic, HGDIOBJ *handle, const struct gdi_
|
||||||
case METAFILE_DC_MAGIC:
|
case METAFILE_DC_MAGIC:
|
||||||
case ENHMETAFILE_MAGIC:
|
case ENHMETAFILE_MAGIC:
|
||||||
case ENHMETAFILE_DC_MAGIC:
|
case ENHMETAFILE_DC_MAGIC:
|
||||||
|
case MEMORY_DC_MAGIC:
|
||||||
case BITMAP_MAGIC:
|
case BITMAP_MAGIC:
|
||||||
case PALETTE_MAGIC:
|
case PALETTE_MAGIC:
|
||||||
if (!(obj = alloc_large_heap( size, handle ))) goto error;
|
if (!(obj = alloc_large_heap( size, handle ))) goto error;
|
||||||
|
@ -1023,6 +1024,9 @@ DWORD WINAPI GetObjectType( HANDLE handle )
|
||||||
case ENHMETAFILE_DC_MAGIC:
|
case ENHMETAFILE_DC_MAGIC:
|
||||||
result = OBJ_ENHMETADC;
|
result = OBJ_ENHMETADC;
|
||||||
break;
|
break;
|
||||||
|
case MEMORY_DC_MAGIC:
|
||||||
|
result = OBJ_MEMDC;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
FIXME("Magic %04x not implemented\n", GDIMAGIC(ptr->wMagic) );
|
FIXME("Magic %04x not implemented\n", GDIMAGIC(ptr->wMagic) );
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue