Commit 84dd9feb authored by Huw D M Davies's avatar Huw D M Davies Committed by Alexandre Julliard

A couple of small fixes to my bitmap patch.

parent 3700777e
......@@ -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,
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment