From ce1be463c2dfea61e74a816d6590a1a4506483d2 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 20 Mar 2016 21:38:26 +0100 Subject: GRAPHICS: Implement convenience Font::drawChar taking ManagedSurface. --- graphics/font.cpp | 8 ++++++++ graphics/font.h | 1 + 2 files changed, 9 insertions(+) (limited to 'graphics') 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; -- cgit v1.2.3