diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/draci/sprite.cpp | 19 | ||||
-rw-r--r-- | engines/draci/sprite.h | 4 |
2 files changed, 23 insertions, 0 deletions
diff --git a/engines/draci/sprite.cpp b/engines/draci/sprite.cpp index 526213362f..6a55894907 100644 --- a/engines/draci/sprite.cpp +++ b/engines/draci/sprite.cpp @@ -22,8 +22,10 @@ * $Id$ * */ + #include "common/stream.h" +#include "draci/draci.h" #include "draci/sprite.h" namespace Draci { @@ -75,6 +77,23 @@ Sprite::Sprite(byte *sprite_data, uint16 length, uint16 x, uint16 y, Sprite::~Sprite() { delete[] _data; } + +void Sprite::draw(Surface *surface) const { + byte *dst = (byte *)surface->getBasePtr(_x, _y); + byte *src = _data; + + for (unsigned int i = 0; i < _height; ++i) { + for(unsigned int j = 0; j < _width; ++j, ++src) { + if (*src != surface->getTransparentColour()) + dst[j] = *src; + } + + dst += surface->pitch; + } + + Common::Rect r(_x, _y, _x + _width, _y + _height); + surface->markDirtyRect(r); +} } // End of namespace Draci diff --git a/engines/draci/sprite.h b/engines/draci/sprite.h index fab59958f2..0bd825cf14 100644 --- a/engines/draci/sprite.h +++ b/engines/draci/sprite.h @@ -26,6 +26,8 @@ #ifndef DRACI_SPRITE_H #define DRACI_SPRITE_H +#include "draci/surface.h" + namespace Draci { /** @@ -52,6 +54,8 @@ public: ~Sprite(); + void draw(Surface *surface) const; + byte *_data; uint16 _width; uint16 _height; |