gdi32: Get rid of the SetBitmapBits driver entry point.
This commit is contained in:
parent
09eb59d3c6
commit
6d00196aea
|
@ -50,25 +50,6 @@ static const struct gdi_obj_funcs bitmap_funcs =
|
|||
* null driver fallback implementations
|
||||
*/
|
||||
|
||||
LONG nulldrv_SetBitmapBits( HBITMAP bitmap, const void *bits, LONG size )
|
||||
{
|
||||
BITMAPOBJ *bmp = GDI_GetObjPtr( bitmap, OBJ_BITMAP );
|
||||
|
||||
if (!bmp->bitmap.bmBits)
|
||||
{
|
||||
LONG total = bmp->bitmap.bmHeight * bmp->bitmap.bmWidthBytes; /* alloc enough for entire bitmap */
|
||||
if (!(bmp->bitmap.bmBits = HeapAlloc( GetProcessHeap(), 0, total )))
|
||||
{
|
||||
GDI_ReleaseObj( bitmap );
|
||||
return 0;
|
||||
}
|
||||
if (size < total) memset( (char *)bmp->bitmap.bmBits + size, 0, total - size );
|
||||
}
|
||||
memcpy( bmp->bitmap.bmBits, bits, size );
|
||||
GDI_ReleaseObj( bitmap );
|
||||
return size;
|
||||
}
|
||||
|
||||
DWORD nulldrv_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info,
|
||||
struct gdi_image_bits *bits, struct bitblt_coords *src )
|
||||
{
|
||||
|
|
|
@ -821,7 +821,6 @@ const DC_FUNCTIONS dib_driver =
|
|||
NULL, /* pSelectPalette */
|
||||
dibdrv_SelectPen, /* pSelectPen */
|
||||
NULL, /* pSetArcDirection */
|
||||
NULL, /* pSetBitmapBits */
|
||||
dibdrv_SetBkColor, /* pSetBkColor */
|
||||
dibdrv_SetBkMode, /* pSetBkMode */
|
||||
dibdrv_SetDCBrushColor, /* pSetDCBrushColor */
|
||||
|
|
|
@ -742,7 +742,6 @@ const DC_FUNCTIONS null_driver =
|
|||
nulldrv_SelectPalette, /* pSelectPalette */
|
||||
nulldrv_SelectPen, /* pSelectPen */
|
||||
nulldrv_SetArcDirection, /* pSetArcDirection */
|
||||
nulldrv_SetBitmapBits, /* pSetBitmapBits */
|
||||
nulldrv_SetBkColor, /* pSetBkColor */
|
||||
nulldrv_SetBkMode, /* pSetBkMode */
|
||||
nulldrv_SetDCBrushColor, /* pSetDCBrushColor */
|
||||
|
|
|
@ -118,7 +118,6 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
|
|||
EMFDRV_SelectPalette, /* pSelectPalette */
|
||||
EMFDRV_SelectPen, /* pSelectPen */
|
||||
EMFDRV_SetArcDirection, /* pSetArcDirection */
|
||||
NULL, /* pSetBitmapBits */
|
||||
EMFDRV_SetBkColor, /* pSetBkColor */
|
||||
EMFDRV_SetBkMode, /* pSetBkMode */
|
||||
EMFDRV_SetDCBrushColor, /* pSetDCBrushColor*/
|
||||
|
|
|
@ -501,7 +501,6 @@ extern INT nulldrv_SaveDC( PHYSDEV dev ) DECLSPEC_HIDDEN;
|
|||
extern BOOL nulldrv_ScaleViewportExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_num, INT y_denom, SIZE *size ) DECLSPEC_HIDDEN;
|
||||
extern BOOL nulldrv_ScaleWindowExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_num, INT y_denom, SIZE *size ) DECLSPEC_HIDDEN;
|
||||
extern BOOL nulldrv_SelectClipPath( PHYSDEV dev, INT mode ) DECLSPEC_HIDDEN;
|
||||
extern LONG nulldrv_SetBitmapBits( HBITMAP bitmap, const void *bits, LONG size ) DECLSPEC_HIDDEN;
|
||||
extern INT nulldrv_SetMapMode( PHYSDEV dev, INT mode ) DECLSPEC_HIDDEN;
|
||||
extern BOOL nulldrv_SetViewportExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size ) DECLSPEC_HIDDEN;
|
||||
extern BOOL nulldrv_SetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -162,7 +162,6 @@ static const DC_FUNCTIONS MFDRV_Funcs =
|
|||
MFDRV_SelectPalette, /* pSelectPalette */
|
||||
MFDRV_SelectPen, /* pSelectPen */
|
||||
NULL, /* pSetArcDirection */
|
||||
NULL, /* pSetBitmapBits */
|
||||
MFDRV_SetBkColor, /* pSetBkColor */
|
||||
MFDRV_SetBkMode, /* pSetBkMode */
|
||||
MFDRV_SetDCBrushColor, /* pSetDCBrushColor*/
|
||||
|
|
|
@ -884,7 +884,6 @@ static const struct gdi_dc_funcs psdrv_funcs =
|
|||
NULL, /* pSelectPalette */
|
||||
PSDRV_SelectPen, /* pSelectPen */
|
||||
NULL, /* pSetArcDirection */
|
||||
NULL, /* pSetBitmapBits */
|
||||
PSDRV_SetBkColor, /* pSetBkColor */
|
||||
NULL, /* pSetBkMode */
|
||||
PSDRV_SetDCBrushColor, /* pSetDCBrushColor */
|
||||
|
|
|
@ -196,129 +196,6 @@ BOOL X11DRV_CreateBitmap( PHYSDEV dev, HBITMAP hbitmap )
|
|||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* SetBitmapBits (X11DRV.@)
|
||||
*
|
||||
* RETURNS
|
||||
* Success: Number of bytes used in setting the bitmap bits
|
||||
* Failure: 0
|
||||
*/
|
||||
LONG X11DRV_SetBitmapBits( HBITMAP hbitmap, const void *bits, LONG count )
|
||||
{
|
||||
BITMAP bitmap;
|
||||
X_PHYSBITMAP *physBitmap = X11DRV_get_phys_bitmap( hbitmap );
|
||||
LONG height;
|
||||
XImage *image;
|
||||
const BYTE *sbuf, *startline;
|
||||
int w, h;
|
||||
|
||||
if (!physBitmap || !GetObjectW( hbitmap, sizeof(bitmap), &bitmap )) return 0;
|
||||
|
||||
TRACE("(bmp=%p, bits=%p, count=0x%x)\n", hbitmap, bits, count);
|
||||
|
||||
height = count / bitmap.bmWidthBytes;
|
||||
|
||||
wine_tsx11_lock();
|
||||
image = XCreateImage( gdi_display, visual, physBitmap->pixmap_depth, ZPixmap, 0, NULL,
|
||||
bitmap.bmWidth, height, 32, 0 );
|
||||
if (!(image->data = HeapAlloc( GetProcessHeap(), 0, image->bytes_per_line * height )))
|
||||
{
|
||||
WARN("No memory to create image data.\n");
|
||||
XDestroyImage( image );
|
||||
wine_tsx11_unlock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* copy 16 bit padded image buffer with real bitsperpixel to XImage */
|
||||
|
||||
startline = bits;
|
||||
|
||||
switch (bitmap.bmBitsPixel)
|
||||
{
|
||||
case 1:
|
||||
for (h=0;h<height;h++)
|
||||
{
|
||||
sbuf = startline;
|
||||
for (w=0;w<bitmap.bmWidth;w++)
|
||||
{
|
||||
XPutPixel(image,w,h,(sbuf[0]>>(7-(w&7))) & 1);
|
||||
if ((w&7) == 7)
|
||||
sbuf++;
|
||||
}
|
||||
startline += bitmap.bmWidthBytes;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
for (h=0;h<height;h++)
|
||||
{
|
||||
sbuf = startline;
|
||||
for (w=0;w<bitmap.bmWidth;w++)
|
||||
{
|
||||
if (!(w & 1)) XPutPixel( image, w, h, *sbuf >> 4 );
|
||||
else XPutPixel( image, w, h, *sbuf++ & 0xf );
|
||||
}
|
||||
startline += bitmap.bmWidthBytes;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
for (h=0;h<height;h++)
|
||||
{
|
||||
sbuf = startline;
|
||||
for (w=0;w<bitmap.bmWidth;w++)
|
||||
XPutPixel(image,w,h,*sbuf++);
|
||||
startline += bitmap.bmWidthBytes;
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
case 16:
|
||||
for (h=0;h<height;h++)
|
||||
{
|
||||
sbuf = startline;
|
||||
for (w=0;w<bitmap.bmWidth;w++)
|
||||
{
|
||||
XPutPixel(image,w,h,sbuf[1]*256+sbuf[0]);
|
||||
sbuf+=2;
|
||||
}
|
||||
startline += bitmap.bmWidthBytes;
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
for (h=0;h<height;h++)
|
||||
{
|
||||
sbuf = startline;
|
||||
for (w=0;w<bitmap.bmWidth;w++)
|
||||
{
|
||||
XPutPixel(image,w,h,(sbuf[2]<<16)+(sbuf[1]<<8)+sbuf[0]);
|
||||
sbuf += 3;
|
||||
}
|
||||
startline += bitmap.bmWidthBytes;
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
for (h=0;h<height;h++)
|
||||
{
|
||||
sbuf = startline;
|
||||
for (w=0;w<bitmap.bmWidth;w++)
|
||||
{
|
||||
XPutPixel(image,w,h,(sbuf[3]<<24)+(sbuf[2]<<16)+(sbuf[1]<<8)+sbuf[0]);
|
||||
sbuf += 4;
|
||||
}
|
||||
startline += bitmap.bmWidthBytes;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
FIXME("Unhandled bits:%d\n", bitmap.bmBitsPixel);
|
||||
|
||||
}
|
||||
XPutImage( gdi_display, physBitmap->pixmap, get_bitmap_gc(physBitmap->pixmap_depth),
|
||||
image, 0, 0, 0, 0, bitmap.bmWidth, height );
|
||||
HeapFree( GetProcessHeap(), 0, image->data );
|
||||
image->data = NULL;
|
||||
XDestroyImage( image );
|
||||
wine_tsx11_unlock();
|
||||
return count;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DeleteBitmap (X11DRV.@)
|
||||
*/
|
||||
|
|
|
@ -527,7 +527,6 @@ static const struct gdi_dc_funcs x11drv_funcs =
|
|||
NULL, /* pSelectPalette */
|
||||
X11DRV_SelectPen, /* pSelectPen */
|
||||
NULL, /* pSetArcDirection */
|
||||
X11DRV_SetBitmapBits, /* pSetBitmapBits */
|
||||
X11DRV_SetBkColor, /* pSetBkColor */
|
||||
NULL, /* pSetBkMode */
|
||||
X11DRV_SetDCBrushColor, /* pSetDCBrushColor */
|
||||
|
|
|
@ -230,7 +230,6 @@ extern HBITMAP X11DRV_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap ) DECLSPEC_HIDD
|
|||
extern HBRUSH X11DRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush ) DECLSPEC_HIDDEN;
|
||||
extern HFONT X11DRV_SelectFont( PHYSDEV dev, HFONT hfont, HANDLE gdiFont ) DECLSPEC_HIDDEN;
|
||||
extern HPEN X11DRV_SelectPen( PHYSDEV dev, HPEN hpen ) DECLSPEC_HIDDEN;
|
||||
extern LONG X11DRV_SetBitmapBits( HBITMAP hbitmap, const void *bits, LONG count ) DECLSPEC_HIDDEN;
|
||||
extern COLORREF X11DRV_SetBkColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
|
||||
extern COLORREF X11DRV_SetDCBrushColor( PHYSDEV dev, COLORREF crColor ) DECLSPEC_HIDDEN;
|
||||
extern COLORREF X11DRV_SetDCPenColor( PHYSDEV dev, COLORREF crColor ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -136,7 +136,6 @@ struct gdi_dc_funcs
|
|||
HPALETTE (*pSelectPalette)(PHYSDEV,HPALETTE,BOOL);
|
||||
HPEN (*pSelectPen)(PHYSDEV,HPEN);
|
||||
INT (*pSetArcDirection)(PHYSDEV,INT);
|
||||
LONG (*pSetBitmapBits)(HBITMAP,const void*,LONG);
|
||||
COLORREF (*pSetBkColor)(PHYSDEV,COLORREF);
|
||||
INT (*pSetBkMode)(PHYSDEV,INT);
|
||||
COLORREF (*pSetDCBrushColor)(PHYSDEV, COLORREF);
|
||||
|
@ -189,7 +188,7 @@ struct gdi_dc_funcs
|
|||
};
|
||||
|
||||
/* increment this when you change the DC function table */
|
||||
#define WINE_GDI_DRIVER_VERSION 10
|
||||
#define WINE_GDI_DRIVER_VERSION 11
|
||||
|
||||
static inline PHYSDEV get_physdev_entry_point( PHYSDEV dev, size_t offset )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue