OPENGL: Add support for filtering feature
This replaces the two graphics modes "OpenGL (No filtering)" and "OpenGL". Now there is a single "OpenGL" mode and filtering is controlled by the kFeatureFilteringMode.
This commit is contained in:
parent
3e08c33c35
commit
c6ce1c8002
2 changed files with 32 additions and 20 deletions
|
@ -82,6 +82,7 @@ bool OpenGLGraphicsManager::hasFeature(OSystem::Feature f) {
|
|||
switch (f) {
|
||||
case OSystem::kFeatureAspectRatioCorrection:
|
||||
case OSystem::kFeatureCursorPalette:
|
||||
case OSystem::kFeatureFilteringMode:
|
||||
return true;
|
||||
|
||||
case OSystem::kFeatureOverlaySupportsAlpha:
|
||||
|
@ -99,6 +100,20 @@ void OpenGLGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
|
|||
_currentState.aspectRatioCorrection = enable;
|
||||
break;
|
||||
|
||||
case OSystem::kFeatureFilteringMode:
|
||||
assert(_transactionMode != kTransactionNone);
|
||||
_currentState.filtering = enable;
|
||||
|
||||
if (_gameScreen) {
|
||||
_gameScreen->enableLinearFiltering(enable);
|
||||
}
|
||||
|
||||
if (_cursor) {
|
||||
_cursor->enableLinearFiltering(enable);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OSystem::kFeatureCursorPalette:
|
||||
_cursorPaletteEnabled = enable;
|
||||
updateCursorPalette();
|
||||
|
@ -114,6 +129,9 @@ bool OpenGLGraphicsManager::getFeatureState(OSystem::Feature f) {
|
|||
case OSystem::kFeatureAspectRatioCorrection:
|
||||
return _currentState.aspectRatioCorrection;
|
||||
|
||||
case OSystem::kFeatureFilteringMode:
|
||||
return _currentState.filtering;
|
||||
|
||||
case OSystem::kFeatureCursorPalette:
|
||||
return _cursorPaletteEnabled;
|
||||
|
||||
|
@ -125,8 +143,7 @@ bool OpenGLGraphicsManager::getFeatureState(OSystem::Feature f) {
|
|||
namespace {
|
||||
|
||||
const OSystem::GraphicsMode glGraphicsModes[] = {
|
||||
{ "opengl_linear", _s("OpenGL"), GFX_LINEAR },
|
||||
{ "opengl_nearest", _s("OpenGL (No filtering)"), GFX_NEAREST },
|
||||
{ "opengl", _s("OpenGL"), GFX_OPENGL },
|
||||
{ nullptr, nullptr, 0 }
|
||||
};
|
||||
|
||||
|
@ -137,25 +154,15 @@ const OSystem::GraphicsMode *OpenGLGraphicsManager::getSupportedGraphicsModes()
|
|||
}
|
||||
|
||||
int OpenGLGraphicsManager::getDefaultGraphicsMode() const {
|
||||
return GFX_LINEAR;
|
||||
return GFX_OPENGL;
|
||||
}
|
||||
|
||||
bool OpenGLGraphicsManager::setGraphicsMode(int mode) {
|
||||
assert(_transactionMode != kTransactionNone);
|
||||
|
||||
switch (mode) {
|
||||
case GFX_LINEAR:
|
||||
case GFX_NEAREST:
|
||||
case GFX_OPENGL:
|
||||
_currentState.graphicsMode = mode;
|
||||
|
||||
if (_gameScreen) {
|
||||
_gameScreen->enableLinearFiltering(mode == GFX_LINEAR);
|
||||
}
|
||||
|
||||
if (_cursor) {
|
||||
_cursor->enableLinearFiltering(mode == GFX_LINEAR);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
@ -250,6 +257,10 @@ OSystem::TransactionError OpenGLGraphicsManager::endGFXTransaction() {
|
|||
transactionError |= OSystem::kTransactionModeSwitchFailed;
|
||||
}
|
||||
|
||||
if (_oldState.filtering != _currentState.filtering) {
|
||||
transactionError |= OSystem::kTransactionFilteringFailed;
|
||||
}
|
||||
|
||||
// Roll back to the old state.
|
||||
_currentState = _oldState;
|
||||
_transactionMode = kTransactionRollback;
|
||||
|
@ -286,7 +297,7 @@ OSystem::TransactionError OpenGLGraphicsManager::endGFXTransaction() {
|
|||
}
|
||||
|
||||
_gameScreen->allocate(_currentState.gameWidth, _currentState.gameHeight);
|
||||
_gameScreen->enableLinearFiltering(_currentState.graphicsMode == GFX_LINEAR);
|
||||
_gameScreen->enableLinearFiltering(_currentState.filtering);
|
||||
// We fill the screen to all black or index 0 for CLUT8.
|
||||
#ifdef USE_RGB_COLOR
|
||||
if (_currentState.gameFormat.bytesPerPixel == 1) {
|
||||
|
@ -660,7 +671,7 @@ void OpenGLGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int
|
|||
}
|
||||
_cursor = createSurface(textureFormat, true);
|
||||
assert(_cursor);
|
||||
_cursor->enableLinearFiltering(_currentState.graphicsMode == GFX_LINEAR);
|
||||
_cursor->enableLinearFiltering(_currentState.filtering);
|
||||
}
|
||||
|
||||
_cursorKeyColor = keycolor;
|
||||
|
|
|
@ -50,8 +50,7 @@ class Shader;
|
|||
#endif
|
||||
|
||||
enum {
|
||||
GFX_LINEAR = 0,
|
||||
GFX_NEAREST = 1
|
||||
GFX_OPENGL = 0
|
||||
};
|
||||
|
||||
class OpenGLGraphicsManager : virtual public GraphicsManager {
|
||||
|
@ -213,7 +212,7 @@ private:
|
|||
#ifdef USE_RGB_COLOR
|
||||
gameFormat(),
|
||||
#endif
|
||||
aspectRatioCorrection(false), graphicsMode(GFX_LINEAR) {
|
||||
aspectRatioCorrection(false), graphicsMode(GFX_OPENGL), filtering(true) {
|
||||
}
|
||||
|
||||
bool valid;
|
||||
|
@ -224,6 +223,7 @@ private:
|
|||
#endif
|
||||
bool aspectRatioCorrection;
|
||||
int graphicsMode;
|
||||
bool filtering;
|
||||
|
||||
bool operator==(const VideoState &right) {
|
||||
return gameWidth == right.gameWidth && gameHeight == right.gameHeight
|
||||
|
@ -231,7 +231,8 @@ private:
|
|||
&& gameFormat == right.gameFormat
|
||||
#endif
|
||||
&& aspectRatioCorrection == right.aspectRatioCorrection
|
||||
&& graphicsMode == right.graphicsMode;
|
||||
&& graphicsMode == right.graphicsMode
|
||||
&& filtering == right.filtering;
|
||||
}
|
||||
|
||||
bool operator!=(const VideoState &right) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue