diff options
author | Denis Kasak | 2009-07-03 16:41:11 +0000 |
---|---|---|
committer | Denis Kasak | 2009-07-03 16:41:11 +0000 |
commit | 8e9771d15c3e328fb5183f78f37501f9f2646c09 (patch) | |
tree | 52f46c8ff33944ed7ba0b35c6e9344c541072a0f | |
parent | 52642e2dc9db65b87994b56e19c14b1b039dcb08 (diff) | |
download | scummvm-rg350-8e9771d15c3e328fb5183f78f37501f9f2646c09.tar.gz scummvm-rg350-8e9771d15c3e328fb5183f78f37501f9f2646c09.tar.bz2 scummvm-rg350-8e9771d15c3e328fb5183f78f37501f9f2646c09.zip |
Added bool parameter markDirty to Sprite::draw() and Text::draw() to specify whether to mark a dirty rect for a particular draw (also added such support to the Font class since it's needed by Text). Made spacing parameters for Text instances mandatory.
svn-id: r42066
-rw-r--r-- | engines/draci/font.cpp | 16 | ||||
-rw-r--r-- | engines/draci/font.h | 6 | ||||
-rw-r--r-- | engines/draci/sprite.cpp | 10 | ||||
-rw-r--r-- | engines/draci/sprite.h | 6 |
4 files changed, 21 insertions, 17 deletions
diff --git a/engines/draci/font.cpp b/engines/draci/font.cpp index b3c5768b51..17ff8644cb 100644 --- a/engines/draci/font.cpp +++ b/engines/draci/font.cpp @@ -144,7 +144,7 @@ uint8 Font::getCharWidth(uint8 chr) const { * @param ty Vertical offset on the surface */ -void Font::drawChar(Surface *dst, uint8 chr, int tx, int ty) const { +void Font::drawChar(Surface *dst, uint8 chr, int tx, int ty, bool markDirty) const { assert(dst != NULL); assert(tx >= 0); assert(ty >= 0); @@ -197,8 +197,10 @@ void Font::drawChar(Surface *dst, uint8 chr, int tx, int ty) const { ptr += dst->pitch; } - Common::Rect r(tx, ty, tx + xPixelsToDraw, ty + yPixelsToDraw); - dst->markDirtyRect(r); + if (markDirty) { + Common::Rect r(tx, ty, tx + xPixelsToDraw, ty + yPixelsToDraw); + dst->markDirtyRect(r); + } } /** @@ -213,7 +215,7 @@ void Font::drawChar(Surface *dst, uint8 chr, int tx, int ty) const { */ void Font::drawString(Surface *dst, const byte *str, uint len, - int x, int y, int spacing) const { + int x, int y, int spacing, bool markDirty) const { assert(dst != NULL); assert(x >= 0); assert(y >= 0); @@ -227,7 +229,7 @@ void Font::drawString(Surface *dst, const byte *str, uint len, return; } - drawChar(dst, str[i], curx, y); + drawChar(dst, str[i], curx, y, markDirty); curx += getCharWidth(str[i]) + spacing; } } @@ -243,9 +245,9 @@ void Font::drawString(Surface *dst, const byte *str, uint len, */ void Font::drawString(Surface *dst, const Common::String &str, - int x, int y, int spacing) const { + int x, int y, int spacing, bool markDirty) const { - drawString(dst, (byte *) str.c_str(), str.size(), x, y, spacing); + drawString(dst, (byte *) str.c_str(), str.size(), x, y, spacing, markDirty); } /** diff --git a/engines/draci/font.h b/engines/draci/font.h index c108a4493e..cdce071e5a 100644 --- a/engines/draci/font.h +++ b/engines/draci/font.h @@ -61,12 +61,12 @@ public: uint8 getFontHeight() const { return _fontHeight; }; uint8 getMaxCharWidth() const { return _maxCharWidth; }; uint8 getCharWidth(byte chr) const; - void drawChar(Surface *dst, uint8 chr, int tx, int ty) const; + void drawChar(Surface *dst, uint8 chr, int tx, int ty, bool markDirty = true) const; void drawString(Surface *dst, const byte *str, uint len, int x, int y, - int spacing = 0) const; + int spacing, bool markDirty = true) const; void drawString(Surface *dst, const Common::String &str, - int x, int y, int spacing = 0) const; + int x, int y, int spacing, bool markDirty = true) const; int getStringWidth(const Common::String &str, int spacing = 0) const; void setColour(uint8 colour); diff --git a/engines/draci/sprite.cpp b/engines/draci/sprite.cpp index 7456e28159..45f4c40e05 100644 --- a/engines/draci/sprite.cpp +++ b/engines/draci/sprite.cpp @@ -108,7 +108,7 @@ Sprite::~Sprite() { * * Draws the sprite to a Draci::Surface and marks its rectangle on the surface as dirty. */ -void Sprite::draw(Surface *surface) const { +void Sprite::draw(Surface *surface, bool markDirty) const { byte *dst = (byte *)surface->getBasePtr(_x, _y); byte *src = _data; @@ -125,8 +125,10 @@ void Sprite::draw(Surface *surface) const { } // Mark the sprite's rectangle dirty - Common::Rect r(_x, _y, _x + _width, _y + _height); - surface->markDirtyRect(r); + if (markDirty) { + Common::Rect r(_x, _y, _x + _width, _y + _height); + surface->markDirtyRect(r); + } } Text::Text(const Common::String &str, Font *font, byte fontColour, @@ -175,7 +177,7 @@ void Text::setSpacing(uint spacing) { _spacing = spacing; } -void Text::draw(Surface *surface) const { +void Text::draw(Surface *surface, bool markDirty) const { _font->setColour(_colour); _font->drawString(surface, _text, _length, _x, _y, _spacing); } diff --git a/engines/draci/sprite.h b/engines/draci/sprite.h index 490bf39211..c0572f085c 100644 --- a/engines/draci/sprite.h +++ b/engines/draci/sprite.h @@ -37,7 +37,7 @@ friend class Sprite; friend class Text; public: - virtual void draw(Surface *surface) const = 0; + virtual void draw(Surface *surface, bool markDirty = true) const = 0; virtual ~Drawable() {}; virtual uint16 getWidth() { return _width; } @@ -83,7 +83,7 @@ public: ~Sprite(); - void draw(Surface *surface) const; + void draw(Surface *surface, bool markDirty = true) const; const byte *getBuffer() const { return _data; } @@ -102,7 +102,7 @@ public: void setColour(byte fontColour); void setSpacing(uint spacing); - void draw(Surface *surface) const; + void draw(Surface *surface, bool markDirty = true) const; private: byte *_text; |