- Do not set the mouse pointer if the display is 8 bit, since such displays don't support color cursors.

SVN r3734 (trunk)
This commit is contained in:
Randy Heit 2012-07-05 21:46:03 +00:00
parent ca33d55bd3
commit 8673743139
6 changed files with 27 additions and 1 deletions

View file

@ -682,6 +682,8 @@ void D_Display ()
// Reload crosshair if transitioned to a different size // Reload crosshair if transitioned to a different size
ST_LoadCrosshair (true); ST_LoadCrosshair (true);
AM_NewResolution (); AM_NewResolution ();
// Reset the mouse cursor in case the bit depth changed
vid_cursor.Callback();
} }
} }

View file

@ -100,6 +100,7 @@ public:
#ifdef _WIN32 #ifdef _WIN32
void PaletteChanged() {} void PaletteChanged() {}
int QueryNewPalette() { return 0; } int QueryNewPalette() { return 0; }
bool Is8BitMode() { return false; }
#endif #endif
float Gamma; float Gamma;

View file

@ -406,6 +406,7 @@ public:
#ifdef _WIN32 #ifdef _WIN32
virtual void PaletteChanged () = 0; virtual void PaletteChanged () = 0;
virtual int QueryNewPalette () = 0; virtual int QueryNewPalette () = 0;
virtual bool Is8BitMode() = 0;
#endif #endif
protected: protected:

View file

@ -786,6 +786,25 @@ void DDrawFB::RebuildColorTable ()
} }
} }
bool DDrawFB::Is8BitMode()
{
if (Windowed)
{
return Write8bit;
}
DDPIXELFORMAT fmt = { sizeof(fmt), };
HRESULT hr;
hr = PrimarySurf->GetPixelFormat(&fmt);
if (SUCCEEDED(hr))
{
return !!(fmt.dwFlags & DDPF_PALETTEINDEXED8);
}
// Can't get the primary surface's pixel format, so assume
// vid_displaybits is accurate.
return vid_displaybits == 8;
}
bool DDrawFB::IsValid () bool DDrawFB::IsValid ()
{ {
return PrimarySurf != NULL; return PrimarySurf != NULL;

View file

@ -1187,7 +1187,8 @@ bool I_SetCursor(FTexture *cursorpic)
{ {
HCURSOR cursor; HCURSOR cursor;
if (cursorpic != NULL && cursorpic->UseType != FTexture::TEX_Null) if (cursorpic != NULL && cursorpic->UseType != FTexture::TEX_Null &&
(screen == NULL || !screen->Is8BitMode()))
{ {
// Must be no larger than 32x32. // Must be no larger than 32x32.
if (cursorpic->GetWidth() > 32 || cursorpic->GetHeight() > 32) if (cursorpic->GetWidth() > 32 || cursorpic->GetHeight() > 32)

View file

@ -164,6 +164,7 @@ public:
void NewRefreshRate(); void NewRefreshRate();
HRESULT GetHR (); HRESULT GetHR ();
virtual int GetTrueHeight() { return TrueHeight; } virtual int GetTrueHeight() { return TrueHeight; }
bool Is8BitMode();
void Blank (); void Blank ();
bool PaintToWindow (); bool PaintToWindow ();
@ -269,6 +270,7 @@ public:
void WipeCleanup(); void WipeCleanup();
HRESULT GetHR (); HRESULT GetHR ();
virtual int GetTrueHeight() { return TrueHeight; } virtual int GetTrueHeight() { return TrueHeight; }
bool Is8BitMode() { return false; }
private: private:
friend class D3DTex; friend class D3DTex;