mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 13:11:33 +00:00
- moved ScaleCoordsFromWindow to the BaseWinFB base class to eliminate two identical implementations.
(GZDoom would have had to implement a third identical copy in its GL framebuffer as well.)
This commit is contained in:
parent
f57e08102c
commit
f983f778f2
4 changed files with 27 additions and 37 deletions
|
@ -1028,28 +1028,6 @@ bool D3DFB::IsFullscreen ()
|
|||
return !Windowed;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// D3DFB :: ScaleCoordsFromWindow
|
||||
//
|
||||
// Given coordinates in window space, return coordinates in what the game
|
||||
// thinks screen space is.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void D3DFB::ScaleCoordsFromWindow(SWORD &x, SWORD &y)
|
||||
{
|
||||
RECT rect;
|
||||
|
||||
if (GetClientRect(Window, &rect))
|
||||
{
|
||||
x = SWORD(x * Width / (rect.right - rect.left));
|
||||
y = SWORD(y * TrueHeight / (rect.bottom - rect.top));
|
||||
}
|
||||
// Subtract letterboxing borders
|
||||
y -= (TrueHeight - Height) / 2;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// D3DFB :: Lock
|
||||
|
|
|
@ -806,19 +806,6 @@ bool DDrawFB::Is8BitMode()
|
|||
return vid_displaybits == 8;
|
||||
}
|
||||
|
||||
void DDrawFB::ScaleCoordsFromWindow(SWORD &x, SWORD &y)
|
||||
{
|
||||
RECT rect;
|
||||
|
||||
if (GetClientRect(Window, &rect))
|
||||
{
|
||||
x = SWORD(x * Width / (rect.right - rect.left));
|
||||
y = SWORD(y * TrueHeight / (rect.bottom - rect.top));
|
||||
}
|
||||
// Subtract letterboxing borders
|
||||
y -= (TrueHeight - Height) / 2;
|
||||
}
|
||||
|
||||
bool DDrawFB::IsValid ()
|
||||
{
|
||||
return PrimarySurf != NULL;
|
||||
|
|
|
@ -127,10 +127,12 @@ public:
|
|||
virtual void Blank () = 0;
|
||||
virtual bool PaintToWindow () = 0;
|
||||
virtual HRESULT GetHR () = 0;
|
||||
virtual void ScaleCoordsFromWindow(SWORD &x, SWORD &y);
|
||||
|
||||
protected:
|
||||
virtual bool CreateResources () = 0;
|
||||
virtual void ReleaseResources () = 0;
|
||||
virtual int GetTrueHeight() { return GetHeight(); }
|
||||
|
||||
bool Windowed;
|
||||
|
||||
|
@ -165,7 +167,7 @@ public:
|
|||
void NewRefreshRate();
|
||||
HRESULT GetHR ();
|
||||
bool Is8BitMode();
|
||||
void ScaleCoordsFromWindow(SWORD &x, SWORD &y);
|
||||
virtual int GetTrueHeight() { return TrueHeight; }
|
||||
|
||||
void Blank ();
|
||||
bool PaintToWindow ();
|
||||
|
@ -270,7 +272,7 @@ public:
|
|||
void WipeCleanup();
|
||||
HRESULT GetHR ();
|
||||
bool Is8BitMode() { return false; }
|
||||
void ScaleCoordsFromWindow(SWORD &x, SWORD &y);
|
||||
virtual int GetTrueHeight() { return TrueHeight; }
|
||||
|
||||
private:
|
||||
friend class D3DTex;
|
||||
|
|
|
@ -736,6 +736,29 @@ void Win32Video::SetWindowedScale (float scale)
|
|||
// FIXME
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// BaseWinFB :: ScaleCoordsFromWindow
|
||||
//
|
||||
// Given coordinates in window space, return coordinates in what the game
|
||||
// thinks screen space is.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void BaseWinFB::ScaleCoordsFromWindow(SWORD &x, SWORD &y)
|
||||
{
|
||||
RECT rect;
|
||||
|
||||
int TrueHeight = GetTrueHeight();
|
||||
if (GetClientRect(Window, &rect))
|
||||
{
|
||||
x = SWORD(x * Width / (rect.right - rect.left));
|
||||
y = SWORD(y * TrueHeight / (rect.bottom - rect.top));
|
||||
}
|
||||
// Subtract letterboxing borders
|
||||
y -= (TrueHeight - Height) / 2;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// SetFPSLimit
|
||||
|
|
Loading…
Reference in a new issue