From 7eef2b3684d62fd75aa7eda265980f7fc95f39c6 Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Sat, 19 Feb 2022 22:00:57 +0700 Subject: [PATCH] Code refactor: get rid of Windows macro min and max. --- src/DisplayWindow.cpp | 4 ---- src/GLideNHQ/TxFilterExport.h | 3 +++ src/Graphics/OpenGLContext/GLFunctions.h | 3 +++ .../GLSL/glsl_CombinerProgramUniformFactoryAccurate.cpp | 5 ----- .../GLSL/glsl_CombinerProgramUniformFactoryFast.cpp | 4 ---- src/Graphics/OpenGLContext/opengl_ContextImpl.cpp | 5 ----- src/PluginAPI.h | 3 +++ src/windows/GLideN64_windows.h | 2 +- src/windows/ScreenShot.cpp | 4 ++-- 9 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/DisplayWindow.cpp b/src/DisplayWindow.cpp index ca9d2fbf..8c6ad8a3 100644 --- a/src/DisplayWindow.cpp +++ b/src/DisplayWindow.cpp @@ -8,10 +8,6 @@ #include "PluginAPI.h" #include "FrameBuffer.h" -#ifdef min -#undef min -#endif - bool DisplayWindow::start() { if (!_start()) diff --git a/src/GLideNHQ/TxFilterExport.h b/src/GLideNHQ/TxFilterExport.h index e4f4f0ca..fcef8f25 100644 --- a/src/GLideNHQ/TxFilterExport.h +++ b/src/GLideNHQ/TxFilterExport.h @@ -25,6 +25,9 @@ #define __EXT_TXFILTER_H__ #ifdef OS_WINDOWS +#ifndef NOMINMAX +#define NOMINMAX +#endif #include #define TXHMODULE HMODULE #define DLOPEN(a) LoadLibraryW(a) diff --git a/src/Graphics/OpenGLContext/GLFunctions.h b/src/Graphics/OpenGLContext/GLFunctions.h index d1456927..96aac6e3 100644 --- a/src/Graphics/OpenGLContext/GLFunctions.h +++ b/src/Graphics/OpenGLContext/GLFunctions.h @@ -2,6 +2,9 @@ #define GLFUNCTIONS_H #ifdef OS_WINDOWS +#ifndef NOMINMAX +#define NOMINMAX +#endif #include //#define FORCE_UNBUFFERED_DRAWER // Debug option. #elif defined(OS_LINUX) diff --git a/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactoryAccurate.cpp b/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactoryAccurate.cpp index f9053ddd..f5bf4a49 100644 --- a/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactoryAccurate.cpp +++ b/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactoryAccurate.cpp @@ -1,5 +1,4 @@ #include "glsl_CombinerProgramUniformFactoryAccurate.h" - #include #include #include @@ -8,10 +7,6 @@ #include -#ifdef min -#undef min -#endif - namespace { using namespace glsl; diff --git a/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactoryFast.cpp b/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactoryFast.cpp index 91e85795..c27d7fb1 100644 --- a/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactoryFast.cpp +++ b/src/Graphics/OpenGLContext/GLSL/glsl_CombinerProgramUniformFactoryFast.cpp @@ -8,10 +8,6 @@ #include -#ifdef min -#undef min -#endif - namespace { using namespace glsl; diff --git a/src/Graphics/OpenGLContext/opengl_ContextImpl.cpp b/src/Graphics/OpenGLContext/opengl_ContextImpl.cpp index 312fd6c2..b07c2250 100644 --- a/src/Graphics/OpenGLContext/opengl_ContextImpl.cpp +++ b/src/Graphics/OpenGLContext/opengl_ContextImpl.cpp @@ -26,10 +26,6 @@ #include #endif -#ifdef min -#undef min -#endif - using namespace opengl; ContextImpl::ContextImpl() @@ -38,7 +34,6 @@ ContextImpl::ContextImpl() } - ContextImpl::~ContextImpl() { } diff --git a/src/PluginAPI.h b/src/PluginAPI.h index a236426f..cc6e222e 100644 --- a/src/PluginAPI.h +++ b/src/PluginAPI.h @@ -2,6 +2,9 @@ #define COMMONPLUGINAPI_H #ifdef MUPENPLUSAPI +#ifndef NOMINMAX +#define NOMINMAX +#endif #include "m64p_plugin.h" #else #include "windows/GLideN64_windows.h" diff --git a/src/windows/GLideN64_windows.h b/src/windows/GLideN64_windows.h index 13e6ec49..6d61cfb9 100644 --- a/src/windows/GLideN64_windows.h +++ b/src/windows/GLideN64_windows.h @@ -1,7 +1,7 @@ #ifndef GLIDEN64_WINDOWS_H #define GLIDEN64_WINDOWS_H -#include +#include "Platform.h" extern HWND hWnd; extern HWND hStatusBar; diff --git a/src/windows/ScreenShot.cpp b/src/windows/ScreenShot.cpp index df7d2e80..6c9123cb 100644 --- a/src/windows/ScreenShot.cpp +++ b/src/windows/ScreenShot.cpp @@ -1,4 +1,4 @@ -#include +#include "Platform.h" #include "Config.h" #include "../GLideNHQ/inc/png.h" @@ -118,6 +118,6 @@ void SaveScreenshot(const wchar_t * _folder, const char * _name, int _width, int } if (i == 1000) return; - + write_png_file(fileName, _width, _height, _data); }