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