aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorThierry Crozat2016-10-16 18:42:40 +0100
committerGitHub2016-10-16 18:42:40 +0100
commit5151bd99dd8bc342a1367c558892d5486826941c (patch)
tree290e6458cbfc728f5415cff213dc813913f17bc9 /engines
parentabc4656cc00f11091210213058a883718442b7b7 (diff)
parentaa39a6ce4b2285d1308eb4607bdd53d317304661 (diff)
downloadscummvm-rg350-5151bd99dd8bc342a1367c558892d5486826941c.tar.gz
scummvm-rg350-5151bd99dd8bc342a1367c558892d5486826941c.tar.bz2
scummvm-rg350-5151bd99dd8bc342a1367c558892d5486826941c.zip
Merge pull request #847 from criezy/sdl-filtering
Add graphics linear filtering feature
Diffstat (limited to 'engines')
-rw-r--r--engines/engine.cpp11
-rw-r--r--engines/testbed/graphics.cpp101
-rw-r--r--engines/testbed/graphics.h1
3 files changed, 112 insertions, 1 deletions
diff --git a/engines/engine.cpp b/engines/engine.cpp
index 68d9e8fde6..aac9c8c717 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -223,7 +223,7 @@ void initCommonGFX(bool defaultTo1XScaler) {
g_system->setGraphicsMode(gfxMode.c_str());
// HACK: For OpenGL modes, we will still honor the graphics scale override
- if (defaultTo1XScaler && (gfxMode.equalsIgnoreCase("opengl_linear") || gfxMode.equalsIgnoreCase("opengl_nearest")))
+ if (defaultTo1XScaler && gfxMode.equalsIgnoreCase("opengl"))
g_system->resetGraphicsScale();
}
}
@@ -242,6 +242,10 @@ void initCommonGFX(bool defaultTo1XScaler) {
// (De)activate fullscreen mode as determined by the config settings
if (gameDomain && gameDomain->contains("fullscreen"))
g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen"));
+
+ // (De)activate filtering mode as determined by the config settings
+ if (gameDomain && gameDomain->contains("filtering"))
+ g_system->setFeatureState(OSystem::kFeatureFilteringMode, ConfMan.getBool("filtering"));
}
// Please leave the splash screen in working order for your releases, even if they're commercial.
@@ -364,6 +368,11 @@ void initGraphics(int width, int height, bool defaultTo1xScaler, const Graphics:
GUI::MessageDialog dialog(_("Could not apply fullscreen setting."));
dialog.runModal();
}
+
+ if (gfxError & OSystem::kTransactionFilteringFailed) {
+ GUI::MessageDialog dialog(_("Could not apply filtering setting."));
+ dialog.runModal();
+ }
}
diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp
index e774008560..1b5af76ee7 100644
--- a/engines/testbed/graphics.cpp
+++ b/engines/testbed/graphics.cpp
@@ -56,6 +56,7 @@ GFXTestSuite::GFXTestSuite() {
// GFX Transcations
addTest("FullScreenMode", &GFXtests::fullScreenMode);
+ addTest("FilteringMode", &GFXtests::filteringMode);
addTest("AspectRatio", &GFXtests::aspectRatio);
addTest("IconifyingWindow", &GFXtests::iconifyWindow);
@@ -502,6 +503,106 @@ TestExitStatus GFXtests::fullScreenMode() {
}
/**
+ * Tests the filtering mode by: toggling between filtered and non-filtered modes.
+ */
+TestExitStatus GFXtests::filteringMode() {
+ Testsuite::clearScreen();
+ Common::String info = "Filtering test. Here you should expect a toggle between filtered and non-filtered states depending "
+ "upon your initial state.";
+
+ Common::Point pt(0, 100);
+ Testsuite::writeOnScreen("Testing filtering mode", pt);
+
+ if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
+ Testsuite::logPrintf("Info! Skipping test : FilteringMode\n");
+ return kTestSkipped;
+ }
+
+ bool isFeaturePresent;
+ bool isFeatureEnabled;
+ TestExitStatus passed = kTestPassed;
+ Common::String prompt;
+ OptionSelected shouldSelect;
+
+ isFeaturePresent = g_system->hasFeature(OSystem::kFeatureFilteringMode);
+
+ if (isFeaturePresent) {
+ // Toggle
+ isFeatureEnabled = g_system->getFeatureState(OSystem::kFeatureFilteringMode);
+ shouldSelect = isFeatureEnabled ? kOptionLeft : kOptionRight;
+
+ // Do test in fullscreen if possible as filtering may have no effect in windowed mode
+ bool fullScreenToggled = false;
+ if (g_system->hasFeature(OSystem::kFeatureFullscreenMode) && !g_system->getFeatureState(OSystem::kFeatureFullscreenMode)) {
+ fullScreenToggled = true;
+ g_system->beginGFXTransaction();
+ g_system->setFeatureState(OSystem::kFeatureFullscreenMode, true);
+ g_system->endGFXTransaction();
+ }
+
+ g_system->delayMillis(1000);
+
+ if (isFeatureEnabled) {
+ Testsuite::logDetailedPrintf("Current Mode is Filtered\n");
+ } else {
+ Testsuite::logDetailedPrintf("Current Mode is Unfiltered\n");
+ }
+
+ prompt = " Which mode do you see currently ? ";
+
+ if (!Testsuite::handleInteractiveInput(prompt, "Filtered", "Unfiltered", shouldSelect)) {
+ // User selected incorrect current state
+ passed = kTestFailed;
+ Testsuite::logDetailedPrintf("g_system->getFeatureState() failed\n");
+ }
+
+ g_system->beginGFXTransaction();
+ g_system->setFeatureState(OSystem::kFeatureFilteringMode, !isFeatureEnabled);
+ g_system->endGFXTransaction();
+
+ // Current state should be now !isFeatureEnabled
+ isFeatureEnabled = g_system->getFeatureState(OSystem::kFeatureFilteringMode);
+ shouldSelect = isFeatureEnabled ? kOptionLeft : kOptionRight;
+
+ g_system->delayMillis(1000);
+
+ prompt = " Which mode do you see now ? ";
+
+ if (!Testsuite::handleInteractiveInput(prompt, "Filtered", "Unfiltered", shouldSelect)) {
+ // User selected incorrect mode
+ passed = kTestFailed;
+ Testsuite::logDetailedPrintf("g_system->setFeatureState() failed\n");
+ }
+
+ g_system->beginGFXTransaction();
+ g_system->setFeatureState(OSystem::kFeatureFilteringMode, !isFeatureEnabled);
+ g_system->endGFXTransaction();
+
+ g_system->delayMillis(1000);
+
+ prompt = "This should be your initial state. Is it?";
+
+ if (!Testsuite::handleInteractiveInput(prompt, "Yes, it is", "Nopes", kOptionLeft)) {
+ // User selected incorrect mode
+ Testsuite::logDetailedPrintf("switching back to initial state failed\n");
+ passed = kTestFailed;
+ }
+
+ // Restore fullscreen state
+ if (fullScreenToggled) {
+ g_system->beginGFXTransaction();
+ g_system->setFeatureState(OSystem::kFeatureFullscreenMode, false);
+ g_system->endGFXTransaction();
+ }
+
+ } else {
+ Testsuite::displayMessage("feature not supported");
+ }
+
+ return passed;
+}
+
+/**
* Tests the aspect ratio correction by: drawing an ellipse, when corrected the ellipse should render to a circle
*/
TestExitStatus GFXtests::aspectRatio() {
diff --git a/engines/testbed/graphics.h b/engines/testbed/graphics.h
index ebb7b40be8..9cbf6b23ae 100644
--- a/engines/testbed/graphics.h
+++ b/engines/testbed/graphics.h
@@ -41,6 +41,7 @@ Common::Rect drawCursor(bool cursorPaletteDisabled = false, int cursorTargetScal
// will contain function declarations for GFX tests
TestExitStatus cursorTrails();
TestExitStatus fullScreenMode();
+TestExitStatus filteringMode();
TestExitStatus aspectRatio();
TestExitStatus palettizedCursors();
TestExitStatus mouseMovements();