[Scummvm-cvs-logs] SF.net SVN: scummvm:[42066] scummvm/branches/gsoc2009-draci/engines/draci
dkasak13 at users.sourceforge.net
dkasak13 at users.sourceforge.net
Fri Jul 3 18:41:12 CEST 2009
Revision: 42066
http://scummvm.svn.sourceforge.net/scummvm/?rev=42066&view=rev
Author: dkasak13
Date: 2009-07-03 16:41:11 +0000 (Fri, 03 Jul 2009)
Log Message:
-----------
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.
Modified Paths:
--------------
scummvm/branches/gsoc2009-draci/engines/draci/font.cpp
scummvm/branches/gsoc2009-draci/engines/draci/font.h
scummvm/branches/gsoc2009-draci/engines/draci/sprite.cpp
scummvm/branches/gsoc2009-draci/engines/draci/sprite.h
Modified: scummvm/branches/gsoc2009-draci/engines/draci/font.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/font.cpp 2009-07-03 16:35:04 UTC (rev 42065)
+++ scummvm/branches/gsoc2009-draci/engines/draci/font.cpp 2009-07-03 16:41:11 UTC (rev 42066)
@@ -144,7 +144,7 @@
* @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 @@
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::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 @@
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 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);
}
/**
Modified: scummvm/branches/gsoc2009-draci/engines/draci/font.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/font.h 2009-07-03 16:35:04 UTC (rev 42065)
+++ scummvm/branches/gsoc2009-draci/engines/draci/font.h 2009-07-03 16:41:11 UTC (rev 42066)
@@ -61,12 +61,12 @@
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);
Modified: scummvm/branches/gsoc2009-draci/engines/draci/sprite.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/sprite.cpp 2009-07-03 16:35:04 UTC (rev 42065)
+++ scummvm/branches/gsoc2009-draci/engines/draci/sprite.cpp 2009-07-03 16:41:11 UTC (rev 42066)
@@ -108,7 +108,7 @@
*
* 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 @@
}
// 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 @@
_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);
}
Modified: scummvm/branches/gsoc2009-draci/engines/draci/sprite.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/sprite.h 2009-07-03 16:35:04 UTC (rev 42065)
+++ scummvm/branches/gsoc2009-draci/engines/draci/sprite.h 2009-07-03 16:41:11 UTC (rev 42066)
@@ -37,7 +37,7 @@
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 @@
~Sprite();
- void draw(Surface *surface) const;
+ void draw(Surface *surface, bool markDirty = true) const;
const byte *getBuffer() const { return _data; }
@@ -102,7 +102,7 @@
void setColour(byte fontColour);
void setSpacing(uint spacing);
- void draw(Surface *surface) const;
+ void draw(Surface *surface, bool markDirty = true) const;
private:
byte *_text;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list