diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c index 2810c747c18..05e51dff6ce 100644 --- a/dlls/gdi32/dib.c +++ b/dlls/gdi32/dib.c @@ -382,26 +382,19 @@ INT WINAPI SetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx, UINT lines, LPCVOID bits, const BITMAPINFO *info, UINT coloruse ) { - INT ret; + INT ret = 0; DC *dc; if (!bits) return 0; - if (!(dc = get_dc_ptr( hdc ))) return 0; - - if(dc->funcs->pSetDIBitsToDevice) + if ((dc = get_dc_ptr( hdc ))) { + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetDIBitsToDevice ); update_dc( dc ); - ret = dc->funcs->pSetDIBitsToDevice( dc->physDev, xDest, yDest, cx, cy, xSrc, - ySrc, startscan, lines, bits, - info, coloruse ); + ret = physdev->funcs->pSetDIBitsToDevice( physdev, xDest, yDest, cx, cy, xSrc, + ySrc, startscan, lines, bits, info, coloruse ); + release_dc_ptr( dc ); } - else { - FIXME("unimplemented on hdc %p\n", hdc); - ret = 0; - } - - release_dc_ptr( dc ); return ret; } @@ -418,6 +411,8 @@ UINT WINAPI SetDIBColorTable( HDC hdc, UINT startpos, UINT entries, CONST RGBQUA if ((bitmap = GDI_GetObjPtr( dc->hBitmap, OBJ_BITMAP ))) { + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetDIBColorTable ); + /* Check if currently selected bitmap is a DIB */ if (bitmap->color_table) { @@ -429,11 +424,8 @@ UINT WINAPI SetDIBColorTable( HDC hdc, UINT startpos, UINT entries, CONST RGBQUA } } GDI_ReleaseObj( dc->hBitmap ); + physdev->funcs->pSetDIBColorTable( physdev, startpos, entries, colors ); } - - if (dc->funcs->pSetDIBColorTable) - dc->funcs->pSetDIBColorTable(dc->physDev, startpos, entries, colors); - release_dc_ptr( dc ); return result; } @@ -1361,19 +1353,17 @@ HBITMAP WINAPI CreateDIBSection(HDC hdc, CONST BITMAPINFO *bmi, UINT usage, if (ret && ((bmp = GDI_GetObjPtr(ret, OBJ_BITMAP)))) { + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pCreateDIBSection ); bmp->dib = dib; - bmp->funcs = dc->funcs; + bmp->funcs = physdev->funcs; /* create local copy of DIB palette */ if (bpp <= 8) DIB_CopyColorTable( dc, bmp, usage, bmi ); GDI_ReleaseObj( ret ); - if (dc->funcs->pCreateDIBSection) + if (!physdev->funcs->pCreateDIBSection( physdev, ret, bmi, usage )) { - if (!dc->funcs->pCreateDIBSection(dc->physDev, ret, bmi, usage)) - { - DeleteObject( ret ); - ret = 0; - } + DeleteObject( ret ); + ret = 0; } } diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index afd853be9de..fa77a2ee481 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -339,6 +339,12 @@ static BOOL CDECL nulldrv_CreateBitmap( PHYSDEV dev, HBITMAP bitmap, LPVOID bits return TRUE; } +static HBITMAP CDECL nulldrv_CreateDIBSection( PHYSDEV dev, HBITMAP bitmap, + const BITMAPINFO *info, UINT usage ) +{ + return bitmap; +} + static BOOL CDECL nulldrv_DeleteBitmap( HBITMAP bitmap ) { return TRUE; @@ -576,6 +582,18 @@ static COLORREF CDECL nulldrv_SetDCPenColor( PHYSDEV dev, COLORREF color ) return color; } +static UINT CDECL nulldrv_SetDIBColorTable( PHYSDEV dev, UINT pos, UINT count, const RGBQUAD *colors ) +{ + return 0; +} + +static INT CDECL nulldrv_SetDIBitsToDevice( PHYSDEV dev, INT x_dst, INT y_dst, DWORD width, DWORD height, + INT x_src, INT y_src, UINT start, UINT lines, + const void *bits, const BITMAPINFO *info, UINT coloruse ) +{ + return 0; +} + static void CDECL nulldrv_SetDeviceClipping( PHYSDEV dev, HRGN vis_rgn, HRGN clip_rgn ) { } @@ -736,7 +754,7 @@ const DC_FUNCTIONS null_driver = nulldrv_CloseFigure, /* pCloseFigure */ nulldrv_CreateBitmap, /* pCreateBitmap */ NULL, /* pCreateDC */ - NULL, /* pCreateDIBSection */ + nulldrv_CreateDIBSection, /* pCreateDIBSection */ nulldrv_DeleteBitmap, /* pDeleteBitmap */ NULL, /* pDeleteDC */ nulldrv_DeleteObject, /* pDeleteObject */ @@ -811,9 +829,9 @@ const DC_FUNCTIONS null_driver = nulldrv_SetBkMode, /* pSetBkMode */ nulldrv_SetDCBrushColor, /* pSetDCBrushColor */ nulldrv_SetDCPenColor, /* pSetDCPenColor */ - NULL, /* pSetDIBColorTable */ + nulldrv_SetDIBColorTable, /* pSetDIBColorTable */ nulldrv_SetDIBits, /* pSetDIBits */ - NULL, /* pSetDIBitsToDevice */ + nulldrv_SetDIBitsToDevice, /* pSetDIBitsToDevice */ nulldrv_SetDeviceClipping, /* pSetDeviceClipping */ nulldrv_SetDeviceGammaRamp, /* pSetDeviceGammaRamp */ nulldrv_SetLayout, /* pSetLayout */