mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-06 10:17:14 +00:00
OPENGL: Implement cursor scaling
This commit is contained in:
parent
267f1f18fb
commit
2db20b702e
@ -763,6 +763,8 @@ void OpenGLGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int
|
||||
_cursorDontScale = dontScale;
|
||||
|
||||
if (!w || !h) {
|
||||
if (_cursor)
|
||||
_cursor->unloadScaler();
|
||||
delete _cursor;
|
||||
_cursor = nullptr;
|
||||
return;
|
||||
@ -781,9 +783,17 @@ void OpenGLGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int
|
||||
|
||||
// In case the color format has changed we will need to create the texture.
|
||||
if (!_cursor || _cursor->getFormat() != inputFormat) {
|
||||
if (_cursor)
|
||||
_cursor->unloadScaler();
|
||||
delete _cursor;
|
||||
_cursor = nullptr;
|
||||
|
||||
#ifdef USE_SCALERS
|
||||
bool wantScaler = (_currentState.scaleFactor > 1) && !dontScale
|
||||
&& _scalerPlugins[_currentState.scalerIndex]->get<ScalerPluginObject>().canDrawCursor();
|
||||
#else
|
||||
bool wantScaler = false;
|
||||
#endif
|
||||
GLenum glIntFormat, glFormat, glType;
|
||||
|
||||
Graphics::PixelFormat textureFormat;
|
||||
@ -798,10 +808,14 @@ void OpenGLGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int
|
||||
} else {
|
||||
textureFormat = _defaultFormatAlpha;
|
||||
}
|
||||
// TODO: Enable SW scaling for cursors
|
||||
_cursor = createSurface(textureFormat, true);
|
||||
_cursor = createSurface(textureFormat, false, wantScaler);
|
||||
assert(_cursor);
|
||||
_cursor->enableLinearFiltering(_currentState.filtering);
|
||||
#ifdef USE_SCALERS
|
||||
if (wantScaler) {
|
||||
_cursor->setScaler(_currentState.scalerIndex, _currentState.scaleFactor);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
_cursor->allocate(w, h);
|
||||
|
Loading…
x
Reference in New Issue
Block a user