Remove unused flags and start using new dc type ids.

svn path=/trunk/; revision=31660
This commit is contained in:
James Tabor 2008-01-08 03:48:08 +00:00
parent 689819ce3e
commit 238f8e2ac9
12 changed files with 33 additions and 43 deletions

View file

@ -394,7 +394,6 @@ typedef struct _DC
INT saveLevel; // DCLEVEL lSaveDepth INT saveLevel; // DCLEVEL lSaveDepth
HDC hSelf; // DCLEVEL hdcSave Used only for MemoryDC & SaveDC. HDC hSelf; // DCLEVEL hdcSave Used only for MemoryDC & SaveDC.
BOOL IsIC; // Use DC_Type
HPALETTE PalIndexed; HPALETTE PalIndexed;

View file

@ -5,12 +5,8 @@
#include "driver.h" #include "driver.h"
/* DC flags */ /* DC flags */
#define DC_MEMORY 0x0001 /* It is a memory DC */
#define DC_SAVED 0x0002 /* It is a saved DC */ #define DC_SAVED 0x0002 /* It is a saved DC */
#define DC_DIRTY 0x0004 /* hVisRgn has to be updated */ #define DC_DIRTY 0x0004 /* hVisRgn has to be updated */
#define DC_THUNKHOOK 0x0008 /* DC hook is in the 16-bit code */
#define GDI_DC_TYPE (1)
// GDIDEVICE flags // GDIDEVICE flags
#define PDEV_DISPLAY 0x00000001 // Display device #define PDEV_DISPLAY 0x00000001 // Display device

View file

