aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2009-02-15 21:20:21 +0000
committerJohannes Schickel2009-02-15 21:20:21 +0000
commit5417f6bacb73d5996b26229513c2ce01db27bf6a (patch)
treeec7298416ce8f3ca657b1637352763178752852c
parente29d90be3e2213313c2884d80656198d8fed65ef (diff)
downloadscummvm-rg350-5417f6bacb73d5996b26229513c2ce01db27bf6a.tar.gz
scummvm-rg350-5417f6bacb73d5996b26229513c2ce01db27bf6a.tar.bz2
scummvm-rg350-5417f6bacb73d5996b26229513c2ce01db27bf6a.zip
- Replace OSystem::clearScreen with OSystem::fillScreen as discussed on -devel.
- Update BaseBackend and DC port to properly implement OSystem::fillScreen (now only PalmOS has to be updated). - Update all client code which relied on OSystem::clearScreen so far. svn-id: r38304
-rw-r--r--backends/base-backend.cpp4
-rw-r--r--backends/base-backend.h2
-rw-r--r--backends/platform/dc/dc.h4
-rw-r--r--backends/platform/dc/display.cpp4
-rw-r--r--base/main.cpp2
-rw-r--r--common/system.h8
-rw-r--r--engines/agos/draw.cpp2
-rw-r--r--engines/drascula/rooms.cpp2
-rw-r--r--engines/gob/video.cpp2
-rw-r--r--engines/groovie/script.cpp2
-rw-r--r--engines/parallaction/graphics.cpp2
-rw-r--r--engines/sword1/screen.cpp2
-rw-r--r--engines/tinsel/graphics.cpp2
-rw-r--r--engines/tucker/sequences.cpp2
-rw-r--r--graphics/video/video_player.cpp2
-rw-r--r--sound/softsynth/mt32.cpp2
16 files changed, 24 insertions, 20 deletions
diff --git a/backends/base-backend.cpp b/backends/base-backend.cpp
index 4c4b78b6cb..92194c6d32 100644
--- a/backends/base-backend.cpp
+++ b/backends/base-backend.cpp
@@ -45,10 +45,10 @@ Common::EventManager *BaseBackend::getEventManager() {
return s_eventManager;
}
-void BaseBackend::clearScreen() {
+void BaseBackend::fillScreen(uint32 col) {
Graphics::Surface *screen = lockScreen();
if (screen && screen->pixels)
- memset(screen->pixels, 0, screen->h * screen->pitch);
+ memset(screen->pixels, col, screen->h * screen->pitch);
unlockScreen();
}
diff --git a/backends/base-backend.h b/backends/base-backend.h
index 6cf04e8c6e..697577cd33 100644
--- a/backends/base-backend.h
+++ b/backends/base-backend.h
@@ -33,7 +33,7 @@ class BaseBackend : public OSystem, EventProvider {
public:
virtual Common::EventManager *getEventManager();
virtual void displayMessageOnOSD(const char *msg);
- virtual void clearScreen();
+ virtual void fillScreen(uint32 col);
virtual Common::SeekableReadStream *createConfigReadStream();
virtual Common::WriteStream *createConfigWriteStream();
diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h
index eabc013cdd..0b9b9112af 100644
--- a/backends/platform/dc/dc.h
+++ b/backends/platform/dc/dc.h
@@ -88,8 +88,8 @@ class OSystem_Dreamcast : public BaseBackend, public FilesystemFactory {
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
- // Clear the screen to black.
- void clearScreen();
+ // Fill the screen with a given color
+ void fillScreen(uint32 col);
// Update the dirty areas of the screen
void updateScreen();
diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp
index c6c8594aee..aa51123682 100644
--- a/backends/platform/dc/display.cpp
+++ b/backends/platform/dc/display.cpp
@@ -626,9 +626,9 @@ void OSystem_Dreamcast::unlockScreen()
_screen_dirty = true;
}
-void OSystem_Dreamcast::clearScreen()
+void OSystem_Dreamcast::fillScreen(uint32 col)
{
- memset(screen, 0, SCREEN_W*SCREEN_H);
+ memset(screen, col, SCREEN_W*SCREEN_H);
_screen_dirty = true;
}
diff --git a/base/main.cpp b/base/main.cpp
index bbc827a94d..336607d657 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -239,7 +239,7 @@ static void setupGraphics(OSystem &system) {
system.setWindowCaption(gScummVMFullVersion);
// Clear the main screen
- system.clearScreen();
+ system.fillScreen(0);
}
diff --git a/common/system.h b/common/system.h
index 913c19c70e..b4bbae017b 100644
--- a/common/system.h
+++ b/common/system.h
@@ -512,9 +512,13 @@ public:
virtual void unlockScreen() = 0;
/**
- * Clear the screen to black.
+ * Fills the screen with a given color value.
+ *
+ * @note We are using uint32 here even though currently
+ * we only support 8bpp indexed mode. Thus the value should
+ * be always inside [0, 255] for now.
*/
- virtual void clearScreen() = 0;
+ virtual void fillScreen(uint32 col) = 0;
/**
* Flush the whole screen, that is render the current content of the screen
diff --git a/engines/agos/draw.cpp b/engines/agos/draw.cpp
index 532bed5467..120dec8e7a 100644
--- a/engines/agos/draw.cpp
+++ b/engines/agos/draw.cpp
@@ -710,7 +710,7 @@ void AGOSEngine::scrollScreen() {
}
void AGOSEngine::clearSurfaces() {
- _system->clearScreen();
+ _system->fillScreen(0);
if (_backBuf) {
memset(_backBuf, 0, _screenHeight * _screenWidth);
diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp
index 33ee526785..12ec3594b1 100644
--- a/engines/drascula/rooms.cpp
+++ b/engines/drascula/rooms.cpp
@@ -1867,7 +1867,7 @@ void DrasculaEngine::enterRoom(int roomIndex) {
void DrasculaEngine::clearRoom() {
memset(VGA, 0, 64000);
- _system->clearScreen();
+ _system->fillScreen(0);
_system->updateScreen();
}
diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp
index 9f02a82572..776839b0bb 100644
--- a/engines/gob/video.cpp
+++ b/engines/gob/video.cpp
@@ -177,7 +177,7 @@ SurfaceDesc *Video::initSurfDesc(int16 vidMode, int16 width, int16 height,
}
void Video::clearScreen() {
- g_system->clearScreen();
+ g_system->fillScreen(0);
}
void Video::setSize(bool defaultTo1XScaler) {
diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index c36b331785..eb21651c56 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -1023,7 +1023,7 @@ void Script::o_loadgame() {
debugScript(1, true, "LOADGAME var[0x%04X] -> slot=%d (TODO)", varnum, slot);
loadgame(slot);
- _vm->_system->clearScreen();
+ _vm->_system->fillScreen(0);
}
void Script::o_savegame() {
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index c2b4a72cab..b9821bb4b3 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -337,7 +337,7 @@ void Gfx::clearScreen() {
_backBuffer.fillRect(r, 0);
}
} else {
- _vm->_system->clearScreen();
+ _vm->_system->fillScreen(0);
}
}
diff --git a/engines/sword1/screen.cpp b/engines/sword1/screen.cpp
index eabe1efdd6..d7498ade31 100644
--- a/engines/sword1/screen.cpp
+++ b/engines/sword1/screen.cpp
@@ -70,7 +70,7 @@ void Screen::clearScreen(void) {
if (_screenBuf) {
_fullRefresh = true;
memset(_screenBuf, 0, _scrnSizeX * _scrnSizeY);
- _system->clearScreen();
+ _system->fillScreen(0);
}
}
diff --git a/engines/tinsel/graphics.cpp b/engines/tinsel/graphics.cpp
index 4209d1fe33..4af2f0067a 100644
--- a/engines/tinsel/graphics.cpp
+++ b/engines/tinsel/graphics.cpp
@@ -493,7 +493,7 @@ static void PackedWrtNonZero(DRAWOBJECT *pObj, uint8 *srcP, uint8 *destP,
void ClearScreen() {
void *pDest = _vm->screen().getBasePtr(0, 0);
memset(pDest, 0, SCREEN_WIDTH * SCREEN_HEIGHT);
- g_system->clearScreen();
+ g_system->fillScreen(0);
g_system->updateScreen();
}
diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp
index abda4a8c10..6692e8bfa2 100644
--- a/engines/tucker/sequences.cpp
+++ b/engines/tucker/sequences.cpp
@@ -870,7 +870,7 @@ void AnimationSequencePlayer::fadeOutPalette() {
}
_system->delayMillis(1000 / 60);
}
- _system->clearScreen();
+ _system->fillScreen(0);
}
void AnimationSequencePlayer::unloadAnimation() {
diff --git a/graphics/video/video_player.cpp b/graphics/video/video_player.cpp
index 1b483a7c34..817a9117dc 100644
--- a/graphics/video/video_player.cpp
+++ b/graphics/video/video_player.cpp
@@ -187,7 +187,7 @@ bool VideoPlayer::playVideo(Common::List<Common::Event> *stopEvents) {
_skipVideo = false;
debug(0, "Playing video");
- g_system->clearScreen();
+ g_system->fillScreen(0);
int frameX = (g_system->getWidth() - _decoder->getWidth()) / 2;
int frameY = (g_system->getHeight() - _decoder->getHeight()) / 2;
diff --git a/sound/softsynth/mt32.cpp b/sound/softsynth/mt32.cpp
index c64a5b6df9..a0457aed62 100644
--- a/sound/softsynth/mt32.cpp
+++ b/sound/softsynth/mt32.cpp
@@ -285,7 +285,7 @@ int MidiDriver_MT32::open() {
if (!_synth->open(prop))
return MERR_DEVICE_NOT_AVAILABLE;
_initialising = false;
- g_system->clearScreen();
+ g_system->fillScreen(0);
g_system->updateScreen();
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_handle, this, -1, 255, 0, false, true);
return 0;