mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:42:57 +00:00
- Update palette functions and small cleanup in bitmaps.
svn path=/trunk/; revision=37496
This commit is contained in:
parent
62a7ad910e
commit
a16c4ab474
2 changed files with 68 additions and 5 deletions
|
@ -341,8 +341,6 @@ CreateCompatibleBitmap(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
INT
|
INT
|
||||||
STDCALL
|
STDCALL
|
||||||
GetDIBits(
|
GetDIBits(
|
||||||
|
@ -392,7 +390,7 @@ GetDIBits(
|
||||||
uUsage,
|
uUsage,
|
||||||
cjBmpScanSize,
|
cjBmpScanSize,
|
||||||
0);
|
0);
|
||||||
if ( lpvBits )
|
if ( lpvBits != pvSafeBits)
|
||||||
{
|
{
|
||||||
RtlCopyMemory( lpvBits, pvSafeBits, cjBmpScanSize);
|
RtlCopyMemory( lpvBits, pvSafeBits, cjBmpScanSize);
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, pvSafeBits);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, pvSafeBits);
|
||||||
|
|
|
@ -3,6 +3,42 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define NB_RESERVED_COLORS 20 /* number of fixed colors in system palette */
|
||||||
|
|
||||||
|
static const PALETTEENTRY sys_pal_template[NB_RESERVED_COLORS] =
|
||||||
|
{
|
||||||
|
/* first 10 entries in the system palette */
|
||||||
|
/* red green blue flags */
|
||||||
|
{ 0x00, 0x00, 0x00, 0 },
|
||||||
|
{ 0x80, 0x00, 0x00, 0 },
|
||||||
|
{ 0x00, 0x80, 0x00, 0 },
|
||||||
|
{ 0x80, 0x80, 0x00, 0 },
|
||||||
|
{ 0x00, 0x00, 0x80, 0 },
|
||||||
|
{ 0x80, 0x00, 0x80, 0 },
|
||||||
|
{ 0x00, 0x80, 0x80, 0 },
|
||||||
|
{ 0xc0, 0xc0, 0xc0, 0 },
|
||||||
|
{ 0xc0, 0xdc, 0xc0, 0 },
|
||||||
|
{ 0xa6, 0xca, 0xf0, 0 },
|
||||||
|
|
||||||
|
/* ... c_min/2 dynamic colorcells */
|
||||||
|
|
||||||
|
/* ... gap (for sparse palettes) */
|
||||||
|
|
||||||
|
/* ... c_min/2 dynamic colorcells */
|
||||||
|
|
||||||
|
{ 0xff, 0xfb, 0xf0, 0 },
|
||||||
|
{ 0xa0, 0xa0, 0xa4, 0 },
|
||||||
|
{ 0x80, 0x80, 0x80, 0 },
|
||||||
|
{ 0xff, 0x00, 0x00, 0 },
|
||||||
|
{ 0x00, 0xff, 0x00, 0 },
|
||||||
|
{ 0xff, 0xff, 0x00, 0 },
|
||||||
|
{ 0x00, 0x00, 0xff, 0 },
|
||||||
|
{ 0xff, 0x00, 0xff, 0 },
|
||||||
|
{ 0x00, 0xff, 0xff, 0 },
|
||||||
|
{ 0xff, 0xff, 0xff, 0 } /* last 10 */
|
||||||
|
};
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
AnimatePalette(HPALETTE hpal,
|
AnimatePalette(HPALETTE hpal,
|
||||||
|
@ -50,7 +86,34 @@ GetSystemPaletteEntries(HDC hDC,
|
||||||
UINT cEntries,
|
UINT cEntries,
|
||||||
LPPALETTEENTRY ppe)
|
LPPALETTEENTRY ppe)
|
||||||
{
|
{
|
||||||
|
PALETTEENTRY ippe[256];
|
||||||
|
|
||||||
|
if (cEntries < 0) return 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( GetDeviceCaps(hDC, RASTERCAPS) & RC_PALETTE )
|
||||||
return NtGdiDoPalette(hDC, iStartIndex, cEntries, ppe, GdiPalGetSystemEntries, FALSE);
|
return NtGdiDoPalette(hDC, iStartIndex, cEntries, ppe, GdiPalGetSystemEntries, FALSE);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ppe)
|
||||||
|
{
|
||||||
|
RtlZeroMemory( &ippe, sizeof(ippe) );
|
||||||
|
RtlCopyMemory( &ippe, &sys_pal_template, sizeof(sys_pal_template) );
|
||||||
|
|
||||||
|
if (iStartIndex < 256)
|
||||||
|
{
|
||||||
|
INT Index = 256 - iStartIndex;
|
||||||
|
|
||||||
|
if ( Index >= cEntries ) Index = cEntries;
|
||||||
|
|
||||||
|
RtlCopyMemory( ppe,
|
||||||
|
&ippe[iStartIndex],
|
||||||
|
Index*sizeof(PALETTEENTRY));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT
|
UINT
|
||||||
|
@ -60,7 +123,9 @@ GetDIBColorTable(HDC hDC,
|
||||||
UINT cEntries,
|
UINT cEntries,
|
||||||
RGBQUAD *pColors)
|
RGBQUAD *pColors)
|
||||||
{
|
{
|
||||||
|
if (cEntries)
|
||||||
return NtGdiDoPalette(hDC, iStartIndex, cEntries, pColors, GdiPalGetColorTable, FALSE);
|
return NtGdiDoPalette(hDC, iStartIndex, cEntries, pColors, GdiPalGetColorTable, FALSE);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue