Author: tkreuzer
Date: Mon Mar 7 09:53:03 2011
New Revision: 50988
URL:
http://svn.reactos.org/svn/reactos?rev=50988&view=rev
Log:
[WIN32K]
Fix the RLE hack (partly)
Modified:
trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c [iso-8859-1] Mon Mar 7
09:53:03 2011
@@ -82,8 +82,6 @@
PSURFACE psurf;
SURFOBJ *pso;
HBITMAP hbmp;
- PVOID pvCompressedBits;
- SIZEL sizl;
/* Verify format */
if (iFormat < BMF_1BPP || iFormat > BMF_PNG) return NULL;
@@ -103,22 +101,31 @@
/* The infamous RLE hack */
if (iFormat == BMF_4RLE || iFormat == BMF_8RLE)
{
+ PVOID pvCompressedBits;
+ SIZEL sizl;
+ LONG lDelta;
+
sizl.cx = nWidth;
sizl.cy = nHeight;
+ lDelta = WIDTH_BYTES_ALIGN32(nWidth, gajBitsPerFormat[iFormat]);
+
pvCompressedBits = pvBits;
- pvBits = EngAllocMem(FL_ZERO_MEMORY, pso->cjBits, TAG_DIB);
+ pvBits = EngAllocMem(FL_ZERO_MEMORY, lDelta * nHeight, TAG_DIB);
if (!pvBits)
{
EngSetLastError(ERROR_NOT_ENOUGH_MEMORY);
SURFACE_FreeSurfaceByHandle(hbmp);
return NULL;
}
- DecompressBitmap(sizl, pvCompressedBits, pvBits, pso->lDelta, iFormat);
+ DecompressBitmap(sizl, pvCompressedBits, pvBits, lDelta, iFormat);
fjBitmap |= BMF_RLE_HACK;
- }
-
- /* Mark as API bitmap */
- psurf->flags |= (flags | API_BITMAP);
+
+ iFormat = iFormat == BMF_4RLE ? BMF_4BPP : BMF_8BPP;
+ psurf->SurfObj.iBitmapFormat = iFormat;
+ }
+
+ /* Mark as API bitmap */
+ psurf->flags |= (flags | API_BITMAP);
/* Set the bitmap bits */
if (!SURFACE_bSetBitmapBits(psurf, fjBitmap, cjWidthBytes, pvBits))