mirror of
https://github.com/reactos/reactos.git
synced 2025-08-07 08:52:59 +00:00
[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 svn path=/trunk/; revision=66094
This commit is contained in:
parent
7c751fe5dc
commit
320306b310
2 changed files with 49 additions and 4 deletions
|
@ -452,8 +452,6 @@ EngModifySurface(
|
||||||
ppdev = (PDEVOBJ*)hdev;
|
ppdev = (PDEVOBJ*)hdev;
|
||||||
pso = &psurf->SurfObj;
|
pso = &psurf->SurfObj;
|
||||||
pso->dhsurf = dhsurf;
|
pso->dhsurf = dhsurf;
|
||||||
pso->lDelta = lDelta;
|
|
||||||
pso->pvScan0 = pvScan0;
|
|
||||||
|
|
||||||
/* Associate the hdev */
|
/* Associate the hdev */
|
||||||
pso->hdev = hdev;
|
pso->hdev = hdev;
|
||||||
|
@ -468,6 +466,54 @@ EngModifySurface(
|
||||||
SURFACE_vSetPalette(psurf, ppal);
|
SURFACE_vSetPalette(psurf, ppal);
|
||||||
PALETTE_ShareUnlockPalette(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);
|
SURFACE_ShareUnlockSurface(psurf);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -49,7 +49,7 @@ enum _SURFACEFLAGS
|
||||||
//#define HOOK_FILLPATH 0x00000040
|
//#define HOOK_FILLPATH 0x00000040
|
||||||
//#define HOOK_STROKEANDFILLPATH 0x00000080
|
//#define HOOK_STROKEANDFILLPATH 0x00000080
|
||||||
//#define HOOK_LINETO 0x00000100
|
//#define HOOK_LINETO 0x00000100
|
||||||
//#define SHAREACCESS_SURFACE 0x00000200
|
SHAREACCESS_SURFACE = 0x00000200,
|
||||||
//#define HOOK_COPYBITS 0x00000400
|
//#define HOOK_COPYBITS 0x00000400
|
||||||
//#define REDIRECTION_SURFACE 0x00000800 // ?
|
//#define REDIRECTION_SURFACE 0x00000800 // ?
|
||||||
//#define HOOK_MOVEPANNING 0x00000800
|
//#define HOOK_MOVEPANNING 0x00000800
|
||||||
|
@ -82,7 +82,6 @@ enum _SURFACEFLAGS
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BMF_POOLALLOC 0x100
|
#define BMF_POOLALLOC 0x100
|
||||||
#define PDEV_SURFACE 0x80000000
|
|
||||||
|
|
||||||
/* Internal interface */
|
/* Internal interface */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue