fix rgb palette
This commit is contained in:
parent
2425033a2f
commit
9e9783f8d2
8 changed files with 70 additions and 98 deletions
|
@ -9,16 +9,11 @@
|
|||
|
||||
HRESULT ddp_GetEntries(IDirectDrawPaletteImpl *This, DWORD dwFlags, DWORD dwBase, DWORD dwNumEntries, LPPALETTEENTRY lpEntries)
|
||||
{
|
||||
int i, x;
|
||||
|
||||
for (i = dwBase, x = 0; i < dwBase + dwNumEntries; i++, x++)
|
||||
for (int i = dwBase, x = 0; i < dwBase + dwNumEntries; i++, x++)
|
||||
{
|
||||
if (This->data_rgb)
|
||||
{
|
||||
lpEntries[x].peRed = This->data_rgb[i].rgbRed;
|
||||
lpEntries[x].peGreen = This->data_rgb[i].rgbGreen;
|
||||
lpEntries[x].peBlue = This->data_rgb[i].rgbBlue;
|
||||
}
|
||||
lpEntries[x].peRed = This->data_rgb[i].rgbRed;
|
||||
lpEntries[x].peGreen = This->data_rgb[i].rgbGreen;
|
||||
lpEntries[x].peBlue = This->data_rgb[i].rgbBlue;
|
||||
}
|
||||
|
||||
return DD_OK;
|
||||
|
@ -26,19 +21,14 @@ HRESULT ddp_GetEntries(IDirectDrawPaletteImpl *This, DWORD dwFlags, DWORD dwBase
|
|||
|
||||
HRESULT ddp_SetEntries(IDirectDrawPaletteImpl *This, DWORD dwFlags, DWORD dwStartingEntry, DWORD dwCount, LPPALETTEENTRY lpEntries)
|
||||
{
|
||||
int i, x;
|
||||
|
||||
for (i = dwStartingEntry, x = 0; i < dwStartingEntry + dwCount; i++, x++)
|
||||
for (int i = dwStartingEntry, x = 0; i < dwStartingEntry + dwCount; i++, x++)
|
||||
{
|
||||
This->data_bgr[i] = (lpEntries[x].peBlue << 16) | (lpEntries[x].peGreen << 8) | lpEntries[x].peRed;
|
||||
|
||||
if (This->data_rgb)
|
||||
{
|
||||
This->data_rgb[i].rgbRed = lpEntries[x].peRed;
|
||||
This->data_rgb[i].rgbGreen = lpEntries[x].peGreen;
|
||||
This->data_rgb[i].rgbBlue = lpEntries[x].peBlue;
|
||||
This->data_rgb[i].rgbReserved = 0;
|
||||
}
|
||||
This->data_rgb[i].rgbRed = lpEntries[x].peRed;
|
||||
This->data_rgb[i].rgbGreen = lpEntries[x].peGreen;
|
||||
This->data_rgb[i].rgbBlue = lpEntries[x].peBlue;
|
||||
This->data_rgb[i].rgbReserved = 0;
|
||||
}
|
||||
|
||||
if (!(This->flags & DDPCAPS_ALLOW256))
|
||||
|
@ -46,18 +36,15 @@ HRESULT ddp_SetEntries(IDirectDrawPaletteImpl *This, DWORD dwFlags, DWORD dwStar
|
|||
This->data_bgr[0] = 0;
|
||||
This->data_bgr[255] = (255 << 16) | (255 << 8) | 255;
|
||||
|
||||
if (This->data_rgb)
|
||||
{
|
||||
This->data_rgb[0].rgbRed = 0;
|
||||
This->data_rgb[0].rgbGreen = 0;
|
||||
This->data_rgb[0].rgbBlue = 0;
|
||||
This->data_rgb[0].rgbReserved = 0;
|
||||
This->data_rgb[0].rgbRed = 0;
|
||||
This->data_rgb[0].rgbGreen = 0;
|
||||
This->data_rgb[0].rgbBlue = 0;
|
||||
This->data_rgb[0].rgbReserved = 0;
|
||||
|
||||
This->data_rgb[255].rgbRed = 255;
|
||||
This->data_rgb[255].rgbGreen = 255;
|
||||
This->data_rgb[255].rgbBlue = 255;
|
||||
This->data_rgb[255].rgbReserved = 0;
|
||||
}
|
||||
This->data_rgb[255].rgbRed = 255;
|
||||
This->data_rgb[255].rgbGreen = 255;
|
||||
This->data_rgb[255].rgbBlue = 255;
|
||||
This->data_rgb[255].rgbReserved = 0;
|
||||
}
|
||||
|
||||
if (g_ddraw->primary && g_ddraw->primary->palette == This && g_ddraw->render.run)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue