From 6cd26dec0120a19378ff073da906c03f2df8a680 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 31 Mar 2018 00:25:15 +0200 Subject: [PATCH] - remove some dead code. --- src/gl/system/gl_framebuffer.h | 2 +- src/posix/sdl/sdlglvideo.cpp | 34 ------------------ src/posix/sdl/sdlglvideo.h | 2 -- src/win32/hardware.cpp | 1 - src/win32/i_dijoy.cpp | 2 +- src/win32/i_input.cpp | 2 +- src/win32/i_keyboard.cpp | 2 +- src/win32/i_mouse.cpp | 2 +- src/win32/i_rawps2.cpp | 2 +- src/win32/i_xinput.cpp | 2 +- src/win32/win32gliface.cpp | 5 +-- src/win32/win32gliface.h | 5 ++- src/win32/win32iface.h | 65 ---------------------------------- src/win32/win32video.cpp | 24 ------------- 14 files changed, 10 insertions(+), 140 deletions(-) delete mode 100644 src/win32/win32iface.h diff --git a/src/gl/system/gl_framebuffer.h b/src/gl/system/gl_framebuffer.h index 8a270bb64..73c3c8d5f 100644 --- a/src/gl/system/gl_framebuffer.h +++ b/src/gl/system/gl_framebuffer.h @@ -2,7 +2,7 @@ #define __GL_FRAMEBUFFER #ifdef _WIN32 -#include "win32iface.h" +#include "hardware.h" #include "win32gliface.h" #endif diff --git a/src/posix/sdl/sdlglvideo.cpp b/src/posix/sdl/sdlglvideo.cpp index 5482b1e4c..8e5475fcd 100644 --- a/src/posix/sdl/sdlglvideo.cpp +++ b/src/posix/sdl/sdlglvideo.cpp @@ -465,37 +465,3 @@ int SDLGLFB::GetClientHeight() return height; } -void SDLGLFB::ScaleCoordsFromWindow(int16_t &x, int16_t &y) -{ - int w, h; - SDL_GetWindowSize (Screen, &w, &h); - - // Detect if we're doing scaling in the Window and adjust the mouse - // coordinates accordingly. This could be more efficent, but I - // don't think performance is an issue in the menus. - if(IsFullscreen()) - { - int realw = w, realh = h; - ScaleWithAspect (realw, realh, SCREENWIDTH, SCREENHEIGHT); - if (realw != SCREENWIDTH || realh != SCREENHEIGHT) - { - double xratio = (double)SCREENWIDTH/realw; - double yratio = (double)SCREENHEIGHT/realh; - if (realw < w) - { - x = (x - (w - realw)/2)*xratio; - y *= yratio; - } - else - { - y = (y - (h - realh)/2)*yratio; - x *= xratio; - } - } - } - else - { - x = (int16_t)(x*Width/w); - y = (int16_t)(y*Height/h); - } -} diff --git a/src/posix/sdl/sdlglvideo.h b/src/posix/sdl/sdlglvideo.h index 6cbd1d4e9..83c99ab93 100644 --- a/src/posix/sdl/sdlglvideo.h +++ b/src/posix/sdl/sdlglvideo.h @@ -70,8 +70,6 @@ public: int GetClientWidth(); int GetClientHeight(); - virtual void ScaleCoordsFromWindow(int16_t &x, int16_t &y); - SDL_Window *GetSDLWindow() override { return Screen; } virtual int GetTrueHeight() { return GetClientHeight(); } diff --git a/src/win32/hardware.cpp b/src/win32/hardware.cpp index 58882748c..d329e0e21 100644 --- a/src/win32/hardware.cpp +++ b/src/win32/hardware.cpp @@ -36,7 +36,6 @@ #include #include "hardware.h" -#include "win32iface.h" #include "i_video.h" #include "i_system.h" #include "c_console.h" diff --git a/src/win32/i_dijoy.cpp b/src/win32/i_dijoy.cpp index 199a4fa56..3dc978c4a 100644 --- a/src/win32/i_dijoy.cpp +++ b/src/win32/i_dijoy.cpp @@ -52,7 +52,7 @@ #include "c_dispatch.h" #include "doomdef.h" #include "doomstat.h" -#include "win32iface.h" +#include "hardware.h" #include "templates.h" #include "gameconfigfile.h" #include "cmdlib.h" diff --git a/src/win32/i_input.cpp b/src/win32/i_input.cpp index 24ae8d6bb..e6653f512 100644 --- a/src/win32/i_input.cpp +++ b/src/win32/i_input.cpp @@ -94,7 +94,7 @@ #include "s_sound.h" #include "m_misc.h" #include "gameconfigfile.h" -#include "win32iface.h" +#include "hardware.h" #include "templates.h" #include "cmdlib.h" #include "d_event.h" diff --git a/src/win32/i_keyboard.cpp b/src/win32/i_keyboard.cpp index 04dd5a1cc..056f80293 100644 --- a/src/win32/i_keyboard.cpp +++ b/src/win32/i_keyboard.cpp @@ -46,7 +46,7 @@ #include "c_cvars.h" #include "doomdef.h" #include "doomstat.h" -#include "win32iface.h" +#include "hardware.h" #include "rawinput.h" // MACROS ------------------------------------------------------------------ diff --git a/src/win32/i_mouse.cpp b/src/win32/i_mouse.cpp index f091f5e8c..a6d606f8d 100644 --- a/src/win32/i_mouse.cpp +++ b/src/win32/i_mouse.cpp @@ -46,7 +46,7 @@ #include "c_cvars.h" #include "doomdef.h" #include "doomstat.h" -#include "win32iface.h" +#include "hardware.h" #include "rawinput.h" #include "menu/menu.h" #include "events.h" diff --git a/src/win32/i_rawps2.cpp b/src/win32/i_rawps2.cpp index 9ae44161e..efd9cd221 100644 --- a/src/win32/i_rawps2.cpp +++ b/src/win32/i_rawps2.cpp @@ -47,7 +47,7 @@ #include "c_dispatch.h" #include "doomdef.h" #include "doomstat.h" -#include "win32iface.h" +#include "hardware.h" #include "templates.h" #include "gameconfigfile.h" #include "cmdlib.h" diff --git a/src/win32/i_xinput.cpp b/src/win32/i_xinput.cpp index 5c5e25aed..c7c104d94 100644 --- a/src/win32/i_xinput.cpp +++ b/src/win32/i_xinput.cpp @@ -50,7 +50,7 @@ #include "c_dispatch.h" #include "doomdef.h" #include "doomstat.h" -#include "win32iface.h" +#include "hardware.h" #include "templates.h" #include "gameconfigfile.h" #include "cmdlib.h" diff --git a/src/win32/win32gliface.cpp b/src/win32/win32gliface.cpp index fa72310e7..ffb66f78f 100644 --- a/src/win32/win32gliface.cpp +++ b/src/win32/win32gliface.cpp @@ -39,14 +39,11 @@ #include #include "wglext.h" -#include "win32iface.h" #include "win32gliface.h" -//#include "gl/gl_intern.h" #include "x86.h" #include "templates.h" #include "version.h" #include "c_console.h" -#include "hardware.h" #include "v_video.h" #include "i_input.h" #include "i_system.h" @@ -981,7 +978,7 @@ bool Win32GLVideo::SetFullscreen(const char *devicename, int w, int h, int bits, // //========================================================================== -Win32GLFrameBuffer::Win32GLFrameBuffer(void *hMonitor, int width, int height, int bits, int refreshHz, bool fullscreen, bool bgra) : BaseWinFB(width, height, bgra) +Win32GLFrameBuffer::Win32GLFrameBuffer(void *hMonitor, int width, int height, int bits, int refreshHz, bool fullscreen, bool bgra) : DFrameBuffer(width, height, bgra) { m_Width = width; m_Height = height; diff --git a/src/win32/win32gliface.h b/src/win32/win32gliface.h index 73e8bf746..4886f1420 100644 --- a/src/win32/win32gliface.h +++ b/src/win32/win32gliface.h @@ -2,7 +2,6 @@ #define __WIN32GLIFACE_H__ #include "hardware.h" -#include "win32iface.h" #include "v_video.h" #include "tarray.h" @@ -25,9 +24,9 @@ FRenderer *gl_CreateInterface(); -class Win32GLFrameBuffer : public BaseWinFB +class Win32GLFrameBuffer : public DFrameBuffer { - typedef BaseWinFB Super; + typedef DFrameBuffer Super; public: Win32GLFrameBuffer() {} diff --git a/src/win32/win32iface.h b/src/win32/win32iface.h deleted file mode 100644 index 7128b9c25..000000000 --- a/src/win32/win32iface.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -** win32iface.h -** -**--------------------------------------------------------------------------- -** Copyright 1998-2008 Randy Heit -** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions -** are met: -** -** 1. Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** 2. Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** 3. The name of the author may not be used to endorse or promote products -** derived from this software without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -**--------------------------------------------------------------------------- -** -*/ - -#ifndef __WIN32IFACE_H -#define __WIN32IFACE_H - -#include "hardware.h" - - -EXTERN_CVAR (Bool, vid_vsync) - -struct FSoftwareRenderer; - - -class BaseWinFB : public DFrameBuffer -{ - typedef DFrameBuffer Super; -public: - BaseWinFB(int width, int height, bool bgra) : DFrameBuffer(width, height, bgra), Windowed(true) {} - - bool IsFullscreen () { return !Windowed; } - virtual void ScaleCoordsFromWindow(int16_t &x, int16_t &y); - -protected: - virtual int GetTrueHeight() { return GetHeight(); } - - bool Windowed; - - friend class Win32Video; - - BaseWinFB() {} -}; - - -#endif // __WIN32IFACE_H diff --git a/src/win32/win32video.cpp b/src/win32/win32video.cpp index 936db0be0..6a314621a 100644 --- a/src/win32/win32video.cpp +++ b/src/win32/win32video.cpp @@ -70,7 +70,6 @@ #include "v_text.h" #include "version.h" -#include "win32iface.h" #include "optwin32.h" @@ -179,26 +178,3 @@ void I_FPSLimit() } } -//========================================================================== -// -// BaseWinFB :: ScaleCoordsFromWindow -// -// Given coordinates in window space, return coordinates in what the game -// thinks screen space is. -// -//========================================================================== -extern HWND Window; - -void BaseWinFB::ScaleCoordsFromWindow(int16_t &x, int16_t &y) -{ - RECT rect; - - int TrueHeight = GetTrueHeight(); - if (GetClientRect(Window, &rect)) - { - x = int16_t(x * Width / (rect.right - rect.left)); - y = int16_t(y * TrueHeight / (rect.bottom - rect.top)); - } - // Subtract letterboxing borders - y -= (TrueHeight - Height) / 2; -}