summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-09-02 21:02:34 +0300
committerAndrei Karas <akaras@inbox.ru>2013-09-02 21:02:34 +0300
commit370cb1fa897604e5d7bf9543881afad80f45f3ba (patch)
tree66ea88a44010ebeb13ec6258b37b9a93e04c909d /src
parent1d843dd814f92004efbb4574be0d898d4edf6359 (diff)
downloadmv-370cb1fa897604e5d7bf9543881afad80f45f3ba.tar.gz
mv-370cb1fa897604e5d7bf9543881afad80f45f3ba.tar.bz2
mv-370cb1fa897604e5d7bf9543881afad80f45f3ba.tar.xz
mv-370cb1fa897604e5d7bf9543881afad80f45f3ba.zip
dehardcode some mode render mode constans usage.
Diffstat (limited to 'src')
-rw-r--r--src/gui/equipmentwindow.cpp2
-rw-r--r--src/gui/widgets/button.cpp2
-rw-r--r--src/gui/widgets/popup.cpp2
-rw-r--r--src/gui/widgets/progressbar.cpp2
-rw-r--r--src/gui/widgets/scrollarea.cpp4
-rw-r--r--src/gui/widgets/shortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/tab.cpp2
-rw-r--r--src/gui/widgets/window.cpp2
-rw-r--r--src/map.cpp10
-rw-r--r--src/test/testmain.cpp16
-rw-r--r--src/test/testmain.h4
-rw-r--r--src/touchmanager.cpp4
12 files changed, 27 insertions, 25 deletions
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index af010a2d6..8e51dae72 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -161,7 +161,7 @@ void EquipmentWindow::draw(gcn::Graphics *graphics)
gcn::Font *const font = getFont();
const int fontHeight = font->getHeight();
- if (openGLMode != 2)
+ if (openGLMode != RENDER_SAFE_OPENGL)
{
if (mLastRedraw)
{
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 1fb4fa5e4..37213369d 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -431,7 +431,7 @@ void Button::draw(gcn::Graphics *graphics)
}
}
- if (openGLMode != 2)
+ if (openGLMode != RENDER_SAFE_OPENGL)
{
if (recalc)
{
diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp
index 438b5db29..e71e65c14 100644
--- a/src/gui/widgets/popup.cpp
+++ b/src/gui/widgets/popup.cpp
@@ -103,7 +103,7 @@ void Popup::draw(gcn::Graphics *graphics)
if (mSkin)
{
- if (openGLMode != 2)
+ if (openGLMode != RENDER_SAFE_OPENGL)
{
if (mRedraw)
{
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp
index dc1e02ac5..2c3b13354 100644
--- a/src/gui/widgets/progressbar.cpp
+++ b/src/gui/widgets/progressbar.cpp
@@ -180,7 +180,7 @@ void ProgressBar::render(Graphics *graphics)
if (!mSkin)
return;
- if (openGLMode != 2)
+ if (openGLMode != RENDER_SAFE_OPENGL)
{
if (mRedraw || graphics->getRedraw())
{
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index ec03e5cea..03466b90e 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -262,7 +262,7 @@ void ScrollArea::draw(gcn::Graphics *graphics)
BLOCK_START("ScrollArea::draw")
if (mVBarVisible || mHBarVisible)
{
- if (openGLMode != 2)
+ if (openGLMode != RENDER_SAFE_OPENGL)
{
if (!mOpaque)
updateCalcFlag(graphics);
@@ -363,7 +363,7 @@ void ScrollArea::drawFrame(gcn::Graphics *graphics)
updateCalcFlag(graphics);
- if (openGLMode != 2)
+ if (openGLMode != RENDER_SAFE_OPENGL)
{
if (mRedraw)
{
diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp
index ed3c32f04..9c651fce1 100644
--- a/src/gui/widgets/shortcutcontainer.cpp
+++ b/src/gui/widgets/shortcutcontainer.cpp
@@ -93,7 +93,7 @@ void ShortcutContainer::drawBackground(Graphics *g)
{
if (mBackgroundImg)
{
- if (openGLMode != 2)
+ if (openGLMode != RENDER_SAFE_OPENGL)
{
if (mRedraw)
{
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp
index ac91442fb..f1dc59c60 100644
--- a/src/gui/widgets/tab.cpp
+++ b/src/gui/widgets/tab.cpp
@@ -221,7 +221,7 @@ void Tab::draw(gcn::Graphics *graphics)
if (skin)
{
// draw tab
- if (openGLMode != 2)
+ if (openGLMode != RENDER_SAFE_OPENGL)
{
const ImageRect &rect = skin->getBorder();
if (mRedraw || mode != mMode || g->getRedraw())
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 7d6174311..fadd962c4 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -214,7 +214,7 @@ void Window::draw(gcn::Graphics *graphics)
Graphics *const g = static_cast<Graphics*>(graphics);
bool update = false;
- if (openGLMode != 2)
+ if (openGLMode != RENDER_SAFE_OPENGL)
{
if (mResizeHandles != mOldResizeHandles)
{
diff --git a/src/map.cpp b/src/map.cpp
index 388f2eccf..c28f45b71 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -384,7 +384,7 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY)
#ifdef USE_OPENGL
int updateFlag = 0;
- if (mOpenGL == 1 || mOpenGL == 3)
+ if (mOpenGL == RENDER_NORMAL_OPENGL || mOpenGL == RENDER_GLES_OPENGL)
{
if (mLastX != startX || mLastY != startY || mLastScrollX != scrollX
|| mLastScrollY != scrollY)
@@ -439,8 +439,8 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY)
else
{
#ifdef USE_OPENGL
-// if ((mOpenGL == 1 || mOpenGL == 3) && updateFlag != 2)
- if (mOpenGL == 1 || mOpenGL == 3)
+ if (mOpenGL == RENDER_NORMAL_OPENGL
+ || mOpenGL == RENDER_GLES_OPENGL)
{
if (updateFlag)
{
@@ -480,7 +480,7 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY)
{
if (Actor *const actor = *ai)
{
- if (!mOpenGL)
+ if (mOpenGL == RENDER_SOFTWARE)
{
const int x = actor->getTileX();
const int y = actor->getTileY();
@@ -1444,7 +1444,7 @@ void Map::reduce()
#ifdef USE_SDL2
return;
#else
- if (!mFringeLayer || mOpenGL > 0 ||
+ if (!mFringeLayer || mOpenGL != RENDER_SOFTWARE ||
!config.getBoolValue("enableMapReduce"))
{
return;
diff --git a/src/test/testmain.cpp b/src/test/testmain.cpp
index 3d4bdd33d..51747b60c 100644
--- a/src/test/testmain.cpp
+++ b/src/test/testmain.cpp
@@ -82,7 +82,7 @@ int TestMain::exec(const bool testAudio)
int fastOpenGLFps = 0;
int safeOpenGLFps = 0;
- int openGLMode = 0;
+ RenderType openGLMode = RENDER_SOFTWARE;
int detectMode = 0;
rescaleTest[0] = -1;
rescaleTest[1] = -1;
@@ -182,19 +182,19 @@ int TestMain::exec(const bool testAudio)
int maxFps = softFps;
if (maxFps < fastOpenGLFps)
{
- openGLMode = 1;
+ openGLMode = RENDER_NORMAL_OPENGL;
maxFps = fastOpenGLFps;
}
if (maxFps < safeOpenGLFps)
{
- openGLMode = 2;
+ openGLMode = RENDER_SAFE_OPENGL;
maxFps = safeOpenGLFps;
}
int batchSize = 256;
/*
// if OpenGL mode is fast mode we can try detect max batch sizes
- if (openGLMode == 1)
+ if (openGLMode == RENDER_NORMAL_OPENGL)
{
if (!invokeFastOpenBatchTest("11"))
batchSize = readValue2(11);
@@ -205,23 +205,23 @@ int TestMain::exec(const bool testAudio)
// if OpenGL implimentation is not good, disable it.
if (!(detectMode & 15))
- openGLMode = 0;
+ openGLMode = RENDER_SOFTWARE;
writeConfig(openGLMode, rescaleTest[openGLMode],
soundTest, info, batchSize, detectMode);
return 0;
}
-void TestMain::writeConfig(const int openGLMode, const int rescale,
+void TestMain::writeConfig(const RenderType openGLMode, const int rescale,
const int sound, const std::string &info,
const int batchSize A_UNUSED, const int detectMode)
{
mConfig.init(client->getConfigDirectory() + "/config.xml");
- log->log("set mode to %d", openGLMode);
+ log->log("set mode to %d", static_cast<int>(openGLMode));
// searched values
- mConfig.setValue("opengl", openGLMode);
+ mConfig.setValue("opengl", static_cast<int>(openGLMode));
mConfig.setValue("showBackground", !rescale);
mConfig.setValue("sound", !sound);
diff --git a/src/test/testmain.h b/src/test/testmain.h
index b0ad82e95..bcac222c0 100644
--- a/src/test/testmain.h
+++ b/src/test/testmain.h
@@ -25,6 +25,8 @@
#include "logger.h"
#include "main.h"
+#include "render/renderers.h"
+
#ifdef USE_OPENGL
#include <string>
@@ -66,7 +68,7 @@ class TestMain
void testsMain();
- void writeConfig(const int openGLMode, const int rescale,
+ void writeConfig(const RenderType openGLMode, const int rescale,
const int sound, const std::string &info,
const int batchSize, const int detectMode);
diff --git a/src/touchmanager.cpp b/src/touchmanager.cpp
index 38d0ca864..19dca23f9 100644
--- a/src/touchmanager.cpp
+++ b/src/touchmanager.cpp
@@ -35,7 +35,7 @@
TouchManager touchManager;
-extern int openGLMode;
+extern RenderType openGLMode;
TouchManager::TouchManager() :
mKeyboard(nullptr),
@@ -181,7 +181,7 @@ void TouchManager::clear()
void TouchManager::draw()
{
- if (openGLMode != 2)
+ if (openGLMode != RENDER_SAFE_OPENGL)
{
if (mRedraw)
{