Commit b89525fb authored by Alexandre Julliard's avatar Alexandre Julliard

Removed the bitsPerPixel field in the generic DC structure, and leave

it up to the graphics driver to define it if necessary.
parent bc624583
......@@ -65,8 +65,6 @@ BOOL TTYDRV_DC_CreateDC(DC *dc, TTYDRV_PDEVICE **pdev, LPCWSTR driver, LPCWSTR d
physDev->window = root_window;
physDev->cellWidth = cell_width;
physDev->cellHeight = cell_height;
dc->bitsPerPixel = 1;
}
return TRUE;
......
......@@ -358,8 +358,6 @@ BOOL PSDRV_CreateDC( DC *dc, PSDRV_PDEVICE **pdev, LPCWSTR driver, LPCWSTR devic
PSDRV_UpdateDevCaps(physDev);
dc->hFont = PSDRV_DefaultFont;
if (GetObjectType(dc->hSelf) != OBJ_MEMDC)
dc->bitsPerPixel = physDev->pi->ppd->ColorDevice ? 8 : 1;
return TRUE;
}
......
......@@ -867,8 +867,6 @@ static int BITBLT_GetSrcAreaStretch( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE
RECT *visRectSrc, RECT *visRectDst )
{
XImage *imageSrc, *imageDst;
DC *dcDst = physDevDst->dc;
RECT rectSrc = *visRectSrc;
RECT rectDst = *visRectDst;
......@@ -893,13 +891,13 @@ static int BITBLT_GetSrcAreaStretch( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE
visRectSrc->bottom - visRectSrc->top,
AllPlanes, ZPixmap );
imageDst = X11DRV_DIB_CreateXImage( rectDst.right - rectDst.left,
rectDst.bottom - rectDst.top, dcDst->bitsPerPixel );
rectDst.bottom - rectDst.top, physDevDst->depth );
BITBLT_StretchImage( imageSrc, imageDst, widthSrc, heightSrc,
widthDst, heightDst, &rectSrc, &rectDst,
physDevDst->textPixel, dcDst->bitsPerPixel != 1 ?
physDevDst->textPixel, physDevDst->depth != 1 ?
physDevDst->backgroundPixel :
physDevSrc->backgroundPixel,
dcDst->stretchBltMode );
GetStretchBltMode(physDevDst->hdc) );
XPutImage( gdi_display, pixmap, gc, imageDst, 0, 0, 0, 0,
rectDst.right - rectDst.left, rectDst.bottom - rectDst.top );
XDestroyImage( imageSrc );
......@@ -922,15 +920,13 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe
int exposures = 0;
INT width = visRectSrc->right - visRectSrc->left;
INT height = visRectSrc->bottom - visRectSrc->top;
DC *dcSrc = physDevSrc->dc;
DC *dcDst = physDevDst->dc;
if (dcSrc->bitsPerPixel == dcDst->bitsPerPixel)
if (physDevSrc->depth == physDevDst->depth)
{
if (!X11DRV_PALETTE_XPixelToPalette ||
(dcDst->bitsPerPixel == 1)) /* monochrome -> monochrome */
(physDevDst->depth == 1)) /* monochrome -> monochrome */
{
if (dcDst->bitsPerPixel == 1)
if (physDevDst->depth == 1)
{
/* MSDN says if StretchBlt must convert a bitmap from monochrome
to color or vice versa, the forground and background color of
......@@ -979,7 +975,7 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe
}
else
{
if (dcSrc->bitsPerPixel == 1) /* monochrome -> color */
if (physDevSrc->depth == 1) /* monochrome -> color */
{
if (X11DRV_PALETTE_XPixelToPalette)
{
......@@ -1010,7 +1006,7 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe
{
return exposures;
}
imageDst = X11DRV_DIB_CreateXImage( width, height, dcDst->bitsPerPixel );
imageDst = X11DRV_DIB_CreateXImage( width, height, physDevDst->depth );
if (!imageDst)
{
XDestroyImage(imageSrc);
......@@ -1042,7 +1038,7 @@ static int BITBLT_GetDstArea(X11DRV_PDEVICE *physDev, Pixmap pixmap, GC gc, RECT
INT width = visRectDst->right - visRectDst->left;
INT height = visRectDst->bottom - visRectDst->top;
if (!X11DRV_PALETTE_XPixelToPalette || (physDev->dc->bitsPerPixel == 1) ||
if (!X11DRV_PALETTE_XPixelToPalette || (physDev->depth == 1) ||
(X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_VIRTUAL) )
{
XCopyArea( gdi_display, physDev->drawable, pixmap, gc,
......@@ -1096,7 +1092,7 @@ static int BITBLT_PutDstArea(X11DRV_PDEVICE *physDev, Pixmap pixmap, RECT *visRe
/* !X11DRV_PALETTE_PaletteToXPixel is _NOT_ enough */
if (!X11DRV_PALETTE_PaletteToXPixel || (physDev->dc->bitsPerPixel == 1) ||
if (!X11DRV_PALETTE_PaletteToXPixel || (physDev->depth == 1) ||
(X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_VIRTUAL) )
{
XCopyArea( gdi_display, pixmap, physDev->drawable, physDev->gc, 0, 0, width, height,
......@@ -1321,7 +1317,7 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT
{
case BLACKNESS: /* 0x00 */
wine_tsx11_lock();
if ((dcDst->bitsPerPixel == 1) || !X11DRV_PALETTE_PaletteToXPixel)
if ((physDevDst->depth == 1) || !X11DRV_PALETTE_PaletteToXPixel)
XSetFunction( gdi_display, physDevDst->gc, GXclear );
else
{
......@@ -1337,7 +1333,7 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT
return TRUE;
case DSTINVERT: /* 0x55 */
if ((dcDst->bitsPerPixel == 1) || !X11DRV_PALETTE_PaletteToXPixel ||
if ((physDevDst->depth == 1) || !X11DRV_PALETTE_PaletteToXPixel ||
!perfect_graphics())
{
wine_tsx11_lock();
......@@ -1394,7 +1390,7 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT
return TRUE;
case SRCCOPY: /* 0xcc */
if (dcSrc->bitsPerPixel == dcDst->bitsPerPixel)
if (physDevSrc->depth == physDevDst->depth)
{
wine_tsx11_lock();
XSetFunction( gdi_display, physDevDst->gc, GXcopy );
......@@ -1409,7 +1405,7 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT
wine_tsx11_unlock();
return TRUE;
}
if (dcSrc->bitsPerPixel == 1)
if (physDevSrc->depth == 1)
{
wine_tsx11_lock();
XSetBackground( gdi_display, physDevDst->gc, physDevDst->textPixel );
......@@ -1441,7 +1437,7 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT
case WHITENESS: /* 0xff */
wine_tsx11_lock();
if ((dcDst->bitsPerPixel == 1) || !X11DRV_PALETTE_PaletteToXPixel)
if ((physDevDst->depth == 1) || !X11DRV_PALETTE_PaletteToXPixel)
XSetFunction( gdi_display, physDevDst->gc, GXset );
else
{
......@@ -1464,11 +1460,11 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT
XSetSubwindowMode( gdi_display, tmpGC, IncludeInferiors );
XSetGraphicsExposures( gdi_display, tmpGC, False );
pixmaps[DST] = XCreatePixmap( gdi_display, root_window, width, height,
dcDst->bitsPerPixel );
physDevDst->depth );
if (useSrc)
{
pixmaps[SRC] = XCreatePixmap( gdi_display, root_window, width, height,
dcDst->bitsPerPixel );
physDevDst->depth );
if (fStretch)
BITBLT_GetSrcAreaStretch( physDevSrc, physDevDst, pixmaps[SRC], tmpGC,
xSrc, ySrc, widthSrc, heightSrc,
......@@ -1494,8 +1490,7 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT
case OP_ARGS(SRC,TMP):
if (!pixmaps[TMP])
pixmaps[TMP] = XCreatePixmap( gdi_display, root_window,
width, height,
dcDst->bitsPerPixel );
width, height, physDevDst->depth );
/* fall through */
case OP_ARGS(DST,SRC):
case OP_ARGS(SRC,DST):
......@@ -1510,8 +1505,7 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT
case OP_ARGS(PAT,TMP):
if (!pixmaps[TMP] && !fNullBrush)
pixmaps[TMP] = XCreatePixmap( gdi_display, root_window,
width, height,
dcDst->bitsPerPixel );
width, height, physDevDst->depth );
/* fall through */
case OP_ARGS(PAT,DST):
case OP_ARGS(PAT,SRC):
......@@ -1570,7 +1564,7 @@ BOOL X11DRV_BitBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst,
sSrc = X11DRV_LockDIBSection( physDevSrc, DIB_Status_None, FALSE );
if ((sSrc == DIB_Status_AppMod) && (rop == SRCCOPY) &&
(dcSrc->bitsPerPixel == dcDst->bitsPerPixel))
(physDevSrc->depth == physDevDst->depth))
{
POINT pts[2];
/* do everything ourselves; map coordinates */
......
......@@ -74,7 +74,6 @@ BOOL X11DRV_BITMAP_Init(void)
HBITMAP X11DRV_SelectBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
{
BITMAPOBJ *bmp;
DC *dc = physDev->dc;
if (!(bmp = GDI_GetObjPtr( hbitmap, BITMAP_MAGIC ))) return 0;
......@@ -88,8 +87,9 @@ HBITMAP X11DRV_SelectBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
/* Change GC depth if needed */
if (dc->bitsPerPixel != bmp->bitmap.bmBitsPixel)
if (physDev->depth != bmp->bitmap.bmBitsPixel)
{
physDev->depth = bmp->bitmap.bmBitsPixel;
wine_tsx11_lock();
XFreeGC( gdi_display, physDev->gc );
physDev->gc = XCreateGC( gdi_display, physDev->drawable, 0, NULL );
......
......@@ -107,7 +107,7 @@ static XImage *ditherImage = NULL;
/***********************************************************************
* BRUSH_DitherColor
*/
static Pixmap BRUSH_DitherColor( DC *dc, COLORREF color )
static Pixmap BRUSH_DitherColor( COLORREF color )
{
static COLORREF prevColor = 0xffffffff;
unsigned int x, y;
......@@ -154,12 +154,10 @@ static Pixmap BRUSH_DitherColor( DC *dc, COLORREF color )
*/
static void BRUSH_SelectSolidBrush( X11DRV_PDEVICE *physDev, COLORREF color )
{
DC *dc = physDev->dc;
if ((dc->bitsPerPixel > 1) && (screen_depth <= 8) && !X11DRV_IsSolidColor( color ))
if ((physDev->depth > 1) && (screen_depth <= 8) && !X11DRV_IsSolidColor( color ))
{
/* Dithered brush */
physDev->brush.pixmap = BRUSH_DitherColor( dc, color );
physDev->brush.pixmap = BRUSH_DitherColor( color );
physDev->brush.fillStyle = FillTiled;
physDev->brush.pixel = 0;
}
......@@ -178,14 +176,13 @@ static void BRUSH_SelectSolidBrush( X11DRV_PDEVICE *physDev, COLORREF color )
static BOOL BRUSH_SelectPatternBrush( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
{
BOOL ret = FALSE;
DC *dc = physDev->dc;
BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
if (!bmp) return FALSE;
if(!bmp->physBitmap) goto done;
wine_tsx11_lock();
if ((dc->bitsPerPixel == 1) && (bmp->bitmap.bmBitsPixel != 1))
if ((physDev->depth == 1) && (bmp->bitmap.bmBitsPixel != 1))
{
/* Special case: a color pattern on a monochrome DC */
physDev->brush.pixmap = XCreatePixmap( gdi_display, root_window, 8, 8, 1);
......@@ -241,7 +238,7 @@ HBRUSH X11DRV_SelectBrush( X11DRV_PDEVICE *physDev, HBRUSH hbrush )
}
physDev->brush.style = logbrush.lbStyle;
if (hbrush == GetStockObject( DC_BRUSH ))
logbrush.lbColor = physDev->dc->dcBrushColor;
logbrush.lbColor = GetDCBrushColor( physDev->hdc );
switch(logbrush.lbStyle)
{
......
......@@ -3585,7 +3585,6 @@ INT X11DRV_SetDIBitsToDevice( X11DRV_PDEVICE *physDev, INT xDest, INT yDest, DWO
int height;
BOOL top_down;
POINT pt;
DC *dc = physDev->dc;
if (DIB_GetBitmapInfo( &info->bmiHeader, &width, &height,
&descr.infoBpp, &descr.compression ) == -1)
......@@ -3634,7 +3633,7 @@ INT X11DRV_SetDIBitsToDevice( X11DRV_PDEVICE *physDev, INT xDest, INT yDest, DWO
X11DRV_SetupGCForText( physDev ); /* To have the correct colors */
wine_tsx11_lock();
XSetFunction(gdi_display, physDev->gc, X11DRV_XROPfunction[dc->ROPmode-1]);
XSetFunction(gdi_display, physDev->gc, X11DRV_XROPfunction[GetROP2(physDev->hdc) - 1]);
wine_tsx11_unlock();
switch (descr.infoBpp)
......@@ -3644,7 +3643,7 @@ INT X11DRV_SetDIBitsToDevice( X11DRV_PDEVICE *physDev, INT xDest, INT yDest, DWO
case 8:
descr.colorMap = (RGBQUAD *)X11DRV_DIB_BuildColorMap(
coloruse == DIB_PAL_COLORS ? physDev : NULL, coloruse,
dc->bitsPerPixel, info, &descr.nColorMap );
physDev->depth, info, &descr.nColorMap );
if (!descr.colorMap) return 0;
descr.rMask = descr.gMask = descr.bMask = 0;
break;
......@@ -3671,7 +3670,7 @@ INT X11DRV_SetDIBitsToDevice( X11DRV_PDEVICE *physDev, INT xDest, INT yDest, DWO
descr.palentry = NULL;
descr.lines = top_down ? -lines : lines;
descr.infoWidth = width;
descr.depth = dc->bitsPerPixel;
descr.depth = physDev->depth;
descr.drawable = physDev->drawable;
descr.gc = physDev->gc;
descr.xSrc = xSrc;
......
......@@ -946,7 +946,6 @@ X11DRV_GetPixel( X11DRV_PDEVICE *physDev, INT x, INT y )
int pixel;
POINT pt;
BOOL memdc = (GetObjectType(physDev->hdc) == OBJ_MEMDC);
DC *dc = physDev->dc;
pt.x = x;
pt.y = y;
......@@ -967,7 +966,7 @@ X11DRV_GetPixel( X11DRV_PDEVICE *physDev, INT x, INT y )
/* If we are reading from the screen, use a temporary copy */
/* to avoid a BadMatch error */
if (!pixmap) pixmap = XCreatePixmap( gdi_display, root_window,
1, 1, dc->bitsPerPixel );
1, 1, physDev->depth );
XCopyArea( gdi_display, physDev->drawable, pixmap, BITMAP_colorGC,
physDev->org.x + pt.x, physDev->org.y + pt.y, 1, 1, 0, 0 );
image = XGetImage( gdi_display, pixmap, 0, 0, 1, 1, AllPlanes, ZPixmap );
......
......@@ -105,11 +105,12 @@ BOOL X11DRV_CreateDC( DC *dc, X11DRV_PDEVICE **pdev, LPCWSTR driver, LPCWSTR dev
if (GetObjectType( dc->hSelf ) == OBJ_MEMDC)
{
physDev->drawable = BITMAP_stock_pixmap;
physDev->depth = 1;
}
else
{
physDev->drawable = root_window;
dc->bitsPerPixel = screen_depth;
physDev->depth = screen_depth;
}
physDev->org.x = physDev->org.y = 0;
physDev->drawable_org.x = physDev->drawable_org.y = 0;
......
......@@ -891,7 +891,7 @@ int X11DRV_PALETTE_ToPhysical( X11DRV_PDEVICE *physDev, COLORREF color )
/* fall through to RGB */
case 0: /* RGB */
if( dc && (dc->bitsPerPixel == 1) )
if (physDev && (physDev->depth == 1) )
{
GDI_ReleaseObj( hPal );
return (((color >> 16) & 0xff) +
......@@ -944,7 +944,7 @@ int X11DRV_PALETTE_ToPhysical( X11DRV_PDEVICE *physDev, COLORREF color )
/* fall through to RGB */
case 0: /* RGB */
if( dc && (dc->bitsPerPixel == 1) )
if (physDev && (physDev->depth == 1) )
{
GDI_ReleaseObj( hPal );
return (((color >> 16) & 0xff) +
......
......@@ -97,6 +97,7 @@ typedef struct
X_PHYSBRUSH brush;
int backgroundPixel;
int textPixel;
int depth; /* bit depth of the DC */
int exposures; /* count of graphics exposures operations */
XVisualInfo *visuals[MAX_PIXELFORMATS];
int used_visuals;
......
......@@ -1009,7 +1009,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
X11DRV_LockDIBSection( physDev, DIB_Status_GdiMod, FALSE );
if(dc->bitsPerPixel == 1) {
if(physDev->depth == 1) {
if((dc->textColor & 0xffffff) == 0) {
textPixel = 0;
backgroundPixel = 1;
......@@ -1136,7 +1136,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
wine_tsx11_lock();
physDev->xrender->pict = pXRenderCreatePicture(gdi_display,
physDev->drawable,
(dc->bitsPerPixel == 1) ?
(physDev->depth == 1) ?
mono_format : screen_format,
CPSubwindowMode, &pa);
wine_tsx11_unlock();
......@@ -1176,7 +1176,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
if(!physDev->xrender->tile_xpm) {
XRenderPictureAttributes pa;
XRenderPictFormat *format = (dc->bitsPerPixel == 1) ? mono_format : screen_format;
XRenderPictFormat *format = (physDev->depth == 1) ? mono_format : screen_format;
wine_tsx11_lock();
physDev->xrender->tile_xpm = XCreatePixmap(gdi_display,
physDev->drawable,
......@@ -1195,7 +1195,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
}
if(dc->textColor != physDev->xrender->lastTextColor) {
if(dc->bitsPerPixel != 1) {
if(physDev->depth != 1) {
/* Map 0 -- 0xff onto 0 -- 0xffff */
col.red = GetRValue(dc->textColor);
col.red |= col.red << 8;
......@@ -1218,7 +1218,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
/* FIXME the mapping of Text/BkColor onto 1 or 0 needs investigation.
*/
if((dc->bitsPerPixel == 1) && (textPixel == 0))
if((physDev->depth == 1) && (textPixel == 0))
render_op = PictOpOutReverse; /* This gives us 'black' text */
}
......@@ -1320,7 +1320,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
yoff += entry->gis[glyphs[idx]].yOff;
}
}
} else if(dc->bitsPerPixel == 1) {
} else if(physDev->depth == 1) {
for(idx = 0; idx < count; idx++) {
SharpGlyphGray(physDev, physDev->org.x + x + xoff,
physDev->org.y + y + yoff,
......@@ -1406,10 +1406,10 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
TRACE("XGetImage(%p, %x, %d, %d, %d, %d, %lx, %x) depth = %d rets %p\n",
gdi_display, (int)physDev->drawable, image_x, image_y,
image_w, image_h, AllPlanes, ZPixmap,
dc->bitsPerPixel, image);
physDev->depth, image);
if(!image) {
Pixmap xpm = XCreatePixmap(gdi_display, physDev->drawable, image_w, image_h,
dc->bitsPerPixel);
physDev->depth);
GC gc;
XGCValues gcv;
......
......@@ -60,9 +60,8 @@ BOOL WINAPI BitBlt( HDC hdcDst, INT xDst, INT yDst, INT width,
if ((dcDst = DC_GetDCUpdate( hdcDst )))
{
dcSrc = DC_GetDCPtr( hdcSrc );
TRACE("hdcSrc=%p %d,%d %d bpp->hdcDest=%p %d,%d %dx%dx%d rop=%06lx\n",
hdcSrc, xSrc, ySrc, dcSrc ? dcSrc->bitsPerPixel : 0,
hdcDst, xDst, yDst, width, height, dcDst->bitsPerPixel, rop);
TRACE("hdcSrc=%p %d,%d -> hdcDest=%p %d,%d %dx%d rop=%06lx\n",
hdcSrc, xSrc, ySrc, hdcDst, xDst, yDst, width, height, rop);
if (dcDst->funcs->pBitBlt)
ret = dcDst->funcs->pBitBlt( dcDst->physDev, xDst, yDst, width, height,
dcSrc ? dcSrc->physDev : NULL, xSrc, ySrc, rop );
......@@ -91,10 +90,9 @@ BOOL WINAPI StretchBlt( HDC hdcDst, INT xDst, INT yDst,
{
dcSrc = DC_GetDCPtr( hdcSrc );
TRACE("%p %d,%d %dx%dx%d -> %p %d,%d %dx%dx%d rop=%06lx\n",
TRACE("%p %d,%d %dx%d -> %p %d,%d %dx%d rop=%06lx\n",
hdcSrc, xSrc, ySrc, widthSrc, heightSrc,
dcSrc ? dcSrc->bitsPerPixel : 0, hdcDst, xDst, yDst,
widthDst, heightDst, dcDst->bitsPerPixel, rop );
hdcDst, xDst, yDst, widthDst, heightDst, rop );
if (dcSrc) {
if (dcDst->funcs->pStretchBlt)
......
......@@ -146,7 +146,6 @@ typedef struct tagDC
short breakRem; /* breakTotalExtra % breakCount */
RECT totalExtent;
BYTE bitsPerPixel;
INT MapMode;
INT GraphicsMode; /* Graphics mode */
......
......@@ -173,12 +173,24 @@ HBITMAP WINAPI CreateCompatibleBitmap( HDC hdc, INT width, INT height)
if ((width >= 0x10000) || (height >= 0x10000)) {
FIXME("got bad width %d or height %d, please look for reason\n",
width, height );
} else {
/* MS doc says if width or height is 0, return 1-by-1 pixel, monochrome bitmap */
if (!width || !height)
hbmpRet = CreateBitmap( 1, 1, 1, 1, NULL );
}
else
hbmpRet = CreateBitmap( width, height, 1, dc->bitsPerPixel, NULL );
{
INT planes, bpp;
if (GDIMAGIC( dc->header.wMagic ) != MEMORY_DC_MAGIC)
{
planes = GetDeviceCaps( hdc, PLANES );
bpp = GetDeviceCaps( hdc, BITSPIXEL );
}
else /* memory DC, get the depth of the bitmap */
{
BITMAPOBJ *bmp = GDI_GetObjPtr( dc->hBitmap, BITMAP_MAGIC );
planes = bmp->bitmap.bmPlanes;
bpp = bmp->bitmap.bmBitsPixel;
GDI_ReleaseObj( dc->hBitmap );
}
hbmpRet = CreateBitmap( width, height, planes, bpp, NULL );
}
TRACE("\t\t%p\n", hbmpRet);
GDI_ReleaseObj(hdc);
......@@ -433,15 +445,8 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, void *obj, HDC hdc )
dc->totalExtent.bottom = bitmap->bitmap.bmHeight;
dc->flags &= ~DC_DIRTY;
SetRectRgn( dc->hVisRgn, 0, 0, bitmap->bitmap.bmWidth, bitmap->bitmap.bmHeight);
CLIPPING_UpdateGCRegion( dc );
if (dc->bitsPerPixel != bitmap->bitmap.bmBitsPixel)
{
/* depth changed, reinitialize the DC */
dc->bitsPerPixel = bitmap->bitmap.bmBitsPixel;
DC_InitDC( dc );
}
}
else ret = 0;
done:
......
......@@ -107,7 +107,6 @@ DC *DC_AllocDC( const DC_FUNCTIONS *funcs, WORD magic )
dc->totalExtent.top = 0;
dc->totalExtent.right = 0;
dc->totalExtent.bottom = 0;
dc->bitsPerPixel = 1;
dc->MapMode = MM_TEXT;
dc->GraphicsMode = GM_COMPATIBLE;
dc->pAbortProc = NULL;
......@@ -297,7 +296,6 @@ HDC WINAPI GetDCState( HDC hdc )
newdc->hDevice = dc->hDevice;
newdc->hPalette = dc->hPalette;
newdc->totalExtent = dc->totalExtent;
newdc->bitsPerPixel = dc->bitsPerPixel;
newdc->ROPmode = dc->ROPmode;
newdc->polyFillMode = dc->polyFillMode;
newdc->stretchBltMode = dc->stretchBltMode;
......@@ -424,8 +422,6 @@ void WINAPI SetDCState( HDC hdc, HDC hdcs )
dc->vportExtX = dcs->vportExtX;
dc->vportExtY = dcs->vportExtY;
if (GDIMAGIC(dc->header.wMagic) != MEMORY_DC_MAGIC) dc->bitsPerPixel = dcs->bitsPerPixel;
if (dcs->hClipRgn)
{
if (!dc->hClipRgn) dc->hClipRgn = CreateRectRgn( 0, 0, 0, 0 );
......@@ -723,7 +719,6 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
TRACE("(%p): returning %p\n", hdc, dc->hSelf );
dc->bitsPerPixel = 1;
dc->hBitmap = GetStockObject( DEFAULT_BITMAP );
/* Copy the driver-specific physical device info into
......
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