1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-25 07:44:38 +01:00

Extract RequireNewWindow to Platform

This commit is contained in:
Tulio Leao
2021-03-26 00:24:55 -03:00
parent 62fc4c8034
commit e23eaa164b
4 changed files with 16 additions and 10 deletions

View File

@@ -15,6 +15,7 @@
#include "../interface/Screenshot.h"
#include "../localisation/StringIds.h"
#include "../paint/Painter.h"
#include "../platform/Platform2.h"
#include "../ui/UiContext.h"
#include "../world/Location.hpp"
#include "IDrawingContext.h"
@@ -52,16 +53,8 @@ static IDrawingEngine* GetDrawingEngine()
bool drawing_engine_requires_new_window(DrawingEngine srcEngine, DrawingEngine dstEngine)
{
#ifdef _WIN32
if (srcEngine != DrawingEngine::OpenGL && dstEngine != DrawingEngine::OpenGL)
{
// Windows is apparently able to switch to hardware rendering on the fly although
// using the same window in an unaccelerated and accelerated context is unsupported by SDL2
return false;
}
#endif
return true;
bool openGL = srcEngine == DrawingEngine::OpenGL || dstEngine == DrawingEngine::OpenGL;
return Platform::RequireNewWindow(openGL);
}
void drawing_engine_init()

View File

@@ -240,6 +240,11 @@ namespace Platform
}
return result;
}
bool RequireNewWindow(bool openGL)
{
return true;
}
} // namespace Platform
#endif

View File

@@ -593,6 +593,13 @@ namespace Platform
}
return result;
}
bool RequireNewWindow(bool openGL)
{
// Windows is apparently able to switch to hardware rendering on the fly although
// using the same window in an unaccelerated and accelerated context is unsupported by SDL2
return openGL;
}
} // namespace Platform
#endif

View File

@@ -66,4 +66,5 @@ namespace Platform
bool IsColourTerminalSupported();
bool HandleSpecialCommandLineArgument(const char* argument);
utf8* StrDecompToPrecomp(utf8* input);
bool RequireNewWindow(bool openGL);
} // namespace Platform