From e8eda04c274faf99cebf2dd18580ebfadb137143 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Tue, 3 Jun 2008 03:41:54 +0000 Subject: [PATCH] Move from fixed PrimarySurface to pointer based pPrimarySurface. Misc changes.. svn path=/trunk/; revision=33832 --- reactos/subsystems/win32/win32k/eng/xlate.c | 4 ++-- reactos/subsystems/win32/win32k/include/dc.h | 12 ++---------- reactos/subsystems/win32/win32k/include/palette.h | 2 ++ reactos/subsystems/win32/win32k/objects/bitblt.c | 4 ++-- reactos/subsystems/win32/win32k/objects/bitmaps.c | 2 +- reactos/subsystems/win32/win32k/objects/brush.c | 2 +- reactos/subsystems/win32/win32k/objects/dc.c | 8 ++++---- reactos/subsystems/win32/win32k/objects/fillshap.c | 2 +- reactos/subsystems/win32/win32k/objects/text.c | 2 +- 9 files changed, 16 insertions(+), 22 deletions(-) diff --git a/reactos/subsystems/win32/win32k/eng/xlate.c b/reactos/subsystems/win32/win32k/eng/xlate.c index 7e5eb008d93..f484bc3ee7b 100644 --- a/reactos/subsystems/win32/win32k/eng/xlate.c +++ b/reactos/subsystems/win32/win32k/eng/xlate.c @@ -459,10 +459,10 @@ IntCreateXlateForBlt(PDC pDCDest, PDC pDCSrc, BITMAPOBJ* pDestSurf, BITMAPOBJ* p } DestPalette = pDestSurf->hDIBPalette; - if (!DestPalette) DestPalette = PrimarySurface.DevInfo.hpalDefault; + if (!DestPalette) DestPalette = pPrimarySurface->DevInfo.hpalDefault; SourcePalette = pSrcSurf->hDIBPalette; - if (!SourcePalette) SourcePalette = PrimarySurface.DevInfo.hpalDefault; + if (!SourcePalette) SourcePalette = pPrimarySurface->DevInfo.hpalDefault; DPRINT("DestPalette = %p, SourcePalette = %p, DefaultPatelle = %p\n", DestPalette, SourcePalette, NtGdiGetStockObject((INT)DEFAULT_PALETTE)); diff --git a/reactos/subsystems/win32/win32k/include/dc.h b/reactos/subsystems/win32/win32k/include/dc.h index f73ddce9054..59467d12528 100644 --- a/reactos/subsystems/win32/win32k/include/dc.h +++ b/reactos/subsystems/win32/win32k/include/dc.h @@ -140,7 +140,7 @@ typedef struct _DC INT DC_Type; INT DC_Flags; PVOID pPDev; // PGDIDEVICE aka PDEVOBJ - PVOID hSem; // PERESOURCE + PVOID hSem; // PERESOURCE aka HSEMAPHORE FLONG flGraphics; FLONG flGraphics2; PDC_ATTR pDc_Attr; @@ -254,14 +254,6 @@ typedef struct _GDIDEVICE struct _EDD_DIRECTDRAW_GLOBAL * pEDDgpl; } GDIDEVICE, *PGDIDEVICE; -/* For Metafile and MetaEnhFile not in windows this struct taken from wine cvs 15/9-2006*/ -typedef struct -{ - LPENHMETAHEADER emh; - BOOL on_disk; /* true if metafile is on disk */ -} DD_ENHMETAFILEOBJ, *PDD_ENHMETAFILEOBJ; - - /* Internal functions *********************************************************/ #define DC_LockDc(hDC) \ @@ -313,6 +305,6 @@ VOID FASTCALL IntGdiUnreferencePdev(PGDIDEVICE pPDev, DWORD CleanUpType); HDC FASTCALL IntGdiCreateDisplayDC(HDEV hDev, ULONG DcType, BOOL EmptyDC); BOOL FASTCALL IntGdiCleanDC(HDC hDC); -extern GDIDEVICE PrimarySurface; +extern PGDIDEVICE pPrimarySurface; #endif /* not __WIN32K_DC_H */ diff --git a/reactos/subsystems/win32/win32k/include/palette.h b/reactos/subsystems/win32/win32k/include/palette.h index de249fd04ec..21be008d778 100644 --- a/reactos/subsystems/win32/win32k/include/palette.h +++ b/reactos/subsystems/win32/win32k/include/palette.h @@ -82,5 +82,7 @@ INT FASTCALL PALETTE_ToPhysical (PDC dc, COLORREF color); INT FASTCALL PALETTE_GetObject(PPALGDI pGdiObject, INT cbCount, LPLOGBRUSH lpBuffer); PPALETTEENTRY FASTCALL ReturnSystemPalette (VOID); +HPALETTE FASTCALL GdiSelectPalette(HDC, HPALETTE, BOOL); + #endif /* not _WIN32K_PALETTE_H */ diff --git a/reactos/subsystems/win32/win32k/objects/bitblt.c b/reactos/subsystems/win32/win32k/objects/bitblt.c index ed91a42dac7..6e492f77ef4 100644 --- a/reactos/subsystems/win32/win32k/objects/bitblt.c +++ b/reactos/subsystems/win32/win32k/objects/bitblt.c @@ -410,10 +410,10 @@ NtGdiTransparentBlt( } DestPalette = BitmapDest->hDIBPalette; - if (!DestPalette) DestPalette = PrimarySurface.DevInfo.hpalDefault; + if (!DestPalette) DestPalette = pPrimarySurface->DevInfo.hpalDefault; SourcePalette = BitmapSrc->hDIBPalette; - if (!SourcePalette) SourcePalette = PrimarySurface.DevInfo.hpalDefault; + if (!SourcePalette) SourcePalette = pPrimarySurface->DevInfo.hpalDefault; if(!(PalSourceGDI = PALETTE_LockPalette(SourcePalette))) { diff --git a/reactos/subsystems/win32/win32k/objects/bitmaps.c b/reactos/subsystems/win32/win32k/objects/bitmaps.c index 3f43ac2688f..e826c068874 100644 --- a/reactos/subsystems/win32/win32k/objects/bitmaps.c +++ b/reactos/subsystems/win32/win32k/objects/bitmaps.c @@ -266,7 +266,7 @@ NtGdiGetPixel(HDC hDC, INT XPos, INT YPos) if ( BitmapObject ) { Pal = BitmapObject->hDIBPalette; - if (!Pal) Pal = PrimarySurface.DevInfo.hpalDefault; + if (!Pal) Pal = pPrimarySurface->DevInfo.hpalDefault; /* FIXME: Verify if it shouldn't be PAL_BGR! */ XlateObj = (XLATEOBJ*)IntEngCreateXlate ( PAL_RGB, 0, NULL, Pal ); diff --git a/reactos/subsystems/win32/win32k/objects/brush.c b/reactos/subsystems/win32/win32k/objects/brush.c index 0b786088c68..123f5eb58e3 100644 --- a/reactos/subsystems/win32/win32k/objects/brush.c +++ b/reactos/subsystems/win32/win32k/objects/brush.c @@ -128,7 +128,7 @@ IntGdiCreateBrushXlate(PDC Dc, GDIBRUSHOBJ *BrushObj, BOOLEAN *Failed) hPalette = pSurface->hDIBPalette; BITMAPOBJ_UnlockBitmap(pSurface); } - if (!hPalette) hPalette = PrimarySurface.DevInfo.hpalDefault; + if (!hPalette) hPalette = pPrimarySurface->DevInfo.hpalDefault; if (BrushObj->flAttrs & GDIBRUSH_IS_NULL) { diff --git a/reactos/subsystems/win32/win32k/objects/dc.c b/reactos/subsystems/win32/win32k/objects/dc.c index a5bc6ac0e9d..2698e710f42 100644 --- a/reactos/subsystems/win32/win32k/objects/dc.c +++ b/reactos/subsystems/win32/win32k/objects/dc.c @@ -29,8 +29,8 @@ // --------------------------------------------------------- File Statics -GDIDEVICE PrimarySurface; -static PGDIDEVICE pPrimarySurface = NULL; +static GDIDEVICE PrimarySurface; +PGDIDEVICE pPrimarySurface = &PrimarySurface; static KEVENT VideoDriverNeedsPreparation; static KEVENT VideoDriverPrepared; static PDC defaultDCstate = NULL; @@ -347,7 +347,7 @@ IntPrepareDriver() RtlZeroMemory(&PrimarySurface, sizeof(PrimarySurface)); - if (!pPrimarySurface) pPrimarySurface = ExAllocatePoolWithTag(PagedPool, sizeof(GDIDEVICE), TAG_GDIPDEV); +// if (!pPrimarySurface) pPrimarySurface = ExAllocatePoolWithTag(PagedPool, sizeof(GDIDEVICE), TAG_GDIPDEV); PrimarySurface.VideoFileObject = DRIVER_FindMPDriver(DisplayNumber); @@ -3394,7 +3394,7 @@ NtGdiGetDhpdev( PGDIDEVICE pPDev, pGdiDevice = (PGDIDEVICE) hdev; if (!pGdiDevice) return NULL; if ( pGdiDevice < (PGDIDEVICE)MmSystemRangeStart) return NULL; - pPDev = &PrimarySurface; + pPDev = pPrimarySurface; IntGdiAcquireSemaphore(hsemDriverMgmt); do { diff --git a/reactos/subsystems/win32/win32k/objects/fillshap.c b/reactos/subsystems/win32/win32k/objects/fillshap.c index d35964a4ff1..50e5a296d57 100644 --- a/reactos/subsystems/win32/win32k/objects/fillshap.c +++ b/reactos/subsystems/win32/win32k/objects/fillshap.c @@ -1552,7 +1552,7 @@ IntGdiGradientFill( ASSERT(BitmapObj); hDestPalette = BitmapObj->hDIBPalette; - if (!hDestPalette) hDestPalette = PrimarySurface.DevInfo.hpalDefault; + if (!hDestPalette) hDestPalette = pPrimarySurface->DevInfo.hpalDefault; PalDestGDI = PALETTE_LockPalette(hDestPalette); if (PalDestGDI) diff --git a/reactos/subsystems/win32/win32k/objects/text.c b/reactos/subsystems/win32/win32k/objects/text.c index 5b208b23bbd..69977787c89 100644 --- a/reactos/subsystems/win32/win32k/objects/text.c +++ b/reactos/subsystems/win32/win32k/objects/text.c @@ -1631,7 +1631,7 @@ NtGdiExtTextOutW( /* Create the brushes */ hDestPalette = BitmapObj->hDIBPalette; - if (!hDestPalette) hDestPalette = PrimarySurface.DevInfo.hpalDefault; + if (!hDestPalette) hDestPalette = pPrimarySurface->DevInfo.hpalDefault; PalDestGDI = PALETTE_LockPalette(hDestPalette); if ( !PalDestGDI ) Mode = PAL_RGB;