EXLATEOBJ exlo;
PPALETTE ppalDIB = 0;
ULONG cjSizeImage;
- BOOL bCompressed;
if (!bmi || !Bits) return 0;
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
{
}
/* 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,
bmi->bmiHeader.biCompression),
bmi->bmiHeader.biHeight < 0 ? BMF_TOPDOWN : 0,
cjSizeImage,
- bCompressed ? (PVOID)Bits : NULL,
+ (PVOID)Bits,
0);
if (!SourceBitmap)
{
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)
ptSrc.x = 0;
ptSrc.y = 0;
+ NT_ASSERT(psurfSrc->SurfObj.cjBits <= cjMaxBits);
+
result = IntEngCopyBits(&psurfDst->SurfObj,
&psurfSrc->SurfObj,
NULL,