aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2016-03-20 21:38:26 +0100
committerJohannes Schickel2016-03-21 02:03:12 +0100
commitce1be463c2dfea61e74a816d6590a1a4506483d2 (patch)
treea9f1f70eacc783e818b6d7fa9e2c8431a60ed60d
parentc382e179084d52656de7379822d89a5fe97ca988 (diff)
downloadscummvm-rg350-ce1be463c2dfea61e74a816d6590a1a4506483d2.tar.gz
scummvm-rg350-ce1be463c2dfea61e74a816d6590a1a4506483d2.tar.bz2
scummvm-rg350-ce1be463c2dfea61e74a816d6590a1a4506483d2.zip
GRAPHICS: Implement convenience Font::drawChar taking ManagedSurface.
-rw-r--r--graphics/font.cpp8
-rw-r--r--graphics/font.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/graphics/font.cpp b/graphics/font.cpp
index abc9519fd9..97662dc15d 100644
--- a/graphics/font.cpp
+++ b/graphics/font.cpp
@@ -265,6 +265,14 @@ int Font::getStringWidth(const Common::U32String &str) const {
return getStringWidthImpl(*this, str);
}
+void Font::drawChar(ManagedSurface *dst, uint32 chr, int x, int y, uint32 color) const {
+ drawChar(&dst->_innerSurface, chr, x, y, color);
+
+ Common::Rect charBox = getBoundingBox(chr);
+ charBox.translate(x, y);
+ dst->addDirtyRect(charBox);
+}
+
void Font::drawString(Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, TextAlign align, int deltax, bool useEllipsis) const {
Common::String renderStr = useEllipsis ? handleEllipsis(str, w) : str;
drawStringImpl(*this, dst, renderStr, x, y, w, color, align, deltax);
diff --git a/graphics/font.h b/graphics/font.h
index 62e71a8568..0478608708 100644
--- a/graphics/font.h
+++ b/graphics/font.h
@@ -142,6 +142,7 @@ public:
* @param color The color of the character.
*/
virtual void drawChar(Surface *dst, uint32 chr, int x, int y, uint32 color) const = 0;
+ void drawChar(ManagedSurface *dst, uint32 chr, int x, int y, uint32 color) const;
// TODO: Add doxygen comments to this
void drawString(Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, TextAlign align = kTextAlignLeft, int deltax = 0, bool useEllipsis = true) const;