[Scummvm-cvs-logs] CVS: scummvm/graphics font.cpp,1.6,1.7 font.h,1.5,1.6 fontman.cpp,1.2,1.3 fontman.h,1.1,1.2 module.mk,1.3,1.4 scummfont.cpp,1.6,1.7
Max Horn
fingolfin at users.sourceforge.net
Thu Jan 6 14:49:28 CET 2005
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/graphics newfont_big.cpp,NONE,1.1 newfont.cpp,1.4,1.5
- Next message: [Scummvm-cvs-logs] CVS: scummvm/gui about.cpp,1.23,1.24 newgui.cpp,1.97,1.98 newgui.h,1.52,1.53 widget.cpp,1.40,1.41
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/graphics
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5880/graphics
Modified Files:
font.cpp font.h fontman.cpp fontman.h module.mk scummfont.cpp
Log Message:
Switching GUI to an alternate font; using a second, bigger, font for 640x480 games like COMI. Note: we can always easily switch back to the SCUMM font or any other font, if we want to
Index: font.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/font.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- font.cpp 6 Jan 2005 21:15:51 -0000 1.6
+++ font.cpp 6 Jan 2005 22:48:41 -0000 1.7
@@ -36,9 +36,8 @@
return desc.width[chr - desc.firstchar];
}
-void NewFont::drawChar(const Surface *dst, byte chr, int tx, int ty, uint32 color, int scaleFactor) const {
+void NewFont::drawChar(const Surface *dst, byte chr, int tx, int ty, uint32 color) const {
assert(dst != 0);
- tx *= scaleFactor; ty *= scaleFactor;
byte *ptr = (byte *)dst->getBasePtr(tx, ty);
@@ -56,26 +55,15 @@
chr -= desc.firstchar;
const bitmap_t *tmp = desc.bits + (desc.offset ? desc.offset[chr] : (chr * desc.height));
- for (int y = 0; y < desc.height * scaleFactor; y++, ptr += dst->pitch) {
+ for (int y = 0; y < desc.height; y++, ptr += dst->pitch) {
const bitmap_t *buffer = 0;
- if(scaleFactor != 1) {
- if(!(y % 2))
- buffer = tmp++;
- else
- buffer = tmp;
- } else
- buffer = tmp++;
+ buffer = tmp++;
bitmap_t mask = 0x8000;
if (ty + y < 0 || ty + y >= dst->h)
continue;
- for (int x = 0; x < w * scaleFactor; x++) {
- if(scaleFactor != 1) {
- if(!(x % 2) && x != 0)
- mask >>= 1;
- } else if(x != 0) {
- mask >>= 1;
- }
+ for (int x = 0; x < w; x++) {
+ mask >>= 1;
if (tx + x < 0 || tx + x >= dst->w)
continue;
@@ -101,7 +89,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, int scaleFactor) const {
+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 {
assert(dst != 0);
const int leftX = x, rightX = x + w;
uint i;
@@ -166,7 +154,7 @@
if (x+w > rightX)
break;
if (x >= leftX)
- drawChar(dst, str[i], x, y, color, scaleFactor);
+ drawChar(dst, str[i], x, y, color);
x += w;
}
}
Index: font.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/font.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- font.h 6 Jan 2005 21:15:51 -0000 1.5
+++ font.h 6 Jan 2005 22:48:41 -0000 1.6
@@ -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, int scaleFactor = 1) const = 0;
+ virtual void drawChar(const 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, int scaleFactor = 1) const;
+ 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;
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, int scaleFactor) const;
+ virtual void drawChar(const 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, int scaleFactor) const;
+ virtual void drawChar(const Surface *dst, byte chr, int x, int y, uint32 color) const;
};
} // End of namespace Graphics
Index: fontman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/fontman.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- fontman.cpp 6 Jan 2005 21:18:46 -0000 1.2
+++ fontman.cpp 6 Jan 2005 22:48:41 -0000 1.3
@@ -29,6 +29,7 @@
const ScummFont g_scummfont;
extern const NewFont g_sysfont;
+extern const NewFont g_sysfont_big;
DECLARE_SINGLETON(FontManager);
@@ -46,7 +47,9 @@
case kConsoleFont:
return &GUI::g_consolefont;
case kGUIFont:
- return &g_scummfont;
+ return &g_sysfont;
+ case kBigGUIFont:
+ return &g_sysfont_big;
}
return 0;
}
Index: fontman.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/fontman.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- fontman.h 6 Jan 2005 21:15:51 -0000 1.1
+++ fontman.h 6 Jan 2005 22:48:41 -0000 1.2
@@ -35,7 +35,8 @@
enum FontUsage {
kOSDFont,
kConsoleFont,
- kGUIFont
+ kGUIFont,
+ kBigGUIFont
};
/**
Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/module.mk,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- module.mk 6 Jan 2005 21:15:51 -0000 1.3
+++ module.mk 6 Jan 2005 22:48:41 -0000 1.4
@@ -6,6 +6,7 @@
graphics/font.o \
graphics/fontman.o \
graphics/newfont.o \
+ graphics/newfont_big.o \
graphics/surface.o
MODULE_DIRS += \
Index: scummfont.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/scummfont.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- scummfont.cpp 6 Jan 2005 21:15:51 -0000 1.6
+++ scummfont.cpp 6 Jan 2005 22:48:41 -0000 1.7
@@ -63,9 +63,8 @@
}
//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, int scaleFactor) const {
+void ScummFont::drawChar(const Surface *dst, byte chr, int tx, int ty, uint32 color) const {
assert(dst != 0);
- tx *= scaleFactor; ty *= scaleFactor;
byte *ptr = (byte *)dst->getBasePtr(tx, ty);
@@ -73,25 +72,18 @@
uint buffer = 0;
uint mask = 0;
- for (int y = 0; y < 8 * scaleFactor; y++) {
+ for (int y = 0; y < 8; y++) {
if (ty + y < 0 || ty + y >= dst->h)
continue;
- for (int x = 0; x < 8 * scaleFactor; x++) {
- if(scaleFactor != 1 && !(x % 2))
- mask >>= 1;
- else if(scaleFactor == 1)
- mask >>= 1;
+ for (int x = 0; x < 8; x++) {
+ mask >>= 1;
if (tx + x < 0 || tx + x >= dst->w)
continue;
if (mask == 0) {
- if(scaleFactor != 1 && !(y % 2))
- buffer = *tmp++;
- else if(scaleFactor == 1)
- buffer = *tmp++;
-
+ buffer = *tmp++;
mask = 0x80;
}
const byte c = ((buffer & mask) != 0);
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/graphics newfont_big.cpp,NONE,1.1 newfont.cpp,1.4,1.5
- Next message: [Scummvm-cvs-logs] CVS: scummvm/gui about.cpp,1.23,1.24 newgui.cpp,1.97,1.98 newgui.h,1.52,1.53 widget.cpp,1.40,1.41
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list