mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 19:43:37 +00:00
gdi32: Use NtGdiGetDCObject for GetCurrentObject.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
5794b2da18
commit
05a3384ca8
|
@ -866,7 +866,8 @@ BOOL WINAPI GdiTransparentBlt( HDC hdcDest, int xDest, int yDest, int widthDest,
|
||||||
SetStretchBltMode(hdcSrc, COLORONCOLOR);
|
SetStretchBltMode(hdcSrc, COLORONCOLOR);
|
||||||
hdcWork = NtGdiCreateCompatibleDC( hdcDest );
|
hdcWork = NtGdiCreateCompatibleDC( hdcDest );
|
||||||
if ((GetObjectType( hdcDest ) != OBJ_MEMDC ||
|
if ((GetObjectType( hdcDest ) != OBJ_MEMDC ||
|
||||||
GetObjectW( GetCurrentObject( hdcDest, OBJ_BITMAP ), sizeof(dib), &dib ) == sizeof(BITMAP)) &&
|
GetObjectW( NtGdiGetDCObject( hdcDest, NTGDI_OBJ_SURF ),
|
||||||
|
sizeof(dib), &dib ) == sizeof(BITMAP)) &&
|
||||||
GetDeviceCaps( hdcDest, BITSPIXEL ) == 32)
|
GetDeviceCaps( hdcDest, BITSPIXEL ) == 32)
|
||||||
{
|
{
|
||||||
/* screen DCs or DDBs are not supposed to have an alpha channel, so use a 24-bpp bitmap as copy */
|
/* screen DCs or DDBs are not supposed to have an alpha channel, so use a 24-bpp bitmap as copy */
|
||||||
|
|
|
@ -63,7 +63,8 @@ HBITMAP WINAPI NtGdiCreateCompatibleBitmap( HDC hdc, INT width, INT height )
|
||||||
NtGdiGetDeviceCaps( hdc, PLANES ),
|
NtGdiGetDeviceCaps( hdc, PLANES ),
|
||||||
NtGdiGetDeviceCaps( hdc, BITSPIXEL ), NULL );
|
NtGdiGetDeviceCaps( hdc, BITSPIXEL ), NULL );
|
||||||
|
|
||||||
switch (NtGdiExtGetObjectW( GetCurrentObject( hdc, OBJ_BITMAP ), sizeof(dib), &dib ))
|
switch (NtGdiExtGetObjectW( NtGdiGetDCObject( hdc, NTGDI_OBJ_SURF ),
|
||||||
|
sizeof(dib), &dib ))
|
||||||
{
|
{
|
||||||
case sizeof(BITMAP): /* A device-dependent bitmap is selected in the DC */
|
case sizeof(BITMAP): /* A device-dependent bitmap is selected in the DC */
|
||||||
return NtGdiCreateBitmap( width, height, dib.dsBm.bmPlanes, dib.dsBm.bmBitsPixel, NULL );
|
return NtGdiCreateBitmap( width, height, dib.dsBm.bmPlanes, dib.dsBm.bmBitsPixel, NULL );
|
||||||
|
|
|
@ -253,7 +253,7 @@ static BOOL bitmapinfo_from_user_bitmapinfo( BITMAPINFO *dst, const BITMAPINFO *
|
||||||
static int fill_color_table_from_palette( BITMAPINFO *info, HDC hdc )
|
static int fill_color_table_from_palette( BITMAPINFO *info, HDC hdc )
|
||||||
{
|
{
|
||||||
PALETTEENTRY palEntry[256];
|
PALETTEENTRY palEntry[256];
|
||||||
HPALETTE palette = GetCurrentObject( hdc, OBJ_PAL );
|
HPALETTE palette = NtGdiGetDCObject( hdc, NTGDI_OBJ_PAL );
|
||||||
int i, colors = 1 << info->bmiHeader.biBitCount;
|
int i, colors = 1 << info->bmiHeader.biBitCount;
|
||||||
|
|
||||||
info->bmiHeader.biClrUsed = colors;
|
info->bmiHeader.biClrUsed = colors;
|
||||||
|
@ -284,7 +284,8 @@ BOOL fill_color_table_from_pal_colors( BITMAPINFO *info, HDC hdc )
|
||||||
int i, count, colors = info->bmiHeader.biClrUsed;
|
int i, count, colors = info->bmiHeader.biClrUsed;
|
||||||
|
|
||||||
if (!colors) return TRUE;
|
if (!colors) return TRUE;
|
||||||
if (!(palette = GetCurrentObject( hdc, OBJ_PAL ))) return FALSE;
|
if (!(palette = NtGdiGetDCObject( hdc, NTGDI_OBJ_PAL )))
|
||||||
|
return FALSE;
|
||||||
if (!(count = get_palette_entries( palette, 0, colors, entries ))) return FALSE;
|
if (!(count = get_palette_entries( palette, 0, colors, entries ))) return FALSE;
|
||||||
|
|
||||||
for (i = 0; i < colors; i++, index++)
|
for (i = 0; i < colors; i++, index++)
|
||||||
|
|
|
@ -534,7 +534,7 @@ static BOOL WINAPI dibdrv_wglMakeCurrent( HDC hdc, struct wgl_context *context )
|
||||||
if (!osmesa_funcs) return FALSE;
|
if (!osmesa_funcs) return FALSE;
|
||||||
if (!context) return osmesa_funcs->make_current( NULL, NULL, 0, 0, 0, 0 );
|
if (!context) return osmesa_funcs->make_current( NULL, NULL, 0, 0, 0, 0 );
|
||||||
|
|
||||||
bitmap = GetCurrentObject( hdc, OBJ_BITMAP );
|
bitmap = NtGdiGetDCObject( hdc, NTGDI_OBJ_SURF );
|
||||||
bmp = GDI_GetObjPtr( bitmap, NTGDI_OBJ_BITMAP );
|
bmp = GDI_GetObjPtr( bitmap, NTGDI_OBJ_BITMAP );
|
||||||
if (!bmp) return FALSE;
|
if (!bmp) return FALSE;
|
||||||
|
|
||||||
|
|
|
@ -1005,47 +1005,28 @@ INT WINAPI NtGdiExtGetObjectW( HGDIOBJ handle, INT count, void *buffer )
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* GetCurrentObject (GDI32.@)
|
* NtGdiGetDCObject (win32u.@)
|
||||||
*
|
*
|
||||||
* Get the currently selected object of a given type in a device context.
|
* Get the currently selected object of a given type in a device context.
|
||||||
*
|
|
||||||
* PARAMS
|
|
||||||
* hdc [I] Device context to get the current object from
|
|
||||||
* type [I] Type of current object to get (OBJ_* defines from "wingdi.h")
|
|
||||||
*
|
|
||||||
* RETURNS
|
|
||||||
* Success: The current object of the given type selected in hdc.
|
|
||||||
* Failure: A NULL handle.
|
|
||||||
*
|
|
||||||
* NOTES
|
|
||||||
* - only the following object types are supported:
|
|
||||||
*| OBJ_PEN
|
|
||||||
*| OBJ_BRUSH
|
|
||||||
*| OBJ_PAL
|
|
||||||
*| OBJ_FONT
|
|
||||||
*| OBJ_BITMAP
|
|
||||||
*/
|
*/
|
||||||
HGDIOBJ WINAPI GetCurrentObject(HDC hdc,UINT type)
|
HANDLE WINAPI NtGdiGetDCObject( HDC hdc, UINT type )
|
||||||
{
|
{
|
||||||
HGDIOBJ ret = 0;
|
HGDIOBJ ret = 0;
|
||||||
DC * dc = get_dc_ptr( hdc );
|
DC *dc;
|
||||||
|
|
||||||
if (!dc) return 0;
|
if (!(dc = get_dc_ptr( hdc ))) return 0;
|
||||||
|
|
||||||
switch (type) {
|
switch (type)
|
||||||
case OBJ_EXTPEN: /* fall through */
|
{
|
||||||
case OBJ_PEN: ret = dc->hPen; break;
|
case NTGDI_OBJ_EXTPEN: /* fall through */
|
||||||
case OBJ_BRUSH: ret = dc->hBrush; break;
|
case NTGDI_OBJ_PEN: ret = dc->hPen; break;
|
||||||
case OBJ_PAL: ret = dc->hPalette; break;
|
case NTGDI_OBJ_BRUSH: ret = dc->hBrush; break;
|
||||||
case OBJ_FONT: ret = dc->hFont; break;
|
case NTGDI_OBJ_PAL: ret = dc->hPalette; break;
|
||||||
case OBJ_BITMAP: ret = dc->hBitmap; break;
|
case NTGDI_OBJ_FONT: ret = dc->hFont; break;
|
||||||
|
case NTGDI_OBJ_SURF: ret = dc->hBitmap; break;
|
||||||
/* tests show that OBJ_REGION is explicitly ignored */
|
default:
|
||||||
case OBJ_REGION: break;
|
FIXME( "(%p, %d): unknown type.\n", hdc, type );
|
||||||
default:
|
break;
|
||||||
/* the SDK only mentions those above */
|
|
||||||
FIXME("(%p,%d): unknown type.\n",hdc,type);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
release_dc_ptr( dc );
|
release_dc_ptr( dc );
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -353,6 +353,32 @@ INT WINAPI GetObjectW( HGDIOBJ handle, INT count, void *buffer )
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* GetCurrentObject (GDI32.@)
|
||||||
|
*/
|
||||||
|
HGDIOBJ WINAPI GetCurrentObject( HDC hdc, UINT type )
|
||||||
|
{
|
||||||
|
unsigned int obj_type;
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case OBJ_EXTPEN: obj_type = NTGDI_OBJ_EXTPEN; break;
|
||||||
|
case OBJ_PEN: obj_type = NTGDI_OBJ_PEN; break;
|
||||||
|
case OBJ_BRUSH: obj_type = NTGDI_OBJ_BRUSH; break;
|
||||||
|
case OBJ_PAL: obj_type = NTGDI_OBJ_PAL; break;
|
||||||
|
case OBJ_FONT: obj_type = NTGDI_OBJ_FONT; break;
|
||||||
|
case OBJ_BITMAP: obj_type = NTGDI_OBJ_SURF; break;
|
||||||
|
case OBJ_REGION:
|
||||||
|
/* tests show that OBJ_REGION is explicitly ignored */
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
FIXME( "(%p,%d): unknown type.\n", hdc, type );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NtGdiGetDCObject( hdc, obj_type );
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* GetObjectA (GDI32.@)
|
* GetObjectA (GDI32.@)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -57,6 +57,7 @@ typedef struct _GDI_HANDLE_ENTRY
|
||||||
#define NTGDI_OBJ_DC 0x010000
|
#define NTGDI_OBJ_DC 0x010000
|
||||||
#define NTGDI_OBJ_ENHMETADC 0x210000
|
#define NTGDI_OBJ_ENHMETADC 0x210000
|
||||||
#define NTGDI_OBJ_REGION 0x040000
|
#define NTGDI_OBJ_REGION 0x040000
|
||||||
|
#define NTGDI_OBJ_SURF 0x050000
|
||||||
#define NTGDI_OBJ_METAFILE 0x260000
|
#define NTGDI_OBJ_METAFILE 0x260000
|
||||||
#define NTGDI_OBJ_ENHMETAFILE 0x460000
|
#define NTGDI_OBJ_ENHMETAFILE 0x460000
|
||||||
#define NTGDI_OBJ_METADC 0x660000
|
#define NTGDI_OBJ_METADC 0x660000
|
||||||
|
@ -296,6 +297,7 @@ BOOL WINAPI NtGdiGetCharWidthW( HDC hdc, UINT first_char, UINT last_char, WC
|
||||||
ULONG flags, void *buffer );
|
ULONG flags, void *buffer );
|
||||||
BOOL WINAPI NtGdiGetColorAdjustment( HDC hdc, COLORADJUSTMENT *ca );
|
BOOL WINAPI NtGdiGetColorAdjustment( HDC hdc, COLORADJUSTMENT *ca );
|
||||||
BOOL WINAPI NtGdiGetDCDword( HDC hdc, UINT method, DWORD *result );
|
BOOL WINAPI NtGdiGetDCDword( HDC hdc, UINT method, DWORD *result );
|
||||||
|
HANDLE WINAPI NtGdiGetDCObject( HDC hdc, UINT type );
|
||||||
BOOL WINAPI NtGdiGetDCPoint( HDC hdc, UINT method, POINT *result );
|
BOOL WINAPI NtGdiGetDCPoint( HDC hdc, UINT method, POINT *result );
|
||||||
INT WINAPI NtGdiGetDIBitsInternal( HDC hdc, HBITMAP hbitmap, UINT startscan, UINT lines,
|
INT WINAPI NtGdiGetDIBitsInternal( HDC hdc, HBITMAP hbitmap, UINT startscan, UINT lines,
|
||||||
void *bits, BITMAPINFO *info, UINT coloruse,
|
void *bits, BITMAPINFO *info, UINT coloruse,
|
||||||
|
|
Loading…
Reference in a new issue