From ca33d55bd366440440631542255896d29dcf82ae Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 5 Jul 2012 21:05:06 +0000 Subject: [PATCH] - Fixed: DDrawFB should not recreate all its resources when the palette changes if we were the one responsible for the palette change. - Fixed: DDrawFB::CreateSurfacesComplex() starting tries at 2 instead of 0 is not "debugging cruft" since it counts down, not up. (Partially reverts r3195) SVN r3733 (trunk) --- src/win32/fb_ddraw.cpp | 7 +++++-- src/win32/win32iface.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/win32/fb_ddraw.cpp b/src/win32/fb_ddraw.cpp index 2521d6193..937fba046 100644 --- a/src/win32/fb_ddraw.cpp +++ b/src/win32/fb_ddraw.cpp @@ -143,6 +143,7 @@ DDrawFB::DDrawFB (int width, int height, bool fullscreen) NeedGammaUpdate = false; NeedPalUpdate = false; NeedResRecreate = false; + PaletteChangeExpected = false; MustBuffer = false; BufferingNow = false; WasBuffering = false; @@ -461,7 +462,7 @@ bool DDrawFB::CreateSurfacesComplex () { DDSURFACEDESC ddsd = { sizeof(ddsd), }; HRESULT hr; - int tries = 0; + int tries = 2; LOG ("creating surfaces using a complex primary\n"); @@ -717,7 +718,7 @@ void DDrawFB::PaletteChanged () // they are obviously jerks, and we need to restore our own palette. if (!Windowed) { - if (Palette != NULL) + if (!PaletteChangeExpected && Palette != NULL) { // It is not enough to set NeedPalUpdate to true. Some palette // entries might now be reserved for system usage, and nothing @@ -729,6 +730,7 @@ void DDrawFB::PaletteChanged () // somebody tries to lock it. NeedResRecreate = true; } + PaletteChangeExpected = false; } else { @@ -1197,6 +1199,7 @@ void DDrawFB::Update () if (pchanged && AppActive && !SessionState) { + PaletteChangeExpected = true; Palette->SetEntries (0, 0, 256, PalEntries); } } diff --git a/src/win32/win32iface.h b/src/win32/win32iface.h index 60dc9cbd3..66c396a96 100644 --- a/src/win32/win32iface.h +++ b/src/win32/win32iface.h @@ -208,6 +208,7 @@ private: bool NeedGammaUpdate; bool NeedPalUpdate; bool NeedResRecreate; + bool PaletteChangeExpected; bool MustBuffer; // The screen is not 8-bit, or there is no backbuffer bool BufferingNow; // Most recent Lock was buffered bool WasBuffering; // Second most recent Lock was buffered