- 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)
This commit is contained in:
Randy Heit 2012-07-05 21:05:06 +00:00
parent 72f1a37ec4
commit ca33d55bd3
2 changed files with 6 additions and 2 deletions

View file

@ -143,6 +143,7 @@ DDrawFB::DDrawFB (int width, int height, bool fullscreen)
NeedGammaUpdate = false; NeedGammaUpdate = false;
NeedPalUpdate = false; NeedPalUpdate = false;
NeedResRecreate = false; NeedResRecreate = false;
PaletteChangeExpected = false;
MustBuffer = false; MustBuffer = false;
BufferingNow = false; BufferingNow = false;
WasBuffering = false; WasBuffering = false;
@ -461,7 +462,7 @@ bool DDrawFB::CreateSurfacesComplex ()
{ {
DDSURFACEDESC ddsd = { sizeof(ddsd), }; DDSURFACEDESC ddsd = { sizeof(ddsd), };
HRESULT hr; HRESULT hr;
int tries = 0; int tries = 2;
LOG ("creating surfaces using a complex primary\n"); 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. // they are obviously jerks, and we need to restore our own palette.
if (!Windowed) if (!Windowed)
{ {
if (Palette != NULL) if (!PaletteChangeExpected && Palette != NULL)
{ {
// It is not enough to set NeedPalUpdate to true. Some palette // It is not enough to set NeedPalUpdate to true. Some palette
// entries might now be reserved for system usage, and nothing // entries might now be reserved for system usage, and nothing
@ -729,6 +730,7 @@ void DDrawFB::PaletteChanged ()
// somebody tries to lock it. // somebody tries to lock it.
NeedResRecreate = true; NeedResRecreate = true;
} }
PaletteChangeExpected = false;
} }
else else
{ {
@ -1197,6 +1199,7 @@ void DDrawFB::Update ()
if (pchanged && AppActive && !SessionState) if (pchanged && AppActive && !SessionState)
{ {
PaletteChangeExpected = true;
Palette->SetEntries (0, 0, 256, PalEntries); Palette->SetEntries (0, 0, 256, PalEntries);
} }
} }

View file

@ -208,6 +208,7 @@ private:
bool NeedGammaUpdate; bool NeedGammaUpdate;
bool NeedPalUpdate; bool NeedPalUpdate;
bool NeedResRecreate; bool NeedResRecreate;
bool PaletteChangeExpected;
bool MustBuffer; // The screen is not 8-bit, or there is no backbuffer bool MustBuffer; // The screen is not 8-bit, or there is no backbuffer
bool BufferingNow; // Most recent Lock was buffered bool BufferingNow; // Most recent Lock was buffered
bool WasBuffering; // Second most recent Lock was buffered bool WasBuffering; // Second most recent Lock was buffered