A couple of small fixes to my bitmap patch.

This commit is contained in:
Huw D M Davies 1998-11-01 15:13:53 +00:00 committed by Alexandre Julliard
parent 3700777e9a
commit 84dd9feb05
2 changed files with 13 additions and 6 deletions

View file

@ -28,11 +28,6 @@
GC BITMAP_monoGC = 0, BITMAP_colorGC = 0;
#define BITMAP_WIDTH_BYTES(width,bpp) \
(((bpp) == 24) ? (width) * 4 : ( ((bpp) == 15) ? (width) * 2 : \
((width) * (bpp) + 15) / 16 * 2 ))
/***********************************************************************
* X11DRV_BITMAP_Init
*/
@ -371,6 +366,8 @@ static LONG X11DRV_SetBitmapBits(BITMAPOBJ *bmp, void *bits, LONG count)
XImage *image;
LPBYTE sbuf, tmpbuffer;
int w, h, pad, widthbytes;
TRACE(x11drv, "(bmp=%p, bits=%p, count=%lx)\n", bmp, bits, count);
pad = BITMAP_GetBitsPadding(bmp->bitmap.bmWidth, bmp->bitmap.bmBitsPixel);
@ -381,9 +378,12 @@ static LONG X11DRV_SetBitmapBits(BITMAPOBJ *bmp, void *bits, LONG count)
widthbytes = (((bmp->bitmap.bmWidth * bmp->bitmap.bmBitsPixel) + 31) /
32) * 4;
height = bmp->bitmap.bmHeight;
height = count / bmp->bitmap.bmWidthBytes;
tmpbuffer = (LPBYTE)xmalloc(widthbytes*height);
TRACE(x11drv, "h=%ld, w=%d, wb=%d\n", height, bmp->bitmap.bmWidth,
widthbytes);
EnterCriticalSection( &X11DRV_CritSection );
image = XCreateImage( display, DefaultVisualOfScreen(screen),
bmp->bitmap.bmBitsPixel, ZPixmap, 0, tmpbuffer,

View file

@ -80,6 +80,9 @@ BOOL32 GRAPH_DrawBitmap( HDC32 hdc, HBITMAP32 hbitmap,
return FALSE;
}
/* HACK for now */
if(!bmp->DDBitmap)
X11DRV_CreateBitmap( hbitmap );
pbitmap = bmp->DDBitmap->physBitmap;
xdest += dc->w.DCOrgX; ydest += dc->w.DCOrgY;
@ -249,6 +252,10 @@ BOOL32 GRAPH_SelectClipMask( HDC32 hdc, HBITMAP32 hMonoBitmap, INT32 x, INT32 y)
GDI_HEAP_UNLOCK( hdc );
return FALSE;
}
/* HACK for now */
if(!bmp->DDBitmap)
X11DRV_CreateBitmap( hMonoBitmap );
pbitmap = bmp->DDBitmap->physBitmap;
TSXSetClipOrigin( display, dc->u.x.gc, dc->w.DCOrgX + x, dc->w.DCOrgY + y);
}