Author: tkreuzer
Date: Sun Jan 3 19:46:57 2016
New Revision: 70486
URL:
http://svn.reactos.org/svn/reactos?rev=70486&view=rev
Log:
[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.
Modified:
trunk/reactos/win32ss/gdi/ntgdi/dibobj.c
Modified: trunk/reactos/win32ss/gdi/ntgdi/dibobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dibobj.c…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/dibobj.c [iso-8859-1] Sun Jan 3 19:46:57 2016
@@ -260,7 +260,6 @@
EXLATEOBJ exlo;
PPALETTE ppalDIB = 0;
ULONG cjSizeImage;
- BOOL bCompressed;
if (!bmi || !Bits) return 0;
@@ -272,14 +271,12 @@
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 @@
}
/* Check if the size that we have is ok */
- if (cjSizeImage > cjMaxBits)
- {
- DPRINT1("Size too large! cjSizeImage = %lu, cjMaxBits = %lu\n",
+ if ((cjSizeImage > cjMaxBits) || (cjSizeImage == 0))
+ {
+ 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 @@
bmi->bmiHeader.biCompression),
bmi->bmiHeader.biHeight < 0 ? BMF_TOPDOWN :
0,
cjSizeImage,
- bCompressed ? (PVOID)Bits : NULL,
+ (PVOID)Bits,
0);
if (!SourceBitmap)
{
@@ -321,17 +316,6 @@
{
DPRINT1("Error: Could not lock surfaces\n");
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 */
@@ -356,6 +340,8 @@
rcDst.right = psurfDst->SurfObj.sizlBitmap.cx;
ptSrc.x = 0;
ptSrc.y = 0;
+
+ NT_ASSERT(psurfSrc->SurfObj.cjBits <= cjMaxBits);
result = IntEngCopyBits(&psurfDst->SurfObj,
&psurfSrc->SurfObj,