From 7d52a82733acb8f9e328392d8b4c3aef22cf3d96 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 9 Aug 2011 03:46:04 +0300 Subject: Add new perfomance parameters. --- src/compoundsprite.cpp | 32 +++++++++++++++++++++++--------- src/compoundsprite.h | 4 ++++ src/defaults.cpp | 3 +++ src/gui/setup_video.cpp | 4 ---- 4 files changed, 30 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/compoundsprite.cpp b/src/compoundsprite.cpp index 1642416ea..99fae4f88 100644 --- a/src/compoundsprite.cpp +++ b/src/compoundsprite.cpp @@ -21,6 +21,7 @@ #include "compoundsprite.h" +#include "configuration.h" #include "game.h" #include "graphics.h" #ifdef USE_OPENGL @@ -52,6 +53,9 @@ CompoundSprite::CompoundSprite(): mNeedsRedraw(false) { mAlpha = 1.0f; + mEnableAlphaFix = config.getBoolValue("enableAlphaFix"); + mDisableAdvBeingCaching = config.getBoolValue("disableAdvBeingCaching"); + mDisableBeingCaching = config.getBoolValue("disableBeingCaching"); } CompoundSprite::~CompoundSprite() @@ -406,7 +410,7 @@ void CompoundSprite::setAlpha(float alpha) { if (alpha != mAlpha) { - if (Image::mUseOpenGL == 0 && size() > 3) + if (mEnableAlphaFix && Image::mUseOpenGL == 0 && size() > 3) { SpriteConstIterator it, it_end; for (it = begin(), it_end = end(); it != it_end; ++ it) @@ -426,18 +430,28 @@ void CompoundSprite::updateImages() const return; #endif - if (size() <= 3) - return; - mNeedsRedraw = false; - if (updateFromCache()) - return; + if (!mDisableBeingCaching) + { + if (size() <= 3) + return; + + if (!mDisableAdvBeingCaching) + { + if (updateFromCache()) + return; - redraw(); + redraw(); - if (mImage) - initCurrentCacheItem(); + if (mImage) + initCurrentCacheItem(); + } + else + { + redraw(); + } + } } bool CompoundSprite::updateFromCache() const diff --git a/src/compoundsprite.h b/src/compoundsprite.h index 0841bcfb8..2211cb80c 100644 --- a/src/compoundsprite.h +++ b/src/compoundsprite.h @@ -135,6 +135,10 @@ private: mutable int mOffsetX, mOffsetY; mutable bool mNeedsRedraw; + + bool mEnableAlphaFix; + bool mDisableAdvBeingCaching; + bool mDisableBeingCaching; }; #endif // COMPOUNDSPRITE_H diff --git a/src/defaults.cpp b/src/defaults.cpp index 7b5f5255a..f779d4111 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -210,6 +210,9 @@ DefaultsData* getConfigDefaults() AddDEF(configData, "showPlayersStatus", true); AddDEF(configData, "beingopacity", false); AddDEF(configData, "adjustPerfomance", true); + AddDEF(configData, "enableAlphaFix", false); + AddDEF(configData, "disableAdvBeingCaching", false); + AddDEF(configData, "disableBeingCaching", false); return configData; } diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index d73a9e1bb..046e8e7a7 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -709,10 +709,6 @@ void Setup_Video::action(const gcn::ActionEvent &event) mAltFpsSlider->setValue(mAltFps); mAltFpsSlider->setEnabled(mAltFps > 0); } - else if (id == "opengl") - { - bool isSoftware = (mOpenGLDropDown->getSelected() == 0); - } } void Setup_Video::externalUpdated() -- cgit v1.2.3-60-g2f50