mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-03 12:23:25 +00:00
[WIN32K]
Fix the fix from r70482: Our DIBs are actually 32 bit aligned, so pass even uncompressed bits to GreCreateBitmapEx instead of copying them later with wrong alignment. svn path=/trunk/; revision=70486
This commit is contained in:
@@ -260,7 +260,6 @@ IntSetDIBits(
|
||||
EXLATEOBJ exlo;
|
||||
PPALETTE ppalDIB = 0;
|
||||
ULONG cjSizeImage;
|
||||
BOOL bCompressed;
|
||||
|
||||
if (!bmi || !Bits) return 0;
|
||||
|
||||
@@ -272,14 +271,12 @@ IntSetDIBits(
|
||||
cjSizeImage = DIB_GetDIBImageBytes(bmi->bmiHeader.biWidth,
|
||||
ScanLines,
|
||||
bmi->bmiHeader.biBitCount);
|
||||
bCompressed = FALSE;
|
||||
}
|
||||
/* Check if the header provided an image size */
|
||||
else if (bmi->bmiHeader.biSizeImage != 0)
|
||||
{
|
||||
/* Use the given size */
|
||||
cjSizeImage = bmi->bmiHeader.biSizeImage;
|
||||
bCompressed = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -289,15 +286,13 @@ IntSetDIBits(
|
||||
}
|
||||
|
||||
/* Check if the size that we have is ok */
|
||||
if (cjSizeImage > cjMaxBits)
|
||||
if ((cjSizeImage > cjMaxBits) || (cjSizeImage == 0))
|
||||
{
|
||||
DPRINT1("Size too large! cjSizeImage = %lu, cjMaxBits = %lu\n",
|
||||
DPRINT1("Invalid bitmap size! cjSizeImage = %lu, cjMaxBits = %lu\n",
|
||||
cjSizeImage, cjMaxBits);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* We cannot use the provided buffer for uncompressed bits, since they
|
||||
might not be aligned correctly! */
|
||||
SourceBitmap = GreCreateBitmapEx(bmi->bmiHeader.biWidth,
|
||||
ScanLines,
|
||||
0,
|
||||
@@ -305,7 +300,7 @@ IntSetDIBits(
|
||||
bmi->bmiHeader.biCompression),
|
||||
bmi->bmiHeader.biHeight < 0 ? BMF_TOPDOWN : 0,
|
||||
cjSizeImage,
|
||||
bCompressed ? (PVOID)Bits : NULL,
|
||||
(PVOID)Bits,
|
||||
0);
|
||||
if (!SourceBitmap)
|
||||
{
|
||||
@@ -323,17 +318,6 @@ IntSetDIBits(
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Check for uncompressed bits */
|
||||
if (!bCompressed)
|
||||
{
|
||||
/* Copy the bitmap bits */
|
||||
if (!UnsafeSetBitmapBits(psurfSrc, cjMaxBits, Bits))
|
||||
{
|
||||
DPRINT1("Error: Could not set bitmap bits\n");
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
/* Create a palette for the DIB */
|
||||
ppalDIB = CreateDIBPalette(bmi, DC, ColorUse);
|
||||
if (!ppalDIB)
|
||||
@@ -357,6 +341,8 @@ IntSetDIBits(
|
||||
ptSrc.x = 0;
|
||||
ptSrc.y = 0;
|
||||
|
||||
NT_ASSERT(psurfSrc->SurfObj.cjBits <= cjMaxBits);
|
||||
|
||||
result = IntEngCopyBits(&psurfDst->SurfObj,
|
||||
&psurfSrc->SurfObj,
|
||||
NULL,
|
||||
|
||||
Reference in New Issue
Block a user