[WIN32K]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 5 Jun 2010 21:19:41 +0000 (21:19 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 5 Jun 2010 21:19:41 +0000 (21:19 +0000)
Make the SURFACE structure a bit more like the half documented windows version.

svn path=/branches/reactos-yarotows/; revision=47603

15 files changed:
subsystems/win32/win32k/eng/alphablend.c
subsystems/win32/win32k/eng/bitblt.c
subsystems/win32/win32k/eng/copybits.c
subsystems/win32/win32k/eng/engmisc.c
subsystems/win32/win32k/eng/gradient.c
subsystems/win32/win32k/eng/lineto.c
subsystems/win32/win32k/eng/paint.c
subsystems/win32/win32k/eng/stretchblt.c
subsystems/win32/win32k/eng/surface.c
subsystems/win32/win32k/eng/transblt.c
subsystems/win32/win32k/include/surface.h
subsystems/win32/win32k/objects/bitmaps.c
subsystems/win32/win32k/objects/dcobjs.c
subsystems/win32/win32k/objects/dcutil.c
subsystems/win32/win32k/objects/dibobj.c

index 9a6c076..0841e56 100644 (file)
@@ -301,7 +301,7 @@ IntEngAlphaBlend(IN SURFOBJ *psoDest,
     }
 
     /* 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,
index aeb3a19..92e9095 100644 (file)
@@ -585,10 +585,10 @@ IntEngBitBlt(
     }
 
     /* 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 @@ IntEngBitBlt(
     }
 
     /* Is the source surface device managed? */
-    else if (psoSrc && psurfSrc->flHooks & HOOK_BITBLT)
+    else if (psoSrc && psurfSrc->flags & HOOK_BITBLT)
     {
         pfnBitBlt = GDIDEVFUNCS(psoSrc).BitBlt;
     }
index 1f7206d..afb2f16 100644 (file)
@@ -67,7 +67,7 @@ EngCopyBits(SURFOBJ *psoDest,
         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 @@ EngCopyBits(SURFOBJ *psoDest,
         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);
index af544c9..d4c1713 100644 (file)
@@ -56,7 +56,7 @@ IntEngEnter(PINTENG_ENTER_LEAVE EnterLeave,
     {
     /* 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 @@ IntEngEnter(PINTENG_ENTER_LEAVE EnterLeave,
   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)
         {
index 6b002c7..75faeae 100644 (file)
@@ -548,7 +548,7 @@ IntEngGradientFill(
   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,
index 9aba0a0..d5db687 100644 (file)
@@ -565,7 +565,7 @@ IntEngLineTo(SURFOBJ *psoDest,
     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 @@ IntEngLineTo(SURFOBJ *psoDest,
     }
 
 #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 */
     }
index d832238..31fd500 100644 (file)
@@ -124,7 +124,7 @@ IntEngPaint(IN SURFOBJ *pso,
 
   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(
index b4f1d88..a6f3d4f 100644 (file)
@@ -471,7 +471,7 @@ IntEngStretchBlt(SURFOBJ *psoDest,
     /* 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,
index 8068cad..f981d15 100644 (file)
@@ -98,7 +98,7 @@ SURFACE_Cleanup(PVOID ObjectBody)
 
     /* 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 @@ IntCreateBitmap(IN SIZEL Size,
     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 @@ SURFMEM_bCreateDib(IN PDEVBITMAPINFO BitmapInfo,
     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 @@ EngCreateDeviceSurface(IN DHSURF dhsurf,
     pso->iType = STYPE_DEVICE;
     pso->iUniq = 0;
 
-    psurf->flHooks = 0;
+    psurf->flags = 0;
 
     SURFACE_UnlockSurface(psurf);
 
@@ -731,7 +729,8 @@ EngAssociateSurface(
     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 @@ EngModifySurface(
     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);
index a0e4daf..0bfc145 100644 (file)
@@ -284,7 +284,7 @@ IntEngTransparentBlt(SURFOBJ *psoDest,
     OutputRect = InputClippedRect;
   }
 
-  if(psurfDest->flHooks & HOOK_TRANSPARENTBLT)
+  if(psurfDest->flags & HOOK_TRANSPARENTBLT)
   {
     Ret = GDIDEVFUNCS(psoDest).TransparentBlt(
       psoDest, psoSource, Clip, ColorTranslation, &OutputRect,
index ab9381d..e78dd5c 100644 (file)
@@ -8,41 +8,83 @@
 /* GDI surface object */
 typedef struct _SURFACE
 {
-  BASEOBJECT  BaseObject;
-
-  SURFOBJ     SurfObj;
-  FLONG              flHooks;
-  FLONG       flFlags;
-  struct _PALETTE  *ppal;
-
-  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
+    BASEOBJECT  BaseObject;
+
+    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
+    };
+
+    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  */
 
index 662b0e0..ed708f4 100644 (file)
@@ -79,8 +79,8 @@ IntGdiCreateBitmap(
         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 @@ IntCreateCompatibleBitmap(
             /* 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 @@ IntCreateCompatibleBitmap(
                     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 @@ NtGdiGetBitmapDimension(
     _SEH2_TRY
     {
         ProbeForWrite(Dimension, sizeof(SIZE), 1);
-        *Dimension = psurfBmp->dimension;
+        *Dimension = psurfBmp->sizlDim;
     }
     _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
     {
@@ -689,7 +689,7 @@ NtGdiSetBitmapDimension(
         _SEH2_TRY
         {
             ProbeForWrite(Size, sizeof(SIZE), 1);
-            *Size = psurf->dimension;
+            *Size = psurf->sizlDim;
         }
         _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
         {
@@ -699,8 +699,8 @@ NtGdiSetBitmapDimension(
     }
 
     /* 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 @@ BITMAP_CopyBitmap(HBITMAP hBitmap)
             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 @@ APIENTRY
 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 */
index c686422..302503f 100644 (file)
@@ -291,7 +291,7 @@ NtGdiSelectBitmap(
     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,
index f856ea1..0471c7d 100644 (file)
@@ -145,7 +145,7 @@ IntSetDefaultRegion(PDC pdc)
     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;
index 50707fd..44366cf 100644 (file)
@@ -1535,7 +1535,7 @@ DIB_CreateDIBSection(
     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];