- In NtGdiGetDIBitsInternal use a shared lock for the bitmaps and provide background colors when initializing the XLATEOBJ. This fixes mono bitmaps passed to GetDIBits. (no it does not fix pink icons in VLC)
- In BuildDIBPalette don't handle 15bpp, its not valid. and 16 bpp is 555, this is documented in MSDN.

svn path=/trunk/; revision=50920
This commit is contained in:
Timo Kreuzer 2011-02-27 17:38:18 +00:00
parent eb7b3a6e70
commit 760940d0bd

View file

@ -649,7 +649,7 @@ NtGdiGetDIBitsInternal(
} }
/* Get a pointer to the source bitmap object */ /* Get a pointer to the source bitmap object */
psurf = SURFACE_LockSurface(hBitmap); psurf = SURFACE_ShareLockSurface(hBitmap);
if (psurf == NULL) if (psurf == NULL)
{ {
ScanLines = 0; ScanLines = 0;
@ -944,7 +944,7 @@ NtGdiGetDIBitsInternal(
goto done ; goto done ;
} }
psurfDest = SURFACE_LockSurface(hBmpDest); psurfDest = SURFACE_ShareLockSurface(hBmpDest);
rcDest.left = 0; rcDest.left = 0;
rcDest.top = 0; rcDest.top = 0;
@ -955,7 +955,7 @@ NtGdiGetDIBitsInternal(
srcPoint.y = height < 0 ? srcPoint.y = height < 0 ?
psurf->SurfObj.sizlBitmap.cy - (StartScan + ScanLines) : StartScan; psurf->SurfObj.sizlBitmap.cy - (StartScan + ScanLines) : StartScan;
EXLATEOBJ_vInitialize(&exlo, psurf->ppal, psurfDest->ppal, 0, 0, 0); EXLATEOBJ_vInitialize(&exlo, psurf->ppal, psurfDest->ppal, 0xffffff, 0xffffff, 0);
ret = IntEngCopyBits(&psurfDest->SurfObj, ret = IntEngCopyBits(&psurfDest->SurfObj,
&psurf->SurfObj, &psurf->SurfObj,
@ -964,6 +964,8 @@ NtGdiGetDIBitsInternal(
&rcDest, &rcDest,
&srcPoint); &srcPoint);
SURFACE_ShareUnlockSurface(psurfDest);
if(!ret) if(!ret)
ScanLines = 0; ScanLines = 0;
else else
@ -994,7 +996,7 @@ NtGdiGetDIBitsInternal(
done: done:
if(pDC) DC_UnlockDc(pDC); if(pDC) DC_UnlockDc(pDC);
if(psurf) SURFACE_UnlockSurface(psurf); if(psurf) SURFACE_ShareUnlockSurface(psurf);
if(pbmci) DIB_FreeConvertedBitmapInfo(Info, (BITMAPINFO*)pbmci); if(pbmci) DIB_FreeConvertedBitmapInfo(Info, (BITMAPINFO*)pbmci);
return ScanLines; return ScanLines;
@ -1101,14 +1103,14 @@ NtGdiStretchDIBitsInternal(
hBitmap = DIB_CreateDIBSection(pdc, BitsInfo, Usage, &pvBits, NULL, 0, 0); hBitmap = DIB_CreateDIBSection(pdc, BitsInfo, Usage, &pvBits, NULL, 0, 0);
DC_UnlockDc(pdc); DC_UnlockDc(pdc);
hdcMem = NtGdiCreateCompatibleDC(hDC);
if(!hBitmap) if(!hBitmap)
{ {
DPRINT1("Error, failed to create a DIB section\n"); DPRINT1("Error, failed to create a DIB section\n");
NtGdiDeleteObjectApp(hdcMem);
goto cleanup; goto cleanup;
} }
hdcMem = NtGdiCreateCompatibleDC(hDC);
RtlCopyMemory(pvBits, safeBits, cjMaxBits); RtlCopyMemory(pvBits, safeBits, cjMaxBits);
hOldBitmap = NtGdiSelectBitmap(hdcMem, hBitmap); hOldBitmap = NtGdiSelectBitmap(hdcMem, hBitmap);
@ -1771,20 +1773,13 @@ BuildDIBPalette(CONST BITMAPINFO *bmi)
paletteType = PAL_BITFIELDS; paletteType = PAL_BITFIELDS;
switch (bits) switch (bits)
{ {
case 15: case 16:
paletteType |= PAL_RGB16_555; paletteType |= PAL_RGB16_555;
RedMask = 0x7C00; RedMask = 0x7C00;
GreenMask = 0x03E0; GreenMask = 0x03E0;
BlueMask = 0x001F; BlueMask = 0x001F;
break; break;
case 16:
paletteType |= PAL_RGB16_565;
RedMask = 0xF800;
GreenMask = 0x07E0;
BlueMask = 0x001F;
break;
case 24: case 24:
case 32: case 32:
paletteType |= PAL_BGR; paletteType |= PAL_BGR;