[Scummvm-cvs-logs] SF.net SVN: scummvm:[41656] scummvm/branches/gsoc2009-draci/engines/draci
dkasak13 at users.sourceforge.net
dkasak13 at users.sourceforge.net
Fri Jun 19 02:09:36 CEST 2009
Revision: 41656
http://scummvm.svn.sourceforge.net/scummvm/?rev=41656&view=rev
Author: dkasak13
Date: 2009-06-19 00:09:36 +0000 (Fri, 19 Jun 2009)
Log Message:
-----------
Added support for the new Surface class to Font (transparency, marking dirty rectangles).
Modified Paths:
--------------
scummvm/branches/gsoc2009-draci/engines/draci/font.cpp
scummvm/branches/gsoc2009-draci/engines/draci/font.h
Modified: scummvm/branches/gsoc2009-draci/engines/draci/font.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/font.cpp 2009-06-19 00:06:11 UTC (rev 41655)
+++ scummvm/branches/gsoc2009-draci/engines/draci/font.cpp 2009-06-19 00:09:36 UTC (rev 41656)
@@ -33,18 +33,6 @@
const Common::String kFontSmall("Small.fon");
const Common::String kFontBig("Big.fon");
-/**
- * Default font colours. They all seem to remain constant except for the
- * first one which varies depending on the character speaking.
- * kOverFontColour is set to transparent.
- * TODO: Find out what kFontColour1 should actually be when the game starts
- */
-enum {
- kFontColour1 = 2, kFontColour2 = 0,
- kFontColour3 = 3, kFontColour4 = 4,
- kOverFontColour = 255
-};
-
Font::Font() {
_fontHeight = 0;
@@ -156,7 +144,7 @@
* @param ty Vertical offset on the surface
*/
-void Font::drawChar(Graphics::Surface *dst, uint8 chr, int tx, int ty) const {
+void Font::drawChar(Surface *dst, uint8 chr, int tx, int ty) const {
assert(dst != NULL);
assert(tx >= 0);
assert(ty >= 0);
@@ -200,13 +188,17 @@
break;
}
- // Paint pixel
- ptr[x] = colour;
+ // Paint pixel (if not transparent)
+ if (colour != dst->getTransparentColour())
+ ptr[x] = colour;
}
// Advance to next row
ptr += dst->pitch;
}
+
+ Common::Rect r(tx, ty, tx + xPixelsToDraw, ty + yPixelsToDraw);
+ dst->markDirtyRect(r);
}
/**
@@ -219,7 +211,7 @@
* @param spacing Space to leave between individual characters. Defaults to 0.
*/
-void Font::drawString(Graphics::Surface *dst, const Common::String &str,
+void Font::drawString(Surface *dst, const Common::String &str,
int x, int y, int spacing) const {
assert(dst != NULL);
assert(x >= 0);
Modified: scummvm/branches/gsoc2009-draci/engines/draci/font.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/font.h 2009-06-19 00:06:11 UTC (rev 41655)
+++ scummvm/branches/gsoc2009-draci/engines/draci/font.h 2009-06-19 00:09:36 UTC (rev 41656)
@@ -33,6 +33,18 @@
extern const Common::String kFontSmall;
extern const Common::String kFontBig;
+/**
+ * Default font colours. They all seem to remain constant except for the
+ * first one which varies depending on the character speaking.
+ * kOverFontColour is set to transparent.
+ * TODO: Find out what kFontColour1 should actually be when the game starts
+ */
+enum {
+ kFontColour1 = 2, kFontColour2 = 0,
+ kFontColour3 = 3, kFontColour4 = 4,
+ kOverFontColour = 255
+};
+
/**
* Represents the game's fonts. See docs for setFont() for font format details.
*/
@@ -49,8 +61,8 @@
uint8 getFontHeight() const { return _fontHeight; };
uint8 getMaxCharWidth() const { return _maxCharWidth; };
uint8 getCharWidth(byte chr) const;
- void drawChar(Graphics::Surface *dst, uint8 chr, int tx, int ty) const;
- void drawString(Graphics::Surface *dst, const Common::String &str,
+ void drawChar(Surface *dst, uint8 chr, int tx, int ty) const;
+ void drawString(Surface *dst, const Common::String &str,
int x, int y, int spacing = 0) const;
int getStringWidth(const Common::String &str, int spacing = 0) const;
void setColour(uint8 colour);
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