Author: tkreuzer
Date: Mon Jan 26 22:11:34 2015
New Revision: 66094
URL:
http://svn.reactos.org/svn/reactos?rev=66094&view=rev
Log:
[WIN32K]
Fix major bug in EngModifySurface: when pvScan0 and lDelta are passed, the surface is
converted to type STYPE_BITMAP. pvBits is calculated accordingly and surface flags are
updated according to flSurface parameter. Fixes crash with Intel 810 graphic drivers.
Thanks to Julio Carchi for testing/helping with debugging. CORE-7821 #resolve
Modified:
trunk/reactos/win32ss/gdi/eng/surface.c
trunk/reactos/win32ss/gdi/eng/surface.h
Modified: trunk/reactos/win32ss/gdi/eng/surface.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/surface.c?…
==============================================================================
--- trunk/reactos/win32ss/gdi/eng/surface.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/eng/surface.c [iso-8859-1] Mon Jan 26 22:11:34 2015
@@ -452,8 +452,6 @@
ppdev = (PDEVOBJ*)hdev;
pso = &psurf->SurfObj;
pso->dhsurf = dhsurf;
- pso->lDelta = lDelta;
- pso->pvScan0 = pvScan0;
/* Associate the hdev */
pso->hdev = hdev;
@@ -467,6 +465,54 @@
ppal = PALETTE_ShareLockPalette(ppdev->devinfo.hpalDefault);
SURFACE_vSetPalette(psurf, ppal);
PALETTE_ShareUnlockPalette(ppal);
+
+ /* Check if the caller passed bitmap bits */
+ if ((pvScan0 != NULL) && (lDelta != 0))
+ {
+ /* Update the fields */
+ pso->pvScan0 = pvScan0;
+ pso->lDelta = lDelta;
+
+ /* This is a bitmap now! */
+ pso->iType = STYPE_BITMAP;
+
+ /* Check memory layout */
+ if (lDelta > 0)
+ {
+ /* Topdown is the normal way */
+ pso->cjBits = lDelta * pso->sizlBitmap.cy;
+ pso->pvBits = pso->pvScan0;
+ pso->fjBitmap |= BMF_TOPDOWN;
+ }
+ else
+ {
+ /* Inversed bitmap (bottom up) */
+ pso->cjBits = (-lDelta) * pso->sizlBitmap.cy;
+ pso->pvBits = (PCHAR)pso->pvScan0 - pso->cjBits - lDelta;
+ pso->fjBitmap &= ~BMF_TOPDOWN;
+ }
+
+ /* Update surface flags */
+ if (flSurface & MS_NOTSYSTEMMEMORY)
+ pso->fjBitmap |= BMF_NOTSYSMEM;
+ else
+ pso->fjBitmap &= ~BMF_NOTSYSMEM;
+ if (flSurface & MS_SHAREDACCESS)
+ psurf->flags |= SHAREACCESS_SURFACE;
+ else
+ psurf->flags &= ~SHAREACCESS_SURFACE;
+ }
+ else
+ {
+ /* Set bits to NULL */
+ pso->pvBits = NULL;
+ pso->pvScan0 = NULL;
+ pso->lDelta = 0;
+
+ /* Set appropriate surface type */
+ if (pso->iType != STYPE_DEVICE)
+ pso->iType = STYPE_DEVBITMAP;
+ }
SURFACE_ShareUnlockSurface(psurf);
Modified: trunk/reactos/win32ss/gdi/eng/surface.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/surface.h?…
==============================================================================
--- trunk/reactos/win32ss/gdi/eng/surface.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/eng/surface.h [iso-8859-1] Mon Jan 26 22:11:34 2015
@@ -49,7 +49,7 @@
//#define HOOK_FILLPATH 0x00000040
//#define HOOK_STROKEANDFILLPATH 0x00000080
//#define HOOK_LINETO 0x00000100
-//#define SHAREACCESS_SURFACE 0x00000200
+ SHAREACCESS_SURFACE = 0x00000200,
//#define HOOK_COPYBITS 0x00000400
//#define REDIRECTION_SURFACE 0x00000800 // ?
//#define HOOK_MOVEPANNING 0x00000800
@@ -82,7 +82,6 @@
};
#define BMF_POOLALLOC 0x100
-#define PDEV_SURFACE 0x80000000
/* Internal interface */