@ -90,7 +90,7 @@ NtGdiArcInternal(
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
if (dc->IsIC) if (dc->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(dc); DC_UnlockDc(dc);
/* Yes, Windows really returns TRUE in this case */ /* Yes, Windows really returns TRUE in this case */

View file

@ -58,7 +58,7 @@ NtGdiAlphaBlend(
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
if (DCDest->IsIC) if (DCDest->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(DCDest); DC_UnlockDc(DCDest);
/* Yes, Windows really returns TRUE in this case */ /* Yes, Windows really returns TRUE in this case */
@ -75,7 +75,7 @@ NtGdiAlphaBlend(
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
if (DCSrc->IsIC) if (DCSrc->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(DCSrc); DC_UnlockDc(DCSrc);
DC_UnlockDc(DCDest); DC_UnlockDc(DCDest);
@ -204,7 +204,7 @@ NtGdiBitBlt(
DPRINT("Invalid destination dc handle (0x%08x) passed to NtGdiBitBlt\n", hDCDest); DPRINT("Invalid destination dc handle (0x%08x) passed to NtGdiBitBlt\n", hDCDest);
return FALSE; return FALSE;
} }
if (DCDest->IsIC) if (DCDest->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(DCDest); DC_UnlockDc(DCDest);
/* Yes, Windows really returns TRUE in this case */ /* Yes, Windows really returns TRUE in this case */
@ -222,7 +222,7 @@ NtGdiBitBlt(
DPRINT("Invalid source dc handle (0x%08x) passed to NtGdiBitBlt\n", hDCSrc); DPRINT("Invalid source dc handle (0x%08x) passed to NtGdiBitBlt\n", hDCSrc);
return FALSE; return FALSE;
} }
if (DCSrc->IsIC) if (DCSrc->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(DCSrc); DC_UnlockDc(DCSrc);
DC_UnlockDc(DCDest); DC_UnlockDc(DCDest);
@ -424,7 +424,7 @@ NtGdiTransparentBlt(
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
if (DCDest->IsIC) if (DCDest->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(DCDest); DC_UnlockDc(DCDest);
/* Yes, Windows really returns TRUE in this case */ /* Yes, Windows really returns TRUE in this case */
@ -442,7 +442,7 @@ NtGdiTransparentBlt(
{ {
DCSrc = DCDest; DCSrc = DCDest;
} }
if (DCSrc->IsIC) if (DCSrc->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(DCSrc); DC_UnlockDc(DCSrc);
if(hdcDst != hdcSrc) if(hdcDst != hdcSrc)
@ -814,7 +814,7 @@ NtGdiStretchBlt(
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
if (DCDest->IsIC) if (DCDest->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(DCDest); DC_UnlockDc(DCDest);
/* Yes, Windows really returns TRUE in this case */ /* Yes, Windows really returns TRUE in this case */
@ -833,7 +833,7 @@ NtGdiStretchBlt(
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
if (DCSrc->IsIC) if (DCSrc->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(DCSrc); DC_UnlockDc(DCSrc);
DC_UnlockDc(DCDest); DC_UnlockDc(DCDest);
@ -1103,7 +1103,7 @@ IntGdiPolyPatBlt(
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
if (dc->IsIC) if (dc->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(dc); DC_UnlockDc(dc);
/* Yes, Windows really returns TRUE in this case */ /* Yes, Windows really returns TRUE in this case */
@ -1155,7 +1155,7 @@ NtGdiPatBlt(
} }
Dc_Attr = dc->pDc_Attr; Dc_Attr = dc->pDc_Attr;
if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr; if(!Dc_Attr) Dc_Attr = &dc->Dc_Attr;
if (dc->IsIC) if (dc->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(dc); DC_UnlockDc(dc);
/* Yes, Windows really returns TRUE in this case */ /* Yes, Windows really returns TRUE in this case */

View file

@ -257,7 +257,7 @@ NtGdiGetPixel(HDC hDC, INT XPos, INT YPos)
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return Result; return Result;
} }
if (dc->IsIC) if (dc->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(dc); DC_UnlockDc(dc);
return Result; return Result;

View file

@ -548,7 +548,7 @@ UINT FASTCALL IntGdiRealizePalette(HDC hDC)
// The RealizePalette function modifies the palette for the device associated with the specified device context. If the // The RealizePalette function modifies the palette for the device associated with the specified device context. If the
// device context is a memory DC, the color table for the bitmap selected into the DC is modified. If the device // device context is a memory DC, the color table for the bitmap selected into the DC is modified. If the device
// context is a display DC, the physical palette for that device is modified. // context is a display DC, the physical palette for that device is modified.
if(dc->w.flags == DC_MEMORY) if(dc->DC_Type == DC_TYPE_MEMORY)
{ {
// Memory managed DC // Memory managed DC
ASSERT(sysGDI->NumColors <= 256); ASSERT(sysGDI->NumColors <= 256);
@ -571,7 +571,7 @@ UINT FASTCALL IntGdiRealizePalette(HDC hDC)
PALETTE_UnlockPalette(palGDI); PALETTE_UnlockPalette(palGDI);
// Step 3: Create the XLATEOBJ for device managed DCs // Step 3: Create the XLATEOBJ for device managed DCs
if(dc->w.flags != DC_MEMORY) if(dc->DC_Type != DC_TYPE_MEMORY)
{ {
// Device managed DC // Device managed DC
palGDI->logicalToSystem = IntEngCreateXlate(sysMode, palMode, systemPalette, dc->w.hPalette); palGDI->logicalToSystem = IntEngCreateXlate(sysMode, palMode, systemPalette, dc->w.hPalette);

View file

@ -62,7 +62,6 @@ NtGdiCreateCompatibleDC(HDC hDC)
HDC hNewDC, DisplayDC; HDC hNewDC, DisplayDC;
HRGN hVisRgn; HRGN hVisRgn;
UNICODE_STRING DriverName; UNICODE_STRING DriverName;
INT DC_Type = DC_TYPE_DIRECT;
DisplayDC = NULL; DisplayDC = NULL;
if (hDC == NULL) if (hDC == NULL)
@ -74,7 +73,6 @@ NtGdiCreateCompatibleDC(HDC hDC)
return NULL; return NULL;
} }
hDC = DisplayDC; hDC = DisplayDC;
DC_Type = DC_TYPE_MEMORY; // Null hDC == Memory DC.
} }
/* Allocate a new DC based on the original DC's device */ /* Allocate a new DC based on the original DC's device */
@ -106,8 +104,6 @@ NtGdiCreateCompatibleDC(HDC hDC)
/* Copy information from original DC to new DC */ /* Copy information from original DC to new DC */
NewDC->hSelf = hNewDC; NewDC->hSelf = hNewDC;
NewDC->IsIC = FALSE;
NewDC->DC_Type = DC_Type;
NewDC->PDev = OrigDC->PDev; NewDC->PDev = OrigDC->PDev;
@ -131,7 +127,7 @@ NtGdiCreateCompatibleDC(HDC hDC)
} }
return NULL; return NULL;
} }
NewDC->w.flags = DC_MEMORY; NewDC->DC_Type = DC_TYPE_MEMORY; // Always!
NewDC->w.hBitmap = hBitmap; NewDC->w.hBitmap = hBitmap;
NewDC->w.hFirstBitmap = hBitmap; NewDC->w.hFirstBitmap = hBitmap;
NewDC->pPDev = OrigDC->pPDev; NewDC->pPDev = OrigDC->pPDev;
@ -802,7 +798,6 @@ IntGdiCreateDC(PUNICODE_STRING Driver,
if(!nDc_Attr) nDc_Attr = &NewDC->Dc_Attr; if(!nDc_Attr) nDc_Attr = &NewDC->Dc_Attr;
NewDC->DC_Type = DC_TYPE_DIRECT; NewDC->DC_Type = DC_TYPE_DIRECT;
NewDC->IsIC = CreateAsIC;
NewDC->PDev = PrimarySurface.hPDev; NewDC->PDev = PrimarySurface.hPDev;
if(pUMdhpdev) pUMdhpdev = NewDC->PDev; // set DHPDEV for device. if(pUMdhpdev) pUMdhpdev = NewDC->PDev; // set DHPDEV for device.
@ -974,7 +969,7 @@ IntGdiDeleteDC(HDC hDC, BOOL Force)
NtGdiSelectBrush (DCHandle, STOCK_WHITE_BRUSH); NtGdiSelectBrush (DCHandle, STOCK_WHITE_BRUSH);
NtGdiSelectFont (DCHandle, STOCK_SYSTEM_FONT); NtGdiSelectFont (DCHandle, STOCK_SYSTEM_FONT);
DC_LockDC (DCHandle); NtGdiSelectXxx does not recognize stock objects yet */ DC_LockDC (DCHandle); NtGdiSelectXxx does not recognize stock objects yet */
if (DCToDelete->w.flags & DC_MEMORY) if (DCToDelete->DC_Type == DC_TYPE_MEMORY)
{ {
NtGdiDeleteObject (DCToDelete->w.hFirstBitmap); NtGdiDeleteObject (DCToDelete->w.hFirstBitmap);
} }
@ -1256,7 +1251,7 @@ IntGdiCopyToSaveState(PDC dc, PDC newdc)
nDc_Attr->szlViewportExt = Dc_Attr->szlViewportExt; nDc_Attr->szlViewportExt = Dc_Attr->szlViewportExt;
newdc->saveLevel = 0; newdc->saveLevel = 0;
newdc->IsIC = dc->IsIC; newdc->DC_Type = dc->DC_Type;
#if 0 #if 0
PATH_InitGdiPath( &newdc->w.path ); PATH_InitGdiPath( &newdc->w.path );
@ -1330,7 +1325,7 @@ IntGdiCopyFromSaveState(PDC dc, PDC dcs, HDC hDC)
Dc_Attr->szlViewportExt = sDc_Attr->szlViewportExt; Dc_Attr->szlViewportExt = sDc_Attr->szlViewportExt;
dc->PalIndexed = dcs->PalIndexed; dc->PalIndexed = dcs->PalIndexed;
if (!(dc->w.flags & DC_MEMORY)) if (dc->DC_Type != DC_TYPE_MEMORY)
{ {
dc->w.bitsPerPixel = dcs->w.bitsPerPixel; dc->w.bitsPerPixel = dcs->w.bitsPerPixel;
} }
@ -1928,7 +1923,7 @@ NtGdiSelectBitmap(
if(!pDc_Attr) pDc_Attr = &pDC->Dc_Attr; if(!pDc_Attr) pDc_Attr = &pDC->Dc_Attr;
/* must be memory dc to select bitmap */ /* must be memory dc to select bitmap */
if (!(pDC->w.flags & DC_MEMORY)) if (pDC->DC_Type != DC_TYPE_MEMORY)
{ {
DC_UnlockDc(pDC); DC_UnlockDc(pDC);
return NULL; return NULL;

View file

@ -33,7 +33,7 @@ IntSetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, CONST RGBQUAD *Color
UINT Index; UINT Index;
if (!(dc = DC_LockDc(hDC))) return 0; if (!(dc = DC_LockDc(hDC))) return 0;
if (dc->IsIC) if (dc->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(dc); DC_UnlockDc(dc);
return 0; return 0;
@ -91,7 +91,7 @@ IntGetDIBColorTable(HDC hDC, UINT StartIndex, UINT Entries, RGBQUAD *Colors)
UINT Index; UINT Index;
if (!(dc = DC_LockDc(hDC))) return 0; if (!(dc = DC_LockDc(hDC))) return 0;
if (dc->IsIC) if (dc->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(dc); DC_UnlockDc(dc);
return 0; return 0;
@ -297,7 +297,7 @@ NtGdiSetDIBits(
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return 0; return 0;
} }
if (Dc->IsIC) if (Dc->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(Dc); DC_UnlockDc(Dc);
return 0; return 0;
@ -351,7 +351,7 @@ NtGdiSetDIBitsToDeviceInternal(
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return 0; return 0;
} }
if (pDC->IsIC) if (pDC->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(pDC); DC_UnlockDc(pDC);
return 0; return 0;
@ -466,7 +466,7 @@ NtGdiGetDIBitsInternal(HDC hDC,
/* Get handle for the palette in DC. */ /* Get handle for the palette in DC. */
Dc = DC_LockDc(hDC); Dc = DC_LockDc(hDC);
if (Dc == NULL) return 0; if (Dc == NULL) return 0;
if (Dc->IsIC) if (Dc->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(Dc); DC_UnlockDc(Dc);
return 0; return 0;

View file

@ -226,7 +226,7 @@ NtGdiEllipse(
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
if (dc->IsIC) if (dc->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(dc); DC_UnlockDc(dc);
/* Yes, Windows really returns TRUE in this case */ /* Yes, Windows really returns TRUE in this case */
@ -665,7 +665,7 @@ NtGdiPie(HDC hDC,
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
if (dc->IsIC) if (dc->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(dc); DC_UnlockDc(dc);
/* Yes, Windows really returns TRUE in this case */ /* Yes, Windows really returns TRUE in this case */
@ -861,7 +861,7 @@ NtGdiPolyPolyDraw( IN HDC hDC,
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
if (dc->IsIC) if (dc->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(dc); DC_UnlockDc(dc);
/* Yes, Windows really returns TRUE in this case */ /* Yes, Windows really returns TRUE in this case */
@ -1155,7 +1155,7 @@ NtGdiRectangle(HDC hDC,
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
if (dc->IsIC) if (dc->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(dc); DC_UnlockDc(dc);
/* Yes, Windows really returns TRUE in this case */ /* Yes, Windows really returns TRUE in this case */
@ -1461,7 +1461,7 @@ NtGdiRoundRect(
DPRINT1("NtGdiRoundRect() - hDC is invalid\n"); DPRINT1("NtGdiRoundRect() - hDC is invalid\n");
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
} }
else if (dc->IsIC) else if (dc->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(dc); DC_UnlockDc(dc);
/* Yes, Windows really returns TRUE in this case */ /* Yes, Windows really returns TRUE in this case */
@ -1599,7 +1599,7 @@ NtGdiGradientFill(
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
if (dc->IsIC) if (dc->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(dc); DC_UnlockDc(dc);
/* Yes, Windows really returns TRUE in this case */ /* Yes, Windows really returns TRUE in this case */

View file

@ -393,7 +393,7 @@ NtGdiLineTo(HDC hDC,
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
if (dc->IsIC) if (dc->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(dc); DC_UnlockDc(dc);
/* Yes, Windows really returns TRUE in this case */ /* Yes, Windows really returns TRUE in this case */

View file

@ -173,7 +173,7 @@ NtGdiExtEscape(
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return -1; return -1;
} }
if ( pDC->IsIC ) if ( pDC->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(pDC); DC_UnlockDc(pDC);
return 0; return 0;

View file

@ -1567,7 +1567,7 @@ NtGdiExtTextOutW(
SetLastWin32Error(ERROR_INVALID_HANDLE); SetLastWin32Error(ERROR_INVALID_HANDLE);
return FALSE; return FALSE;
} }
if (dc->IsIC) if (dc->DC_Type == DC_TYPE_INFO)
{ {
DC_UnlockDc(dc); DC_UnlockDc(dc);
/* Yes, Windows really returns TRUE in this case */ /* Yes, Windows really returns TRUE in this case */