aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorAlejandro Marzini2010-06-08 23:44:05 +0000
committerAlejandro Marzini2010-06-08 23:44:05 +0000
commit4fe0b4e1ad9d44f65cc6c144f1998cbc17913797 (patch)
treef28ed7d8d72fb11957e2b8809128d164b43d879e /backends
parent7ea78b10364d34ae607a9a1da00e4d42ad691aa1 (diff)
downloadscummvm-rg350-4fe0b4e1ad9d44f65cc6c144f1998cbc17913797.tar.gz
scummvm-rg350-4fe0b4e1ad9d44f65cc6c144f1998cbc17913797.tar.bz2
scummvm-rg350-4fe0b4e1ad9d44f65cc6c144f1998cbc17913797.zip
Renamed and moved DefaultGraphicsManager to NullGraphicsManager. Added pure virtual class GraphicsManager.
svn-id: r49528
Diffstat (limited to 'backends')
-rw-r--r--backends/graphics/abstract-graphics.h70
-rw-r--r--backends/graphics/default/default-graphics.cpp40
-rw-r--r--backends/graphics/null/null-graphics.h (renamed from backends/graphics/default/default-graphics.h)25
-rw-r--r--backends/graphics/sdl/sdl-graphics.cpp9
-rw-r--r--backends/graphics/sdl/sdl-graphics.h5
-rw-r--r--backends/module.mk1
6 files changed, 92 insertions, 58 deletions
diff --git a/backends/graphics/abstract-graphics.h b/backends/graphics/abstract-graphics.h
new file mode 100644
index 0000000000..c38f66c9ed
--- /dev/null
+++ b/backends/graphics/abstract-graphics.h
@@ -0,0 +1,70 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef BACKENDS_GRAPHICS_ABSTRACT_H
+#define BACKENDS_GRAPHICS_ABSTRACT_H
+
+#include "common/system.h"
+#include "common/noncopyable.h"
+
+class GraphicsManager : Common::NonCopyable {
+public:
+ virtual ~GraphicsManager() {}
+
+ virtual bool hasFeature(OSystem::Feature f) = 0;
+ virtual void setFeatureState(OSystem::Feature f, bool enable) = 0;
+ virtual bool getFeatureState(OSystem::Feature f) = 0;
+
+ virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const = 0;
+ virtual int getDefaultGraphicsMode() const = 0;
+ virtual bool setGraphicsMode(int mode) = 0;
+ virtual int getGraphicsMode() const = 0;
+ virtual Graphics::PixelFormat getScreenFormat() const = 0;
+ virtual Common::List<Graphics::PixelFormat> getSupportedFormats() = 0;
+ virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = NULL) = 0;
+ virtual int16 getHeight() = 0;
+ virtual int16 getWidth() = 0;
+ virtual void setPalette(const byte *colors, uint start, uint num) = 0;
+ virtual void grabPalette(byte *colors, uint start, uint num) = 0;
+ virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) = 0;
+ virtual Graphics::Surface *lockScreen() = 0;
+ virtual void unlockScreen() = 0;
+ virtual void fillScreen(uint32 col) = 0;
+ virtual void updateScreen() = 0;
+ virtual void setShakePos(int shakeOffset) = 0;
+ virtual void showOverlay() = 0;
+ virtual void hideOverlay() = 0;
+ virtual Graphics::PixelFormat getOverlayFormat() const = 0;
+ virtual void clearOverlay() = 0;
+ virtual void grabOverlay(OverlayColor *buf, int pitch) = 0;
+ virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h)= 0;
+ virtual int16 getOverlayHeight() = 0;
+ virtual int16 getOverlayWidth() = 0;
+ virtual bool showMouse(bool visible) = 0;
+ virtual void warpMouse(int x, int y) = 0;
+ virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL) = 0;
+};
+
+#endif
diff --git a/backends/graphics/default/default-graphics.cpp b/backends/graphics/default/default-graphics.cpp
deleted file mode 100644
index 9683eff9ac..0000000000
--- a/backends/graphics/default/default-graphics.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "backends/graphics/default/default-graphics.h"
-
-bool DefaultGraphicsManager::hasGraphicsFeature(OSystem::Feature f) {
- return false;
-}
-
-bool DefaultGraphicsManager::getGraphicsFeatureState(OSystem::Feature f) {
- return false;
-}
-
-static const OSystem::GraphicsMode s_noGraphicsModes[] = { {0, 0, 0} };
-
-const OSystem::GraphicsMode *DefaultGraphicsManager::getSupportedGraphicsModes() {
- return s_noGraphicsModes;
-}
diff --git a/backends/graphics/default/default-graphics.h b/backends/graphics/null/null-graphics.h
index 9e1593f0eb..8423f4f5da 100644
--- a/backends/graphics/default/default-graphics.h
+++ b/backends/graphics/null/null-graphics.h
@@ -23,22 +23,22 @@
*
*/
-#ifndef BACKENDS_GRAPHICS_DEFAULT_H
-#define BACKENDS_GRAPHICS_DEFAULT_H
+#ifndef BACKENDS_GRAPHICS_NULL_H
+#define BACKENDS_GRAPHICS_NULL_H
-#include "common/system.h"
-#include "common/noncopyable.h"
+#include "backends/graphics/abstract-graphics.h"
-class DefaultGraphicsManager : Common::NonCopyable {
+static const OSystem::GraphicsMode s_noGraphicsModes[] = { {0, 0, 0} };
+
+class NullGraphicsManager : GraphicsManager {
public:
- DefaultGraphicsManager() {}
- ~DefaultGraphicsManager() {}
+ ~NullGraphicsManager() {}
- bool hasGraphicsFeature(OSystem::Feature f);
- void setGraphicsFeatureState(OSystem::Feature f, bool enable) {}
- bool getGraphicsFeatureState(OSystem::Feature f);
+ bool hasFeature(OSystem::Feature f) { return false; }
+ void setFeatureState(OSystem::Feature f, bool enable) {}
+ bool getFeatureState(OSystem::Feature f) { return false; }
- const OSystem::GraphicsMode *getSupportedGraphicsModes();
+ const OSystem::GraphicsMode *getSupportedGraphicsModes() { return s_noGraphicsModes; }
int getDefaultGraphicsMode() { return 0; }
bool setGraphicsMode(int mode) { return true; }
int getGraphicsMode() { return 0; }
@@ -69,10 +69,9 @@ public:
void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {}
int16 getOverlayHeight() { return 0; }
int16 getOverlayWidth() { return 0; }
- bool showMouse(bool visible) {}
+ bool showMouse(bool visible) { return !visible; }
void warpMouse(int x, int y) {}
void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL) {}
};
-
#endif
diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp
index 5276cbbf30..8fc2ef6f08 100644
--- a/backends/graphics/sdl/sdl-graphics.cpp
+++ b/backends/graphics/sdl/sdl-graphics.cpp
@@ -1193,6 +1193,13 @@ void SdlGraphicsManager::unlockScreen() {
g_system->unlockMutex(_graphicsMutex);
}
+void SdlGraphicsManager::fillScreen(uint32 col) {
+ Graphics::Surface *screen = lockScreen();
+ if (screen && screen->pixels)
+ memset(screen->pixels, col, screen->h * screen->pitch);
+ unlockScreen();
+}
+
void SdlGraphicsManager::addDirtyRect(int x, int y, int w, int h, bool realCoordinates) {
if (_forceFull)
return;
@@ -1966,7 +1973,7 @@ bool SdlGraphicsManager::handleScalerHotkeys(const SDL_KeyboardEvent &key) {
// Ctrl-Alt-a toggles aspect ratio correction
if (key.keysym.sym == 'a') {
beginGFXTransaction();
- setGraphicsFeatureState(OSystem::kFeatureAspectRatioCorrection, !_videoMode.aspectRatioCorrection);
+ setFeatureState(OSystem::kFeatureAspectRatioCorrection, !_videoMode.aspectRatioCorrection);
endGFXTransaction();
#ifdef USE_OSD
char buffer[128];
diff --git a/backends/graphics/sdl/sdl-graphics.h b/backends/graphics/sdl/sdl-graphics.h
index 13ce5af5dc..650b01794b 100644
--- a/backends/graphics/sdl/sdl-graphics.h
+++ b/backends/graphics/sdl/sdl-graphics.h
@@ -26,7 +26,7 @@
#ifndef BACKENDS_GRAPHICS_SDL_H
#define BACKENDS_GRAPHICS_SDL_H
-#include "backends/graphics/default/default-graphics.h"
+#include "backends/graphics/abstract-graphics.h"
#include "common/system.h"
#include "graphics/scaler.h"
@@ -68,7 +68,7 @@ public:
int kh() const { return _kh; }
};
-class SdlGraphicsManager : public DefaultGraphicsManager {
+class SdlGraphicsManager : public GraphicsManager {
public:
SdlGraphicsManager();
~SdlGraphicsManager();
@@ -306,5 +306,4 @@ protected:
int effectiveScreenHeight() const;
};
-
#endif
diff --git a/backends/module.mk b/backends/module.mk
index a76dca2702..4b725bb16a 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -17,7 +17,6 @@ MODULE_OBJS := \
fs/wii/wii-fs-factory.o \
fs/n64/n64-fs-factory.o \
fs/n64/romfsstream.o \
- graphics/default/default-graphics.o \
graphics/sdl/sdl-graphics.o \
keymapper/action.o \
keymapper/keymap.o \