|
@@ -53,15 +53,15 @@ static void MakePalette()
|
|
|
pal = (LOGPALETTE*)alloca(sizeof(LOGPALETTE) + (256 - 1) * sizeof(PALETTEENTRY));
|
|
|
|
|
|
pal->palVersion = 0x300;
|
|
|
pal->palNumEntries = 256;
|
|
|
|
|
|
for (i = 0; i != 256; i++) {
|
|
|
pal->palPalEntry[i].peRed = _cur_palette[i].r;
|
|
|
pal->palPalEntry[i].peGreen = _cur_palette[i].g;
|
|
|
pal->palPalEntry[i].peBlue = _cur_palette[i].b;
|
|
|
pal->palPalEntry[i].peRed = _cur_palette.palette[i].r;
|
|
|
pal->palPalEntry[i].peGreen = _cur_palette.palette[i].g;
|
|
|
pal->palPalEntry[i].peBlue = _cur_palette.palette[i].b;
|
|
|
pal->palPalEntry[i].peFlags = 0;
|
|
|
|
|
|
}
|
|
|
_wnd.gdi_palette = CreatePalette(pal);
|
|
|
if (_wnd.gdi_palette == NULL) usererror("CreatePalette failed!\n");
|
|
|
}
|
|
@@ -69,15 +69,15 @@ static void MakePalette()
|
|
|
static void UpdatePalette(HDC dc, uint start, uint count)
|
|
|
{
|
|
|
RGBQUAD rgb[256];
|
|
|
uint i;
|
|
|
|
|
|
for (i = 0; i != count; i++) {
|
|
|
rgb[i].rgbRed = _cur_palette[start + i].r;
|
|
|
rgb[i].rgbGreen = _cur_palette[start + i].g;
|
|
|
rgb[i].rgbBlue = _cur_palette[start + i].b;
|
|
|
rgb[i].rgbRed = _cur_palette.palette[start + i].r;
|
|
|
rgb[i].rgbGreen = _cur_palette.palette[start + i].g;
|
|
|
rgb[i].rgbBlue = _cur_palette.palette[start + i].b;
|
|
|
rgb[i].rgbReserved = 0;
|
|
|
}
|
|
|
|
|
|
SetDIBColorTable(dc, start, count, rgb);
|
|
|
}
|
|
|
|
|
@@ -159,14 +159,14 @@ static bool AllocateDibSection(int w, in
|
|
|
|
|
|
static void ClientSizeChanged(int w, int h)
|
|
|
{
|
|
|
/* allocate new dib section of the new size */
|
|
|
if (AllocateDibSection(w, h)) {
|
|
|
/* mark all palette colors dirty */
|
|
|
_pal_first_dirty = 0;
|
|
|
_pal_count_dirty = 256;
|
|
|
_cur_palette.first_dirty = 0;
|
|
|
_cur_palette.count_dirty = 256;
|
|
|
|
|
|
BlitterFactoryBase::GetCurrentBlitter()->PostResize();
|
|
|
|
|
|
GameSizeChanged();
|
|
|
|
|
|
/* redraw screen */
|
|
@@ -347,31 +347,31 @@ static LRESULT CALLBACK WndProcGdi(HWND
|
|
|
BeginPaint(hwnd, &ps);
|
|
|
dc = ps.hdc;
|
|
|
dc2 = CreateCompatibleDC(dc);
|
|
|
old_bmp = (HBITMAP)SelectObject(dc2, _wnd.dib_sect);
|
|
|
old_palette = SelectPalette(dc, _wnd.gdi_palette, FALSE);
|
|
|
|
|
|
if (_pal_count_dirty != 0) {
|
|
|
if (_cur_palette.count_dirty != 0) {
|
|
|
Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
|
|
|
|
|
|
switch (blitter->UsePaletteAnimation()) {
|
|
|
case Blitter::PALETTE_ANIMATION_VIDEO_BACKEND:
|
|
|
UpdatePalette(dc2, _pal_first_dirty, _pal_count_dirty);
|
|
|
UpdatePalette(dc2, _cur_palette.first_dirty, _cur_palette.count_dirty);
|
|
|
break;
|
|
|
|
|
|
case Blitter::PALETTE_ANIMATION_BLITTER:
|
|
|
blitter->PaletteAnimate(_pal_first_dirty, _pal_count_dirty);
|
|
|
blitter->PaletteAnimate(_cur_palette.first_dirty, _cur_palette.count_dirty);
|
|
|
break;
|
|
|
|
|
|
case Blitter::PALETTE_ANIMATION_NONE:
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
NOT_REACHED();
|
|
|
}
|
|
|
_pal_count_dirty = 0;
|
|
|
_cur_palette.count_dirty = 0;
|
|
|
}
|
|
|
|
|
|
BitBlt(dc, 0, 0, _wnd.width, _wnd.height, dc2, 0, 0, SRCCOPY);
|
|
|
SelectPalette(dc, old_palette, TRUE);
|
|
|
SelectObject(dc2, old_bmp);
|
|
|
DeleteDC(dc2);
|
|
@@ -836,13 +836,13 @@ void VideoDriver_Win32::MakeDirty(int le
|
|
|
|
|
|
InvalidateRect(_wnd.main_wnd, &r, FALSE);
|
|
|
}
|
|
|
|
|
|
static void CheckPaletteAnim()
|
|
|
{
|
|
|
if (_pal_count_dirty == 0) return;
|
|
|
if (_cur_palette.count_dirty == 0) return;
|
|
|
|
|
|
InvalidateRect(_wnd.main_wnd, NULL, FALSE);
|
|
|
}
|
|
|
|
|
|
void VideoDriver_Win32::MainLoop()
|
|
|
{
|