Author: jgardou
Date: Sat Oct 25 18:11:36 2014
New Revision: 64993
URL:
http://svn.reactos.org/svn/reactos?rev=64993&view=rev
Log:
[WIN32K]
- Use a palette created from the DIB infos for surface created through
CreateDIBitmap(CBM_CREATEDIB)
CORE-8695 #comment Booting in 16bpp mode is now OK, but some problems remain when
switching mode from 16bpp to 32bpp
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] Sat Oct 25 18:11:36 2014
@@ -1359,8 +1359,22 @@
{
if (init & CBM_CREATDIB)
{
+ PSURFACE Surface;
+ PPALETTE Palette;
+
/* Undocumented flag which creates a DDB of the format specified by the
bitmap info. */
handle = IntCreateCompatibleBitmap(Dc, width, height, planes, bpp);
+ if (!handle)
+ return NULL;
+ /* The palette must also match the given data */
+ Surface = SURFACE_ShareLockSurface(handle);
+ ASSERT(Surface);
+ Palette = CreateDIBPalette(data, Dc, coloruse);
+ ASSERT(Palette);
+ SURFACE_vSetPalette(Surface, Palette);
+
+ PALETTE_ShareUnlockPalette(Palette);
+ SURFACE_ShareUnlockSurface(Surface);
}
else
{
@@ -1382,45 +1396,6 @@
if ((NULL != handle) && (CBM_INIT & init))
{
- if (init & CBM_CREATDIB)
- {
- PSURFACE Surface;
- PPALETTE Palette;
- NTSTATUS Status = STATUS_SUCCESS;
-
- Surface = SURFACE_ShareLockSurface(handle);
- ASSERT(Surface);
-
- Palette = CreateDIBPalette(data, Dc, coloruse);
- ASSERT(Palette);
- SURFACE_vSetPalette(Surface, Palette);
- PALETTE_ShareUnlockPalette(Palette);
-
- if (Surface->SurfObj.pvBits)
- {
- _SEH2_TRY
- {
- RtlCopyMemory(Surface->SurfObj.pvBits, bits,
- abs(Surface->sizlDim.cy * Surface->SurfObj.lDelta));
- }
- _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
- {
- Status = _SEH2_GetExceptionCode();
- }
- _SEH2_END
- }
-
- SURFACE_ShareUnlockSurface(Surface);
-
- if (!NT_SUCCESS(Status))
- {
- SetLastNtError(Status);
- GreDeleteObject(handle);
- handle = NULL;
- }
- return handle;
- }
-
IntSetDIBits(Dc, handle, 0, height, bits, data, coloruse);
}
@@ -1544,13 +1519,13 @@
{
BITMAPCOREHEADER* CoreHeader = (BITMAPCOREHEADER*)&pbmi->bmiHeader;
bpp = CoreHeader->bcBitCount;
- planes = CoreHeader->bcPlanes;
+ planes = CoreHeader->bcPlanes ? CoreHeader->bcPlanes : 1;
compression = BI_RGB;
}
else
{
bpp = pbmi->bmiHeader.biBitCount;
- planes = pbmi->bmiHeader.biPlanes;
+ planes = pbmi->bmiHeader.biPlanes ? pbmi->bmiHeader.biPlanes : 1;
compression = pbmi->bmiHeader.biCompression;
}
}