mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 21:05:43 +00:00
- NtGdiSetDIBitsToDeviceInternal: use bitmap's palette if it exists instead of always using system palette. Based on a patch by Evgeniy Boltik from bug 4326.
See issue #4326 for more details. svn path=/trunk/; revision=40331
This commit is contained in:
parent
ba802c2e4a
commit
b9451c3494
1 changed files with 13 additions and 8 deletions
|
@ -437,6 +437,7 @@ NtGdiSetDIBitsToDeviceInternal(
|
||||||
PDC pDC;
|
PDC pDC;
|
||||||
HBITMAP hSourceBitmap = NULL;
|
HBITMAP hSourceBitmap = NULL;
|
||||||
SURFOBJ *pDestSurf, *pSourceSurf = NULL;
|
SURFOBJ *pDestSurf, *pSourceSurf = NULL;
|
||||||
|
SURFACE *pSurf;
|
||||||
RECTL rcDest;
|
RECTL rcDest;
|
||||||
POINTL ptSource;
|
POINTL ptSource;
|
||||||
INT DIBWidth;
|
INT DIBWidth;
|
||||||
|
@ -476,14 +477,19 @@ NtGdiSetDIBitsToDeviceInternal(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pDestSurf = EngLockSurface((HSURF)pDC->rosdc.hBitmap);
|
/* Use destination palette obtained from the DC by default */
|
||||||
if (!pDestSurf)
|
DDBPalette = pDC->ppdev->DevInfo.hpalDefault;
|
||||||
|
|
||||||
|
/* Try to use hDIBPalette if it exists */
|
||||||
|
pSurf = SURFACE_LockSurface(pDC->rosdc.hBitmap);
|
||||||
|
if (pSurf && pSurf->hDIBPalette)
|
||||||
{
|
{
|
||||||
/* FIXME: SetLastError ? */
|
DDBPalette = pSurf->hDIBPalette;
|
||||||
DC_UnlockDc(pDC);
|
SURFACE_UnlockSurface(pSurf);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pDestSurf = EngLockSurface((HSURF)pDC->rosdc.hBitmap);
|
||||||
|
|
||||||
rcDest.left = XDest;
|
rcDest.left = XDest;
|
||||||
rcDest.top = YDest;
|
rcDest.top = YDest;
|
||||||
if (bTransformCoordinates)
|
if (bTransformCoordinates)
|
||||||
|
@ -521,8 +527,8 @@ NtGdiSetDIBitsToDeviceInternal(
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Obtain destination palette from the DC */
|
/* Obtain destination palette */
|
||||||
pDCPalette = PALETTE_LockPalette(pDC->ppdev->DevInfo.hpalDefault);
|
pDCPalette = PALETTE_LockPalette(DDBPalette);
|
||||||
if (!pDCPalette)
|
if (!pDCPalette)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
|
@ -531,7 +537,6 @@ NtGdiSetDIBitsToDeviceInternal(
|
||||||
}
|
}
|
||||||
|
|
||||||
DDBPaletteType = pDCPalette->Mode;
|
DDBPaletteType = pDCPalette->Mode;
|
||||||
DDBPalette = pDC->ppdev->DevInfo.hpalDefault;
|
|
||||||
PALETTE_UnlockPalette(pDCPalette);
|
PALETTE_UnlockPalette(pDCPalette);
|
||||||
|
|
||||||
DIBPalette = BuildDIBPalette(bmi, (PINT)&DIBPaletteType);
|
DIBPalette = BuildDIBPalette(bmi, (PINT)&DIBPaletteType);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue