Author: tkreuzer Date: Sat Jun 5 23:19:41 2010 New Revision: 47603
URL: http://svn.reactos.org/svn/reactos?rev=47603&view=rev Log: [WIN32K] Make the SURFACE structure a bit more like the half documented windows version.
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/alphablend.c branches/reactos-yarotows/subsystems/win32/win32k/eng/bitblt.c branches/reactos-yarotows/subsystems/win32/win32k/eng/copybits.c branches/reactos-yarotows/subsystems/win32/win32k/eng/engmisc.c branches/reactos-yarotows/subsystems/win32/win32k/eng/gradient.c branches/reactos-yarotows/subsystems/win32/win32k/eng/lineto.c branches/reactos-yarotows/subsystems/win32/win32k/eng/paint.c branches/reactos-yarotows/subsystems/win32/win32k/eng/stretchblt.c branches/reactos-yarotows/subsystems/win32/win32k/eng/surface.c branches/reactos-yarotows/subsystems/win32/win32k/eng/transblt.c branches/reactos-yarotows/subsystems/win32/win32k/include/surface.h branches/reactos-yarotows/subsystems/win32/win32k/objects/bitmaps.c branches/reactos-yarotows/subsystems/win32/win32k/objects/dcobjs.c branches/reactos-yarotows/subsystems/win32/win32k/objects/dcutil.c branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/alphablend.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/eng/alphablend.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/eng/alphablend.c [iso-8859-1] Sat Jun 5 23:19:41 2010 @@ -301,7 +301,7 @@ }
/* Call the driver's DrvAlphaBlend if available */ - if (psurfDest->flHooks & HOOK_ALPHABLEND) + if (psurfDest->flags & HOOK_ALPHABLEND) { ret = GDIDEVFUNCS(psoDest).AlphaBlend( psoDest, psoSource, ClipRegion, ColorTranslation,
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/bitblt.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/eng/bitblt.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/eng/bitblt.c [iso-8859-1] Sat Jun 5 23:19:41 2010 @@ -585,10 +585,10 @@ }
/* Is the target surface device managed? */ - if (psurfTrg->flHooks & HOOK_BITBLT) + if (psurfTrg->flags & HOOK_BITBLT) { /* Is the source a different device managed surface? */ - if (psoSrc && psoSrc->hdev != psoTrg->hdev && psurfSrc->flHooks & HOOK_BITBLT) + if (psoSrc && psoSrc->hdev != psoTrg->hdev && psurfSrc->flags & HOOK_BITBLT) { DPRINT1("Need to copy to standard bitmap format!\n"); ASSERT(FALSE); @@ -598,7 +598,7 @@ }
/* Is the source surface device managed? */ - else if (psoSrc && psurfSrc->flHooks & HOOK_BITBLT) + else if (psoSrc && psurfSrc->flags & HOOK_BITBLT) { pfnBitBlt = GDIDEVFUNCS(psoSrc).BitBlt; }
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/copybits.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/eng/copybits.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/eng/copybits.c [iso-8859-1] Sat Jun 5 23:19:41 2010 @@ -67,7 +67,7 @@ if (psoDest->iType!=STYPE_BITMAP) { /* FIXME: Eng* functions shouldn't call Drv* functions. ? */ - if (psurfDest->flHooks & HOOK_COPYBITS) + if (psurfDest->flags & HOOK_COPYBITS) { ret = GDIDEVFUNCS(psoDest).CopyBits( psoDest, psoSource, Clip, ColorTranslation, DestRect, SourcePoint); @@ -80,7 +80,7 @@ if (psoSource->iType!=STYPE_BITMAP) { /* FIXME: Eng* functions shouldn't call Drv* functions. ? */ - if (psurfSource->flHooks & HOOK_COPYBITS) + if (psurfSource->flags & HOOK_COPYBITS) { ret = GDIDEVFUNCS(psoSource).CopyBits( psoDest, psoSource, Clip, ColorTranslation, DestRect, SourcePoint);
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/engmisc.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/eng/engmisc.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/eng/engmisc.c [iso-8859-1] Sat Jun 5 23:19:41 2010 @@ -56,7 +56,7 @@ { /* Driver needs to support DrvCopyBits, else we can't do anything */ SURFACE *psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj); - if (!(psurfDest->flHooks & HOOK_COPYBITS)) + if (!(psurfDest->flags & HOOK_COPYBITS)) { return FALSE; } @@ -149,7 +149,7 @@ if (NULL != *ppsoOutput) { SURFACE* psurfOutput = CONTAINING_RECORD(*ppsoOutput, SURFACE, SurfObj); - if (0 != (psurfOutput->flHooks & HOOK_SYNCHRONIZE)) + if (0 != (psurfOutput->flags & HOOK_SYNCHRONIZE)) { if (NULL != GDIDEVFUNCS(*ppsoOutput).SynchronizeSurface) {
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/gradient.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/eng/gradient.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/eng/gradient.c [iso-8859-1] Sat Jun 5 23:19:41 2010 @@ -548,7 +548,7 @@ psurf = CONTAINING_RECORD(psoDest, SURFACE, SurfObj); ASSERT(psurf);
- if(psurf->flHooks & HOOK_GRADIENTFILL) + if(psurf->flags & HOOK_GRADIENTFILL) { Ret = GDIDEVFUNCS(psoDest).GradientFill( psoDest, pco, pxlo, pVertex, nVertex, pMesh, nMesh,
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/lineto.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/eng/lineto.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/eng/lineto.c [iso-8859-1] Sat Jun 5 23:19:41 2010 @@ -565,7 +565,7 @@ if (b.left == b.right) b.right++; if (b.top == b.bottom) b.bottom++;
- if (psurfDest->flHooks & HOOK_LINETO) + if (psurfDest->flags & HOOK_LINETO) { /* Call the driver's DrvLineTo */ ret = GDIDEVFUNCS(psoDest).LineTo( @@ -573,7 +573,7 @@ }
#if 0 - if (! ret && (psurfDest->flHooks & HOOK_STROKEPATH)) + if (! ret && (psurfDest->flags & HOOK_STROKEPATH)) { /* FIXME: Emulate LineTo using drivers DrvStrokePath and set ret on success */ }
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/paint.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/eng/paint.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/eng/paint.c [iso-8859-1] Sat Jun 5 23:19:41 2010 @@ -124,7 +124,7 @@
DPRINT("pso->iType == %d\n", pso->iType); /* Is the surface's Paint function hooked? */ - if((pso->iType!=STYPE_BITMAP) && (psurf->flHooks & HOOK_PAINT)) + if((pso->iType!=STYPE_BITMAP) && (psurf->flags & HOOK_PAINT)) { // Call the driver's DrvPaint ret = GDIDEVFUNCS(pso).Paint(
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/stretchblt.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/eng/stretchblt.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/eng/stretchblt.c [iso-8859-1] Sat Jun 5 23:19:41 2010 @@ -471,7 +471,7 @@ /* Prepare color adjustment */
/* Call the driver's DrvStretchBlt if available */ - if (psurfDest->flHooks & HOOK_STRETCHBLTROP) + if (psurfDest->flags & HOOK_STRETCHBLTROP) { /* Drv->StretchBltROP (look at http://www.osronline.com/ddkx/graphics/ddifncs_0z3b.htm ) */ ret = GDIDEVFUNCS(psoDest).StretchBltROP(psoDest,
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/surface.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/eng/surface.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/eng/surface.c [iso-8859-1] Sat Jun 5 23:19:41 2010 @@ -98,7 +98,7 @@
/* If this is an API bitmap, free the bits */ if (pvBits != NULL && - (psurf->flFlags & BITMAPOBJ_IS_APIBITMAP)) + (psurf->flags & API_BITMAP)) { /* Check if we have a DIB section */ if (psurf->hSecure) @@ -395,10 +395,9 @@ pso->fjBitmap = Flags & (BMF_TOPDOWN | BMF_NOZEROINIT); pso->iUniq = 0;
- psurf->flHooks = 0; - psurf->flFlags = 0; - psurf->dimension.cx = 0; - psurf->dimension.cy = 0; + psurf->flags = 0; + psurf->sizlDim.cx = 0; + psurf->sizlDim.cy = 0;
psurf->hSecure = NULL; psurf->hDIBSection = NULL; @@ -547,12 +546,11 @@ pso->dhsurf = 0; pso->dhpdev = NULL; pso->hdev = NULL; - psurf->flFlags = 0; - psurf->dimension.cx = 0; - psurf->dimension.cy = 0; + psurf->flags = 0; + psurf->sizlDim.cx = 0; + psurf->sizlDim.cy = 0; psurf->hSecure = NULL; psurf->hDIBSection = NULL; - psurf->flHooks = 0;
/* Set bits */ pso->pvBits = Bits; @@ -695,7 +693,7 @@ pso->iType = STYPE_DEVICE; pso->iUniq = 0;
- psurf->flHooks = 0; + psurf->flags = 0;
SURFACE_UnlockSurface(psurf);
@@ -731,7 +729,8 @@ pso->dhpdev = ppdev->dhpdev;
/* Hook up specified functions */ - psurf->flHooks = flHooks; + psurf->flags &= ~HOOK_FLAGS; + psurf->flags |= (flHooks & HOOK_FLAGS);
/* Get palette */ psurf->ppal = PALETTE_ShareLockPalette(ppdev->devinfo.hpalDefault); @@ -776,7 +775,8 @@ pso->dhpdev = ppdev->dhpdev;
/* Hook up specified functions */ - psurf->flHooks = flHooks; + psurf->flags &= ~HOOK_FLAGS; + psurf->flags |= (flHooks & HOOK_FLAGS);
/* Get palette */ psurf->ppal = PALETTE_ShareLockPalette(ppdev->devinfo.hpalDefault);
Modified: branches/reactos-yarotows/subsystems/win32/win32k/eng/transblt.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/eng/transblt.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/eng/transblt.c [iso-8859-1] Sat Jun 5 23:19:41 2010 @@ -284,7 +284,7 @@ OutputRect = InputClippedRect; }
- if(psurfDest->flHooks & HOOK_TRANSPARENTBLT) + if(psurfDest->flags & HOOK_TRANSPARENTBLT) { Ret = GDIDEVFUNCS(psoDest).TransparentBlt( psoDest, psoSource, Clip, ColorTranslation, &OutputRect,
Modified: branches/reactos-yarotows/subsystems/win32/win32k/include/surface.h URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/include/surface.h [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/include/surface.h [iso-8859-1] Sat Jun 5 23:19:41 2010 @@ -8,41 +8,83 @@ /* GDI surface object */ typedef struct _SURFACE { - BASEOBJECT BaseObject; + BASEOBJECT BaseObject;
- SURFOBJ SurfObj; - FLONG flHooks; - FLONG flFlags; - struct _PALETTE *ppal; + SURFOBJ SurfObj; + //XDCOBJ * pdcoAA; + FLONG flags; + struct _PALETTE *ppal; + //UINT unk_050;
- union - { - HANDLE hSecureUMPD; // if UMPD_SURFACE set - HANDLE hMirrorParent;// if MIRROR_SURFACE set - HANDLE hDDSurface; // if DIRECTDRAW_SURFACE set - }; + union + { + HANDLE hSecureUMPD; // if UMPD_SURFACE set + HANDLE hMirrorParent;// if MIRROR_SURFACE set + HANDLE hDDSurface; // if DIRECTDRAW_SURFACE set + };
- SIZEL dimension; /* For SetBitmapDimension(), do NOT use + SIZEL sizlDim; /* For SetBitmapDimension(), do NOT use to get width/height of bitmap, use bitmap.bmWidth/bitmap.bmHeight for that */
- HDC hDC; // Doc in "Undocumented Windows", page 546, seems to be supported with XP. - ULONG cRef; // 0x064 - HPALETTE hpalHint; + HDC hdc; // Doc in "Undocumented Windows", page 546, seems to be supported with XP. + ULONG cRef; + HPALETTE hpalHint;
- /* For device-independent bitmaps: */ - HANDLE hDIBSection; - HANDLE hSecure; - DWORD dwOffset; + /* For device-independent bitmaps: */ + HANDLE hDIBSection; + HANDLE hSecure; + DWORD dwOffset; + //UINT unk_078;
/* reactos specific */ - DWORD dsBitfields[3]; // hack, should probably use palette instead - DWORD biClrUsed; - DWORD biClrImportant; + DWORD dsBitfields[3]; // hack, should probably use palette instead + DWORD biClrUsed; + DWORD biClrImportant; } SURFACE, *PSURFACE;
-#define BITMAPOBJ_IS_APIBITMAP 0x1 +// flags field: +//#define HOOK_BITBLT 0x00000001 +//#define HOOK_STRETCHBLT 0x00000002 +//#define HOOK_PLGBLT 0x00000004 +//#define HOOK_TEXTOUT 0x00000008 +//#define HOOK_PAINT 0x00000010 +//#define HOOK_STROKEPATH 0x00000020 +//#define HOOK_FILLPATH 0x00000040 +//#define HOOK_STROKEANDFILLPATH 0x00000080 +//#define HOOK_LINETO 0x00000100 +//#define SHAREACCESS_SURFACE 0x00000200 +//#define HOOK_COPYBITS 0x00000400 +//#define REDIRECTION_SURFACE 0x00000800 // ? +//#define HOOK_MOVEPANNING 0x00000800 +//#define HOOK_SYNCHRONIZE 0x00001000 +//#define HOOK_STRETCHBLTROP 0x00002000 +//#define HOOK_SYNCHRONIZEACCESS 0x00004000 +//#define USE_DEVLOCK_SURFACE 0x00004000 +//#define HOOK_TRANSPARENTBLT 0x00008000 +//#define HOOK_ALPHABLEND 0x00010000 +//#define HOOK_GRADIENTFILL 0x00020000 +//#if (NTDDI_VERSION < 0x06000000) +// #define HOOK_FLAGS 0x0003B5FF +//#else +// #define HOOK_FLAGS 0x0003B5EF +//#endif +#define UMPD_SURFACE 0x00040000 +#define MIRROR_SURFACE 0x00080000 +#define DIRECTDRAW_SURFACE 0x00100000 +#define DRIVER_CREATED_SURFACE 0x00200000 +#define ENG_CREATE_DEVICE_SURFACE 0x00400000 +#define DDB_SURFACE 0x00800000 +#define LAZY_DELETE_SURFACE 0x01000000 +#define BANDING_SURFACE 0x02000000 +#define API_BITMAP 0x04000000 +#define PALETTE_SELECT_SET 0x08000000 +#define UNREADABLE_SURFACE 0x10000000 +#define DYNAMIC_MODE_PALETTE 0x20000000 +#define ABORT_SURFACE 0x40000000 +#define PDEV_SURFACE 0x80000000 +
/* Internal interface */
Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/bitmaps.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/objects/bitmaps.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/objects/bitmaps.c [iso-8859-1] Sat Jun 5 23:19:41 2010 @@ -79,8 +79,8 @@ return NULL; }
- psurfBmp->flFlags = BITMAPOBJ_IS_APIBITMAP; - psurfBmp->hDC = NULL; // Fixme + psurfBmp->flags = API_BITMAP; + psurfBmp->hdc = NULL; // Fixme
if (NULL != pBits) { @@ -192,8 +192,8 @@ /* Set palette */ psurf->ppal = PALETTE_ShareLockPalette(Dc->ppdev->devinfo.hpalDefault); /* Set flags */ - psurf->flFlags = BITMAPOBJ_IS_APIBITMAP; - psurf->hDC = NULL; // Fixme + psurf->flags = API_BITMAP; + psurf->hdc = NULL; // Fixme SURFACE_UnlockSurface(psurf); } else @@ -222,8 +222,8 @@ psurfBmp->ppal = psurf->ppal; GDIOBJ_IncrementShareCount((POBJ)psurf->ppal); /* Set flags */ - psurfBmp->flFlags = BITMAPOBJ_IS_APIBITMAP; - psurfBmp->hDC = NULL; // Fixme + psurfBmp->flags = API_BITMAP; + psurfBmp->hdc = NULL; // Fixme SURFACE_UnlockSurface(psurfBmp); } else @@ -362,7 +362,7 @@ _SEH2_TRY { ProbeForWrite(Dimension, sizeof(SIZE), 1); - *Dimension = psurfBmp->dimension; + *Dimension = psurfBmp->sizlDim; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -689,7 +689,7 @@ _SEH2_TRY { ProbeForWrite(Size, sizeof(SIZE), 1); - *Size = psurf->dimension; + *Size = psurf->sizlDim; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -699,8 +699,8 @@ }
/* The dimension is changed even if writing the old value failed */ - psurf->dimension.cx = Width; - psurf->dimension.cy = Height; + psurf->sizlDim.cx = Width; + psurf->sizlDim.cy = Height;
SURFACE_UnlockSurface(psurf);
@@ -924,7 +924,7 @@ IntGetBitmapBits(Bitmap, bm.bmWidthBytes * abs(bm.bmHeight), buf); IntSetBitmapBits(resBitmap, bm.bmWidthBytes * abs(bm.bmHeight), buf); ExFreePoolWithTag(buf,TAG_BITMAP); - resBitmap->flFlags = Bitmap->flFlags; + resBitmap->flags = Bitmap->flags; /* Copy palette */ if (Bitmap->ppal) { @@ -1033,14 +1033,14 @@ NtGdiGetDCforBitmap( IN HBITMAP hsurf) { - HDC hDC = NULL; + HDC hdc = NULL; PSURFACE psurf = SURFACE_LockSurface(hsurf); if (psurf) { - hDC = psurf->hDC; + hdc = psurf->hdc; SURFACE_UnlockSurface(psurf); } - return hDC; + return hdc; }
/* EOF */
Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/dcobjs.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/objects/dcobjs.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/objects/dcobjs.c [iso-8859-1] Sat Jun 5 23:19:41 2010 @@ -291,7 +291,7 @@ DC_vSelectSurface(pDC, psurfBmp);
// If Info DC this is zero and pSurface is moved to DC->pSurfInfo. - psurfBmp->hDC = hDC; + psurfBmp->hdc = hDC;
/* FIXME; improve by using a region without a handle and selecting it */ hVisRgn = IntSysCreateRectRgn( 0,
Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/dcutil.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/objects/dcutil.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/objects/dcutil.c [iso-8859-1] Sat Jun 5 23:19:41 2010 @@ -145,7 +145,7 @@ if (pdc->ppdev->flFlags & PDEV_META_DEVICE) { pSurface = pdc->dclevel.pSurface; - if (pSurface && pSurface->flFlags & PDEV_SURFACE) + if (pSurface && pSurface->flags & PDEV_SURFACE) { rclClip.left += pdc->ppdev->ptlOrigion.x; rclClip.top += pdc->ppdev->ptlOrigion.y;
Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win3... ============================================================================== --- branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] (original) +++ branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] Sat Jun 5 23:19:41 2010 @@ -1535,7 +1535,7 @@ bmp->hDIBSection = section; bmp->hSecure = hSecure; bmp->dwOffset = offset; - bmp->flFlags = BITMAPOBJ_IS_APIBITMAP; + bmp->flags = API_BITMAP; bmp->dsBitfields[0] = dsBitfields[0]; bmp->dsBitfields[1] = dsBitfields[1]; bmp->dsBitfields[2] = dsBitfields[2];