[Scummvm-cvs-logs] SF.net SVN: scummvm:[54830] scummvm/trunk/backends/graphics/opengl
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Wed Dec 8 02:53:21 CET 2010
Revision: 54830
http://scummvm.svn.sourceforge.net/scummvm/?rev=54830&view=rev
Author: lordhoto
Date: 2010-12-08 01:53:20 +0000 (Wed, 08 Dec 2010)
Log Message:
-----------
OPENGL: Fix OSD support by only updating the OSD texture in internUpdateScreen.
This actually still has the drawback that if one calls OSystem::updateScreen
from the sound thread that it might crash. Hopefully no code does this though...
Modified Paths:
--------------
scummvm/trunk/backends/graphics/opengl/opengl-graphics.cpp
scummvm/trunk/backends/graphics/opengl/opengl-graphics.h
Modified: scummvm/trunk/backends/graphics/opengl/opengl-graphics.cpp
===================================================================
--- scummvm/trunk/backends/graphics/opengl/opengl-graphics.cpp 2010-12-08 01:35:54 UTC (rev 54829)
+++ scummvm/trunk/backends/graphics/opengl/opengl-graphics.cpp 2010-12-08 01:53:20 UTC (rev 54830)
@@ -39,7 +39,7 @@
OpenGLGraphicsManager::OpenGLGraphicsManager()
:
#ifdef USE_OSD
- _osdTexture(0), _osdAlpha(0), _osdFadeStartTime(0),
+ _osdTexture(0), _osdAlpha(0), _osdFadeStartTime(0), _requireOSDUpdate(false),
#endif
_gameTexture(0), _overlayTexture(0), _cursorTexture(0),
_screenChangeCount(1 << (sizeof(int) * 8 - 2)), _screenNeedsRedraw(false),
@@ -596,26 +596,7 @@
//
void OpenGLGraphicsManager::displayMessageOnOSD(const char *msg) {
- // TODO: Fix OSD support.
- //
- // Actually we have nice OSD support for the OpenGL backend, but
- // since the OpenGL context/resources are not shared between threads we
- // can not use this here.
- //
- // A possible way of making the code crash hard is to use the MT-32 emu.
- // Whenever there is some message send to the OSD from the emulator's
- // sound thread the glBindTexture call inside _osdTexture->updateBuffer
- // will result in a crash.
- //
- // To try it out just uncomment the below code and start up any game which
- // prints some info on the MT-32 display. Whenever the message should be
- // displayed it will crash hard.
- //
- // We can not even use a GUI dialog here, since that would also result in
- // an change of the overlay surface and thus result in the same problem
- // just in another place.
- warning("OpenGL: OSD messsage \"%s\" suppressed", msg);
- /*assert(_transactionMode == kTransactionNone);
+ assert(_transactionMode == kTransactionNone);
assert(msg);
// The font we are going to use:
@@ -674,13 +655,12 @@
0xFFFF, Graphics::kTextAlignCenter);
}
- // Update the texture
- _osdTexture->updateBuffer(_osdSurface.pixels, _osdSurface.pitch, 0, 0,
- _osdSurface.w, _osdSurface.h);
+ // Request update of the texture
+ _requireOSDUpdate = true;
// Init the OSD display parameters, and the fade out
_osdAlpha = kOSDInitialAlpha;
- _osdFadeStartTime = g_system->getMillis() + kOSDFadeOutDelay;*/
+ _osdFadeStartTime = g_system->getMillis() + kOSDFadeOutDelay;
}
//
@@ -1009,6 +989,13 @@
#ifdef USE_OSD
if (_osdAlpha > 0) {
+ if (_requireOSDUpdate) {
+ // Update the texture
+ _osdTexture->updateBuffer(_osdSurface.pixels, _osdSurface.pitch, 0, 0,
+ _osdSurface.w, _osdSurface.h);
+ _requireOSDUpdate = false;
+ }
+
// Update alpha value
const int diff = g_system->getMillis() - _osdFadeStartTime;
if (diff > 0) {
Modified: scummvm/trunk/backends/graphics/opengl/opengl-graphics.h
===================================================================
--- scummvm/trunk/backends/graphics/opengl/opengl-graphics.h 2010-12-08 01:35:54 UTC (rev 54829)
+++ scummvm/trunk/backends/graphics/opengl/opengl-graphics.h 2010-12-08 01:53:20 UTC (rev 54830)
@@ -282,6 +282,7 @@
Graphics::Surface _osdSurface;
uint8 _osdAlpha;
uint32 _osdFadeStartTime;
+ bool _requireOSDUpdate;
enum {
kOSDFadeOutDelay = 2 * 1000,
kOSDFadeOutDuration = 500,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list