diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-09-02 02:11:07 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-09-02 02:11:07 +0300 |
commit | 7c251f07c2b3fdfe99be11ac59aa813b4f3437bb (patch) | |
tree | 8427406f76bc18e711f2be258a0bbf35a844021f /src/render/renderers.cpp | |
parent | 7dd01a95a1e7522cd3cb3bdda2e96a75770e2e55 (diff) | |
download | plus-7c251f07c2b3fdfe99be11ac59aa813b4f3437bb.tar.gz plus-7c251f07c2b3fdfe99be11ac59aa813b4f3437bb.tar.bz2 plus-7c251f07c2b3fdfe99be11ac59aa813b4f3437bb.tar.xz plus-7c251f07c2b3fdfe99be11ac59aa813b4f3437bb.zip |
improve render mode validation after reading from config.
Diffstat (limited to 'src/render/renderers.cpp')
-rw-r--r-- | src/render/renderers.cpp | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/src/render/renderers.cpp b/src/render/renderers.cpp index 97364f54a..dcabd0fbf 100644 --- a/src/render/renderers.cpp +++ b/src/render/renderers.cpp @@ -20,19 +20,43 @@ #include "render/renderers.h" -RenderType intToRenderType(const int mode) +static RenderType getDefault() { - if (mode < 0 || mode > RENDER_LAST) - { #ifdef USE_OPENGL #ifdef ANDROID - return RENDER_GLES_OPENGL; + return RENDER_GLES_OPENGL; #else - return RENDER_NORMAL_OPENGL; + return RENDER_NORMAL_OPENGL; #endif #else - return RENDER_SOFTWARE; + return RENDER_SOFTWARE; +#endif +} + +RenderType intToRenderType(const int mode) +{ + if (mode < 0 || mode >= RENDER_LAST) + return getDefault(); + + if (mode != RENDER_SOFTWARE +#if defined(USE_OPENGL) && defined(ANDROID) && defined(USE_SDL2) + && mode != RENDER_GLES_OPENGL && mode != RENDER_SDL2_DEFAULT) +#elif defined(USE_OPENGL) && defined(ANDROID) && !defined(USE_SDL2) + && mode != RENDER_GLES_OPENGL) +#elif defined(USE_OPENGL) && !defined(ANDROID) && defined(USE_SDL2) + && mode != RENDER_NORMAL_OPENGL && mode != RENDER_SAFE_OPENGL + && mode != RENDER_GLES_OPENGL && mode != RENDER_SDL2_DEFAULT) +#elif !defined(USE_OPENGL) && defined(USE_SDL2) + && mode != RENDER_SDL2_DEFAULT) +#elif !defined(USE_OPENGL) && !defined(USE_SDL2) + ) +#elif defined(USE_OPENGL) && !defined(ANDROID) && !defined(USE_SDL2) + && mode != RENDER_NORMAL_OPENGL && mode != RENDER_SAFE_OPENGL + && mode != RENDER_GLES_OPENGL) #endif + { + return getDefault(); } + return static_cast<RenderType>(mode); } |