[Scummvm-cvs-logs] CVS: scummvm/graphics font.cpp,1.8,1.9 font.h,1.6,1.7 scummfont.cpp,1.8,1.9 surface.cpp,1.4,1.5 surface.h,1.5,1.6
Max Horn
fingolfin at users.sourceforge.net
Mon May 2 11:00:49 CEST 2005
Update of /cvsroot/scummvm/scummvm/graphics
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27895
Modified Files:
font.cpp font.h scummfont.cpp surface.cpp surface.h
Log Message:
Const correctness
Index: font.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/font.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- font.cpp 8 Jan 2005 18:11:29 -0000 1.8
+++ font.cpp 2 May 2005 18:00:05 -0000 1.9
@@ -36,7 +36,7 @@
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 @@
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;
Index: font.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/font.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- font.h 6 Jan 2005 22:48:41 -0000 1.6
+++ font.h 2 May 2005 18:00:05 -0000 1.7
@@ -52,9 +52,9 @@
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 @@
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 @@
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
Index: scummfont.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/scummfont.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- scummfont.cpp 8 Jan 2005 18:11:29 -0000 1.8
+++ scummfont.cpp 2 May 2005 18:00:05 -0000 1.9
@@ -61,8 +61,7 @@
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);
Index: surface.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/surface.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- surface.cpp 1 Jan 2005 16:08:51 -0000 1.4
+++ surface.cpp 2 May 2005 18:00:05 -0000 1.5
@@ -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::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::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::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);
Index: surface.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/surface.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- surface.h 11 Jan 2005 13:25:00 -0000 1.5
+++ surface.h 2 May 2005 18:00:05 -0000 1.6
@@ -39,14 +39,18 @@
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);
};
More information about the Scummvm-git-logs
mailing list