Use GetStockObject() instead of the magic STOCK_* handles.

This commit is contained in:
Alexandre Julliard 2000-10-29 01:22:15 +00:00
parent d207d270b6
commit 4c18636d4e
4 changed files with 15 additions and 15 deletions

View File

@ -669,7 +669,7 @@ COLORREF X11DRV_PALETTE_ToLogical(int pixel)
int X11DRV_PALETTE_ToPhysical( DC *dc, COLORREF color )
{
WORD index = 0;
HPALETTE16 hPal = (dc)? dc->w.hPalette: STOCK_DEFAULT_PALETTE;
HPALETTE16 hPal = (dc)? dc->w.hPalette: GetStockObject(DEFAULT_PALETTE);
unsigned char spec_type = color >> 24;
PALETTEOBJ* palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hPal, PALETTE_MAGIC );

View File

@ -34,12 +34,12 @@ static void DC_Init_DC_INFO( WIN_DC_INFO *win_dc_info )
win_dc_info->hClipRgn = 0;
win_dc_info->hVisRgn = 0;
win_dc_info->hGCClipRgn = 0;
win_dc_info->hPen = STOCK_BLACK_PEN;
win_dc_info->hBrush = STOCK_WHITE_BRUSH;
win_dc_info->hFont = STOCK_SYSTEM_FONT;
win_dc_info->hPen = GetStockObject( BLACK_PEN );
win_dc_info->hBrush = GetStockObject( WHITE_BRUSH );
win_dc_info->hFont = GetStockObject( SYSTEM_FONT );
win_dc_info->hBitmap = 0;
win_dc_info->hDevice = 0;
win_dc_info->hPalette = STOCK_DEFAULT_PALETTE;
win_dc_info->hPalette = GetStockObject( DEFAULT_PALETTE );
win_dc_info->ROPmode = R2_COPYPEN;
win_dc_info->polyFillMode = ALTERNATE;
win_dc_info->stretchBltMode = BLACKONWHITE;
@ -739,9 +739,9 @@ BOOL WINAPI DeleteDC( HDC hdc )
if (!(dc->w.flags & DC_SAVED))
{
SelectObject( hdc, STOCK_BLACK_PEN );
SelectObject( hdc, STOCK_WHITE_BRUSH );
SelectObject( hdc, STOCK_SYSTEM_FONT );
SelectObject( hdc, GetStockObject(BLACK_PEN) );
SelectObject( hdc, GetStockObject(WHITE_BRUSH) );
SelectObject( hdc, GetStockObject(SYSTEM_FONT) );
if (dc->funcs->pDeleteDC) dc->funcs->pDeleteDC(dc);
}

View File

@ -385,7 +385,7 @@ BOOL WINAPI AnimatePalette(
{
TRACE("%04x (%i - %i)\n", hPal, StartIndex,StartIndex+NumEntries);
if( hPal != STOCK_DEFAULT_PALETTE )
if( hPal != GetStockObject(DEFAULT_PALETTE) )
{
PALETTEOBJ* palPtr = (PALETTEOBJ *)GDI_GetObjPtr(hPal, PALETTE_MAGIC);
if (!palPtr) return FALSE;
@ -578,7 +578,7 @@ COLORREF WINAPI GetNearestColor(
if ( (dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC )) )
{
HPALETTE hpal = (dc->w.hPalette)? dc->w.hPalette : STOCK_DEFAULT_PALETTE;
HPALETTE hpal = (dc->w.hPalette)? dc->w.hPalette : GetStockObject( DEFAULT_PALETTE );
palObj = GDI_GetObjPtr( hpal, PALETTE_MAGIC );
if (!palObj) {
GDI_ReleaseObj( hdc );
@ -672,7 +672,7 @@ UINT16 WINAPI GDIRealizePalette16( HDC16 hdc )
if(dc->w.hPalette != hLastRealizedPalette )
{
if( dc->w.hPalette == STOCK_DEFAULT_PALETTE ) {
if( dc->w.hPalette == GetStockObject( DEFAULT_PALETTE )) {
realized = RealizeDefaultPalette16( hdc );
GDI_ReleaseObj( hdc );
return (UINT16)realized;
@ -690,7 +690,7 @@ UINT16 WINAPI GDIRealizePalette16( HDC16 hdc )
realized = PALETTE_Driver->
pSetMapping(palPtr,0,palPtr->logpalette.palNumEntries,
(dc->w.hPalette != hPrimaryPalette) ||
(dc->w.hPalette == STOCK_DEFAULT_PALETTE));
(dc->w.hPalette == GetStockObject( DEFAULT_PALETTE )));
hLastRealizedPalette = dc->w.hPalette;
GDI_ReleaseObj( dc->w.hPalette );
}
@ -718,12 +718,12 @@ UINT16 WINAPI RealizeDefaultPalette16( HDC16 hdc )
if (!(dc->w.flags & DC_MEMORY))
{
palPtr = (PALETTEOBJ*)GDI_GetObjPtr(STOCK_DEFAULT_PALETTE, PALETTE_MAGIC );
palPtr = (PALETTEOBJ*)GDI_GetObjPtr( GetStockObject(DEFAULT_PALETTE), PALETTE_MAGIC );
if (palPtr)
{
/* lookup is needed to account for SetSystemPaletteUse() stuff */
ret = PALETTE_Driver->pUpdateMapping(palPtr);
GDI_ReleaseObj( STOCK_DEFAULT_PALETTE );
GDI_ReleaseObj( GetStockObject(DEFAULT_PALETTE) );
}
}
GDI_ReleaseObj( hdc );

View File

@ -1683,7 +1683,7 @@ HPALETTE16 WINAPI SelectPalette16( HDC16 hDC, HPALETTE16 hPal,
{
WORD wBkgPalette = 1;
if (!bForceBackground && (hPal != STOCK_DEFAULT_PALETTE))
if (!bForceBackground && (hPal != GetStockObject(DEFAULT_PALETTE)))
{
HWND hwnd = WindowFromDC( hDC );
if (hwnd)