diff options
author | Sven Hesse | 2010-09-30 13:02:16 +0000 |
---|---|---|
committer | Sven Hesse | 2010-09-30 13:02:16 +0000 |
commit | 51fd528fe56e00466255d54e1e71b19f34729bfd (patch) | |
tree | 4ced8883bebd5ca93eb4aeb315a496c535e87c78 /engines/gob/save | |
parent | 38e506004101edb6460c695fc62754fb9e951883 (diff) | |
download | scummvm-rg350-51fd528fe56e00466255d54e1e71b19f34729bfd.tar.gz scummvm-rg350-51fd528fe56e00466255d54e1e71b19f34729bfd.tar.bz2 scummvm-rg350-51fd528fe56e00466255d54e1e71b19f34729bfd.zip |
GOB: Change all drawing to use class Surface
svn-id: r52947
Diffstat (limited to 'engines/gob/save')
-rw-r--r-- | engines/gob/save/savefile.cpp | 16 | ||||
-rw-r--r-- | engines/gob/save/savefile.h | 6 | ||||
-rw-r--r-- | engines/gob/save/savehandler.cpp | 8 | ||||
-rw-r--r-- | engines/gob/save/savehandler.h | 4 |
4 files changed, 21 insertions, 13 deletions
diff --git a/engines/gob/save/savefile.cpp b/engines/gob/save/savefile.cpp index e1c4c62b12..79e931fe30 100644 --- a/engines/gob/save/savefile.cpp +++ b/engines/gob/save/savefile.cpp @@ -331,14 +331,18 @@ bool SavePartSprite::readPalette(const byte *palette) { return true; } -bool SavePartSprite::readSprite(const SurfaceDesc &sprite) { +bool SavePartSprite::readSprite(const Surface &sprite) { // The sprite's dimensions have to fit if (((uint32)sprite.getWidth()) != _width) return false; if (((uint32)sprite.getHeight()) != _height) return false; - memcpy(_dataSprite, sprite.getVidMem(), _width * _height); + // Only 8bit sprites supported for now + if (sprite.getBPP() != 1) + return false; + + memcpy(_dataSprite, sprite.getData(), _width * _height); return true; } @@ -357,14 +361,18 @@ bool SavePartSprite::writePalette(byte *palette) const { return true; } -bool SavePartSprite::writeSprite(SurfaceDesc &sprite) const { +bool SavePartSprite::writeSprite(Surface &sprite) const { // The sprite's dimensions have to fit if (((uint32)sprite.getWidth()) != _width) return false; if (((uint32)sprite.getHeight()) != _height) return false; - memcpy(sprite.getVidMem(), _dataSprite, _width * _height); + // Only 8bit sprites supported for now + if (sprite.getBPP() != 1) + return false; + + memcpy(sprite.getData(), _dataSprite, _width * _height); return true; } diff --git a/engines/gob/save/savefile.h b/engines/gob/save/savefile.h index 615be8e0f2..da3696dee8 100644 --- a/engines/gob/save/savefile.h +++ b/engines/gob/save/savefile.h @@ -33,7 +33,7 @@ namespace Gob { class GobEngine; -class SurfaceDesc; +class Surface; /** A class wrapping a save part header. * @@ -162,7 +162,7 @@ public: /** Read a palette into the part. */ bool readPalette(const byte *palette); /** Read a sprite into the part. */ - bool readSprite(const SurfaceDesc &sprite); + bool readSprite(const Surface &sprite); /** Read size bytes of raw data into the sprite. */ bool readSpriteRaw(const byte *data, uint32 size); @@ -170,7 +170,7 @@ public: /** Write a palette out of the part. */ bool writePalette(byte *palette) const; /** Write a sprite out of the part. */ - bool writeSprite(SurfaceDesc &sprite) const; + bool writeSprite(Surface &sprite) const; private: uint32 _width; diff --git a/engines/gob/save/savehandler.cpp b/engines/gob/save/savehandler.cpp index 14cd82480d..8b7a661278 100644 --- a/engines/gob/save/savehandler.cpp +++ b/engines/gob/save/savehandler.cpp @@ -245,7 +245,7 @@ bool TempSpriteHandler::load(int16 dataVar, int32 size, int32 offset) { if ((index < 0) || (index >= SPRITES_COUNT)) return false; - SurfaceDescPtr sprite = _vm->_draw->_spritesArray[index]; + SurfacePtr sprite = _vm->_draw->_spritesArray[index]; // Target sprite exists? if (!sprite) @@ -275,7 +275,7 @@ bool TempSpriteHandler::load(int16 dataVar, int32 size, int32 offset) { } bool TempSpriteHandler::save(int16 dataVar, int32 size, int32 offset) { - SurfaceDescPtr sprite; + SurfacePtr sprite; if (isDummy(size)) return true; @@ -297,7 +297,7 @@ bool TempSpriteHandler::save(int16 dataVar, int32 size, int32 offset) { } bool TempSpriteHandler::createSprite(int16 dataVar, int32 size, - int32 offset, SurfaceDescPtr *sprite) { + int32 offset, SurfacePtr *sprite) { delete _sprite; _sprite = 0; @@ -311,7 +311,7 @@ bool TempSpriteHandler::createSprite(int16 dataVar, int32 size, if ((index < 0) || (index >= SPRITES_COUNT)) return false; - SurfaceDescPtr sprt = _vm->_draw->_spritesArray[index]; + SurfacePtr sprt = _vm->_draw->_spritesArray[index]; // Sprite exists? if (!sprt) diff --git a/engines/gob/save/savehandler.h b/engines/gob/save/savehandler.h index 6a7e563a8f..723215cf08 100644 --- a/engines/gob/save/savehandler.h +++ b/engines/gob/save/savehandler.h @@ -27,7 +27,7 @@ #define GOB_SAVE_SAVEHANDLER_H #include "common/savefile.h" -#include "engines/gob/video.h" // for SurfaceDescPtr +#include "engines/gob/video.h" // for SurfacePtr namespace Gob { @@ -139,7 +139,7 @@ public: /** Create a fitting sprite. */ bool createSprite(int16 dataVar, int32 size, - int32 offset, SurfaceDescPtr *sprite = 0); + int32 offset, SurfacePtr *sprite = 0); protected: SavePartSprite *_sprite; |