aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/surfacesdl
diff options
context:
space:
mode:
authorJohannes Schickel2011-08-08 23:46:05 +0200
committerJohannes Schickel2011-08-09 00:03:11 +0200
commit0630a88a04e9688d664751b6a68edf622d76b348 (patch)
tree87d7867c298c60272eff69777b16bff5c15c8bfe /backends/graphics/surfacesdl
parentdedc74abfa44f7dac344da1868588193f91dd4f1 (diff)
downloadscummvm-rg350-0630a88a04e9688d664751b6a68edf622d76b348.tar.gz
scummvm-rg350-0630a88a04e9688d664751b6a68edf622d76b348.tar.bz2
scummvm-rg350-0630a88a04e9688d664751b6a68edf622d76b348.zip
SDL: Let SDL based graphics managers inherit from SdlGraphicsManager.
This also adapts port I can not test (not even the compilation). So if this breaks anything I am sorry about it.
Diffstat (limited to 'backends/graphics/surfacesdl')
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp20
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.h8
2 files changed, 26 insertions, 2 deletions
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 2d41ecead4..293fd9b188 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -122,7 +122,7 @@ static AspectRatio getDesiredAspectRatio() {
SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSource)
:
- _sdlEventSource(sdlEventSource),
+ SdlGraphicsManager(sdlEventSource), _sdlEventSource(sdlEventSource),
#ifdef USE_OSD
_osdSurface(0), _osdAlpha(SDL_ALPHA_TRANSPARENT), _osdFadeStartTime(0),
#endif
@@ -2324,4 +2324,22 @@ bool SurfaceSdlGraphicsManager::notifyEvent(const Common::Event &event) {
return false;
}
+void SurfaceSdlGraphicsManager::notifyVideoExpose() {
+ _forceFull = true;
+}
+
+void SurfaceSdlGraphicsManager::transformMouseCoordinates(Common::Point &point) {
+ if (!_overlayVisible) {
+ point.x /= _videoMode.scaleFactor;
+ point.y /= _videoMode.scaleFactor;
+ if (_videoMode.aspectRatioCorrection)
+ point.y = aspect2Real(point.y);
+ }
+}
+
+void SurfaceSdlGraphicsManager::notifyMousePos(Common::Point mouse) {
+ transformMouseCoordinates(mouse);
+ setMousePos(mouse.x, mouse.y);
+}
+
#endif
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index cd8710d443..3de59c79be 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -24,6 +24,7 @@
#define BACKENDS_GRAPHICS_SURFACESDL_GRAPHICS_H
#include "backends/graphics/graphics.h"
+#include "backends/graphics/sdl/sdl-graphics.h"
#include "graphics/pixelformat.h"
#include "graphics/scaler.h"
#include "common/events.h"
@@ -74,7 +75,7 @@ public:
/**
* SDL graphics manager
*/
-class SurfaceSdlGraphicsManager : public GraphicsManager, public Common::EventObserver {
+class SurfaceSdlGraphicsManager : public GraphicsManager, public SdlGraphicsManager, public Common::EventObserver {
public:
SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSource);
virtual ~SurfaceSdlGraphicsManager();
@@ -140,6 +141,11 @@ public:
// Override from Common::EventObserver
bool notifyEvent(const Common::Event &event);
+ // SdlGraphicsManager interface
+ virtual void notifyVideoExpose();
+ virtual void transformMouseCoordinates(Common::Point &point);
+ virtual void notifyMousePos(Common::Point mouse);
+
protected:
SdlEventSource *_sdlEventSource;