From 224d8c087acac4e3f21913b6268f82c1ab9faca8 Mon Sep 17 00:00:00 2001 From: Denis Kasak Date: Mon, 13 Jul 2009 19:08:04 +0000 Subject: Added Surface::fill() method and made Screen::fillScreen() use that instead of filling the surface manually. Changed Surface to use uint instead of uint8 throughout. svn-id: r42447 --- engines/draci/screen.cpp | 5 +---- engines/draci/surface.cpp | 13 +++++++++++-- engines/draci/surface.h | 7 ++++--- 3 files changed, 16 insertions(+), 9 deletions(-) (limited to 'engines') diff --git a/engines/draci/screen.cpp b/engines/draci/screen.cpp index b6c740e20c..781147806f 100644 --- a/engines/draci/screen.cpp +++ b/engines/draci/screen.cpp @@ -134,11 +134,8 @@ void Screen::clearScreen() const { * Fills the screen with the specified colour and marks the whole screen dirty. */ void Screen::fillScreen(uint8 colour) const { - byte *ptr = (byte *)_surface->getBasePtr(0, 0); - + _surface->fill(colour); _surface->markDirty(); - - memset(ptr, colour, kScreenWidth * kScreenHeight); } /** diff --git a/engines/draci/surface.cpp b/engines/draci/surface.cpp index 148c24633b..636ec0c4ac 100644 --- a/engines/draci/surface.cpp +++ b/engines/draci/surface.cpp @@ -106,15 +106,24 @@ Common::List *Surface::getDirtyRects() { /** * @brief Returns the current transparent colour of the surface */ -uint8 Surface::getTransparentColour() { +uint Surface::getTransparentColour() { return _transparentColour; } /** * @brief Sets the surface's transparent colour */ -void Surface::setTransparentColour(uint8 colour) { +void Surface::setTransparentColour(uint colour) { _transparentColour = colour; } +/** + * @ brief Fills the surface with the specified colour + */ +void Surface::fill(uint colour) { + byte *ptr = (byte *)getBasePtr(0, 0); + + memset(ptr, colour, w * h); +} + } // End of namespace Draci diff --git a/engines/draci/surface.h b/engines/draci/surface.h index 20df29d7f9..db564ec2e5 100644 --- a/engines/draci/surface.h +++ b/engines/draci/surface.h @@ -42,14 +42,15 @@ public: void markDirty(); void markClean(); bool needsFullUpdate(); - uint8 getTransparentColour(); - void setTransparentColour(uint8 colour); + uint getTransparentColour(); + void setTransparentColour(uint colour); + void fill(uint colour); private: /** The current transparent colour of the surface. See getTransparentColour() and * setTransparentColour(). */ - uint8 _transparentColour; + uint _transparentColour; /** Set when the surface is scheduled for a full update. * See markDirty(), markClean(). Accessed via needsFullUpdate(). -- cgit v1.2.3