aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--graphics/font.cpp4
-rw-r--r--graphics/font.h8
-rw-r--r--graphics/scummfont.cpp3
-rw-r--r--graphics/surface.cpp8
-rw-r--r--graphics/surface.h16
5 files changed, 21 insertions, 18 deletions
diff --git a/graphics/font.cpp b/graphics/font.cpp
index 1abaf4ac5d..533c564afd 100644
--- a/graphics/font.cpp
+++ b/graphics/font.cpp
@@ -36,7 +36,7 @@ int NewFont::getCharWidth(byte chr) const {
return desc.width[chr - desc.firstchar];
}
-void NewFont::drawChar(const Surface *dst, byte chr, int tx, int ty, uint32 color) const {
+void NewFont::drawChar(Surface *dst, byte chr, int tx, int ty, uint32 color) const {
assert(dst != 0);
byte *ptr = (byte *)dst->getBasePtr(tx, ty);
@@ -85,7 +85,7 @@ int Font::getStringWidth(const Common::String &str) const {
return space;
}
-void Font::drawString(const Surface *dst, const Common::String &s, int x, int y, int w, uint32 color, TextAlignment align, int deltax, bool useEllipsis) const {
+void Font::drawString(Surface *dst, const Common::String &s, int x, int y, int w, uint32 color, TextAlignment align, int deltax, bool useEllipsis) const {
assert(dst != 0);
const int leftX = x, rightX = x + w;
uint i;
diff --git a/graphics/font.h b/graphics/font.h
index 134ba8bb48..8f6aa7249f 100644
--- a/graphics/font.h
+++ b/graphics/font.h
@@ -52,9 +52,9 @@ public:
virtual int getMaxCharWidth() const = 0;
virtual int getCharWidth(byte chr) const = 0;
- virtual void drawChar(const Surface *dst, byte chr, int x, int y, uint32 color) const = 0;
+ virtual void drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const = 0;
- void drawString(const Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, TextAlignment align = kTextAlignLeft, int deltax = 0, bool useEllipsis = true) const;
+ void drawString(Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, TextAlignment align = kTextAlignLeft, int deltax = 0, bool useEllipsis = true) const;
int getStringWidth(const Common::String &str) const;
};
@@ -65,7 +65,7 @@ public:
virtual int getMaxCharWidth() const { return 8; };
virtual int getCharWidth(byte chr) const;
- virtual void drawChar(const Surface *dst, byte chr, int x, int y, uint32 color) const;
+ virtual void drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const;
};
@@ -99,7 +99,7 @@ public:
virtual int getMaxCharWidth() const { return desc.maxwidth; };
virtual int getCharWidth(byte chr) const;
- virtual void drawChar(const Surface *dst, byte chr, int x, int y, uint32 color) const;
+ virtual void drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const;
};
} // End of namespace Graphics
diff --git a/graphics/scummfont.cpp b/graphics/scummfont.cpp
index 5a004a7b37..314d20ea08 100644
--- a/graphics/scummfont.cpp
+++ b/graphics/scummfont.cpp
@@ -61,8 +61,7 @@ int ScummFont::getCharWidth(byte chr) const {
return guifont[chr+6];
}
-//void ScummFont::drawChar(byte chr, int xx, int yy, OverlayColor color) {
-void ScummFont::drawChar(const Surface *dst, byte chr, int tx, int ty, uint32 color) const {
+void ScummFont::drawChar(Surface *dst, byte chr, int tx, int ty, uint32 color) const {
assert(dst != 0);
byte *ptr = (byte *)dst->getBasePtr(tx, ty);
diff --git a/graphics/surface.cpp b/graphics/surface.cpp
index 2626afde1c..0ae59926f2 100644
--- a/graphics/surface.cpp
+++ b/graphics/surface.cpp
@@ -24,7 +24,7 @@
namespace Graphics {
-void Surface::hLine(int x, int y, int x2, uint32 color) const {
+void Surface::hLine(int x, int y, int x2, uint32 color) {
// Clipping
if (y < 0 || y >= h)
return;
@@ -51,7 +51,7 @@ void Surface::hLine(int x, int y, int x2, uint32 color) const {
}
}
-void Surface::vLine(int x, int y, int y2, uint32 color) const {
+void Surface::vLine(int x, int y, int y2, uint32 color) {
// Clipping
if (x < 0 || x >= w)
return;
@@ -81,7 +81,7 @@ void Surface::vLine(int x, int y, int y2, uint32 color) const {
}
}
-void Surface::fillRect(const Common::Rect &rOld, uint32 color) const {
+void Surface::fillRect(const Common::Rect &rOld, uint32 color) {
Common::Rect r(rOld);
r.clip(w, h);
@@ -111,7 +111,7 @@ void Surface::fillRect(const Common::Rect &rOld, uint32 color) const {
}
}
-void Surface::frameRect(const Common::Rect &r, uint32 color) const {
+void Surface::frameRect(const Common::Rect &r, uint32 color) {
hLine(r.left, r.top, r.right-1, color);
hLine(r.left, r.bottom-1, r.right-1, color);
vLine(r.left, r.top, r.bottom-1, color);
diff --git a/graphics/surface.h b/graphics/surface.h
index 8cd93298d1..8407b73bbe 100644
--- a/graphics/surface.h
+++ b/graphics/surface.h
@@ -39,14 +39,18 @@ struct Surface {
uint8 bytesPerPixel;
Surface() : pixels(0), w(0), h(0), pitch(0), bytesPerPixel(0) {}
- inline void *getBasePtr(int x, int y) const {
- return (void *)((byte *)pixels + y * pitch + x * bytesPerPixel);
+ inline const void *getBasePtr(int x, int y) const {
+ return static_cast<const void *>(static_cast<const byte *>(pixels) + y * pitch + x * bytesPerPixel);
+ }
+
+ inline void *getBasePtr(int x, int y) {
+ return static_cast<void *>(static_cast<byte *>(pixels) + y * pitch + x * bytesPerPixel);
}
- void hLine(int x, int y, int x2, uint32 color) const;
- void vLine(int x, int y, int y2, uint32 color) const;
- void fillRect(const Common::Rect &r, uint32 color) const;
- void frameRect(const Common::Rect &r, uint32 color) const;
+ void hLine(int x, int y, int x2, uint32 color);
+ void vLine(int x, int y, int y2, uint32 color);
+ void fillRect(const Common::Rect &r, uint32 color);
+ void frameRect(const Common::Rect &r, uint32 color);
};