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 ) int X11DRV_PALETTE_ToPhysical( DC *dc, COLORREF color )
{ {
WORD index = 0; 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; unsigned char spec_type = color >> 24;
PALETTEOBJ* palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hPal, PALETTE_MAGIC ); 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->hClipRgn = 0;
win_dc_info->hVisRgn = 0; win_dc_info->hVisRgn = 0;
win_dc_info->hGCClipRgn = 0; win_dc_info->hGCClipRgn = 0;
win_dc_info->hPen = STOCK_BLACK_PEN; win_dc_info->hPen = GetStockObject( BLACK_PEN );
win_dc_info->hBrush = STOCK_WHITE_BRUSH; win_dc_info->hBrush = GetStockObject( WHITE_BRUSH );
win_dc_info->hFont = STOCK_SYSTEM_FONT; win_dc_info->hFont = GetStockObject( SYSTEM_FONT );
win_dc_info->hBitmap = 0; win_dc_info->hBitmap = 0;
win_dc_info->hDevice = 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->ROPmode = R2_COPYPEN;
win_dc_info->polyFillMode = ALTERNATE; win_dc_info->polyFillMode = ALTERNATE;
win_dc_info->stretchBltMode = BLACKONWHITE; win_dc_info->stretchBltMode = BLACKONWHITE;
@ -739,9 +739,9 @@ BOOL WINAPI DeleteDC( HDC hdc )
if (!(dc->w.flags & DC_SAVED)) if (!(dc->w.flags & DC_SAVED))
{ {
SelectObject( hdc, STOCK_BLACK_PEN ); SelectObject( hdc, GetStockObject(BLACK_PEN) );
SelectObject( hdc, STOCK_WHITE_BRUSH ); SelectObject( hdc, GetStockObject(WHITE_BRUSH) );
SelectObject( hdc, STOCK_SYSTEM_FONT ); SelectObject( hdc, GetStockObject(SYSTEM_FONT) );
if (dc->funcs->pDeleteDC) dc->funcs->pDeleteDC(dc); 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); 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); PALETTEOBJ* palPtr = (PALETTEOBJ *)GDI_GetObjPtr(hPal, PALETTE_MAGIC);
if (!palPtr) return FALSE; if (!palPtr) return FALSE;
@ -578,7 +578,7 @@ COLORREF WINAPI GetNearestColor(
if ( (dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC )) ) 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 ); palObj = GDI_GetObjPtr( hpal, PALETTE_MAGIC );
if (!palObj) { if (!palObj) {
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
@ -672,7 +672,7 @@ UINT16 WINAPI GDIRealizePalette16( HDC16 hdc )
if(dc->w.hPalette != hLastRealizedPalette ) if(dc->w.hPalette != hLastRealizedPalette )
{ {
if( dc->w.hPalette == STOCK_DEFAULT_PALETTE ) { if( dc->w.hPalette == GetStockObject( DEFAULT_PALETTE )) {
realized = RealizeDefaultPalette16( hdc ); realized = RealizeDefaultPalette16( hdc );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return (UINT16)realized; return (UINT16)realized;
@ -690,7 +690,7 @@ UINT16 WINAPI GDIRealizePalette16( HDC16 hdc )
realized = PALETTE_Driver-> realized = PALETTE_Driver->
pSetMapping(palPtr,0,palPtr->logpalette.palNumEntries, pSetMapping(palPtr,0,palPtr->logpalette.palNumEntries,
(dc->w.hPalette != hPrimaryPalette) || (dc->w.hPalette != hPrimaryPalette) ||
(dc->w.hPalette == STOCK_DEFAULT_PALETTE)); (dc->w.hPalette == GetStockObject( DEFAULT_PALETTE )));
hLastRealizedPalette = dc->w.hPalette; hLastRealizedPalette = dc->w.hPalette;
GDI_ReleaseObj( dc->w.hPalette ); GDI_ReleaseObj( dc->w.hPalette );
} }
@ -718,12 +718,12 @@ UINT16 WINAPI RealizeDefaultPalette16( HDC16 hdc )
if (!(dc->w.flags & DC_MEMORY)) 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) if (palPtr)
{ {
/* lookup is needed to account for SetSystemPaletteUse() stuff */ /* lookup is needed to account for SetSystemPaletteUse() stuff */
ret = PALETTE_Driver->pUpdateMapping(palPtr); ret = PALETTE_Driver->pUpdateMapping(palPtr);
GDI_ReleaseObj( STOCK_DEFAULT_PALETTE ); GDI_ReleaseObj( GetStockObject(DEFAULT_PALETTE) );
} }
} }
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );

View File

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