Commit d1795f67 authored by Gerard Patel's avatar Gerard Patel Committed by Alexandre Julliard

Avoid deleting of the default 1x1 bitmap for memory DCs.

parent 74e4a28a
......@@ -97,7 +97,6 @@ typedef struct
HBRUSH16 hBrush;
HFONT16 hFont;
HBITMAP16 hBitmap;
HBITMAP16 hFirstBitmap; /* Bitmap selected at creation of the DC */
HANDLE16 hDevice;
HPALETTE16 hPalette;
......@@ -320,6 +319,8 @@ typedef struct tagDC_FUNCS
#define LAST_STOCK_HANDLE ((DWORD)STOCK_DEFAULT_GUI_FONT)
extern HBITMAP hPseudoStockBitmap;
/* Device <-> logical coords conversion */
/* A floating point version of the POINT structure */
......
......@@ -41,7 +41,6 @@ static void DC_Init_DC_INFO( WIN_DC_INFO *win_dc_info )
win_dc_info->hBrush = STOCK_WHITE_BRUSH;
win_dc_info->hFont = STOCK_SYSTEM_FONT;
win_dc_info->hBitmap = 0;
win_dc_info->hFirstBitmap = 0;
win_dc_info->hDevice = 0;
win_dc_info->hPalette = STOCK_DEFAULT_PALETTE;
win_dc_info->ROPmode = R2_COPYPEN;
......@@ -238,7 +237,6 @@ HDC16 WINAPI GetDCState16( HDC16 hdc )
newdc->w.hBrush = dc->w.hBrush;
newdc->w.hFont = dc->w.hFont;
newdc->w.hBitmap = dc->w.hBitmap;
newdc->w.hFirstBitmap = dc->w.hFirstBitmap;
newdc->w.hDevice = dc->w.hDevice;
newdc->w.hPalette = dc->w.hPalette;
newdc->w.totalExtent = dc->w.totalExtent;
......@@ -327,7 +325,6 @@ void WINAPI SetDCState16( HDC16 hdc, HDC16 hdcs )
dc->w.flags = dcs->w.flags & ~DC_SAVED;
dc->w.devCaps = dcs->w.devCaps;
dc->w.hFirstBitmap = dcs->w.hFirstBitmap;
dc->w.hDevice = dcs->w.hDevice;
dc->w.totalExtent = dcs->w.totalExtent;
dc->w.ROPmode = dcs->w.ROPmode;
......@@ -629,16 +626,9 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
TRACE("(%04x): returning %04x\n",
hdc, dc->hSelf );
/* Create default bitmap */
if (!(hbitmap = CreateBitmap( 1, 1, 1, 1, NULL )))
{
GDI_HEAP_FREE( dc->hSelf );
return 0;
}
dc->w.flags = DC_MEMORY;
dc->w.bitsPerPixel = 1;
dc->w.hBitmap = hbitmap;
dc->w.hFirstBitmap = hbitmap;
dc->w.hBitmap = hPseudoStockBitmap;
/* Copy the driver-specific physical device info into
* the new DC. The driver may use this read-only info
......@@ -703,7 +693,6 @@ BOOL WINAPI DeleteDC( HDC hdc )
SelectObject( hdc, STOCK_BLACK_PEN );
SelectObject( hdc, STOCK_WHITE_BRUSH );
SelectObject( hdc, STOCK_SYSTEM_FONT );
if (dc->w.flags & DC_MEMORY) DeleteObject( dc->w.hFirstBitmap );
if (dc->funcs->pDeleteDC) dc->funcs->pDeleteDC(dc);
}
......
......@@ -179,6 +179,8 @@ static GDIOBJHDR * StockObjects[NB_STOCK_OBJECTS] =
(GDIOBJHDR *) &DefaultGuiFont
};
HBITMAP hPseudoStockBitmap; /* 1x1 bitmap for memory DCs */
/******************************************************************************
*
* void ReadFontInformation(
......@@ -359,6 +361,7 @@ BOOL GDI_Init(void)
StockObjects[DEFAULT_PALETTE] = (GDIOBJHDR *)GDI_HEAP_LOCK( hpalette );
}
hPseudoStockBitmap = CreateBitmap( 1, 1, 1, 1, NULL );
return TRUE;
}
......@@ -452,6 +455,7 @@ BOOL WINAPI DeleteObject( HGDIOBJ obj )
if (HIWORD(obj)) return FALSE;
if ((obj >= FIRST_STOCK_HANDLE) && (obj <= LAST_STOCK_HANDLE))
return TRUE;
if (obj == hPseudoStockBitmap) return TRUE;
if (!(header = (GDIOBJHDR *) GDI_HEAP_LOCK( obj ))) return FALSE;
TRACE("%04x\n", obj );
......
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