changed mapChar to use unsigned (byte) instead of char, to avoid possible sign issues

svn-id: r25664
This commit is contained in:
Nicola Mettifogo 2007-02-17 20:54:25 +00:00
parent 33d04d5aa4
commit b1a63e8a16
2 changed files with 10 additions and 11 deletions

View File

@ -641,7 +641,7 @@ void Graphics::displayString(uint16 x, uint16 y, const char *text) {
StaticCnv tmp;
for (uint16 i = 0; i < len; i++) {
char c = mapChar(text[i]);
byte c = mapChar(text[i]);
tmp._width = _font._width;
tmp._height = _font._height;
@ -663,7 +663,7 @@ void Graphics::displayBalloonString(uint16 x, uint16 y, const char *text, byte c
for (uint16 i = 0; i < len; i++) {
char c = mapChar(text[i]);
byte c = mapChar(text[i]);
uint16 w = _proportionalFont ? _glyphWidths[(int)c] : 8;
byte *s = _font._array[c];
byte *d = _buffers[kBitFront] + x + y*SCREEN_WIDTH;
@ -752,7 +752,7 @@ uint16 Graphics::getStringWidth(const char *text) {
// proportional font
uint16 w = 0;
for (uint16 i = 0; i < len; i++) {
char c = mapChar(text[i]);
byte c = mapChar(text[i]);
w += _glyphWidths[(int)c];
}
@ -915,7 +915,7 @@ void Graphics::makeCnvFromString(StaticCnv *cnv, char *text) {
cnv->_data0 = (byte*)memAlloc(cnv->_width * cnv->_height);
for (uint16 i = 0; i < len; i++) {
char c = mapChar(text[i]);
byte c = mapChar(text[i]);
byte *s = _font._array[c];
byte *d = cnv->_data0 + _font._width * i;
@ -934,15 +934,14 @@ void Graphics::makeCnvFromString(StaticCnv *cnv, char *text) {
//
// internal character mapping
//
char Graphics::mapChar(char c) {
byte b = (byte)c;
byte Graphics::mapChar(byte c) {
if (b == 0xA5) return 0x5F;
if (b == 0xDF) return 0x60;
if (c == 0xA5) return 0x5F;
if (c == 0xDF) return 0x60;
if (b > 0x7F) return b - 0x7F;
if (c > 0x7F) return c - 0x7F;
return b - 0x20;
return c - 0x20;
}

View File

@ -165,7 +165,7 @@ protected:
//
// maps a character for representation
//
char mapChar(char c);
byte mapChar(byte c);
void flatBlit(uint16 w, uint16 h, int16 x, int16 y, byte *data, Graphics::Buffers buffer);
void blit(uint16 w, uint16 h, int16 x, int16 y, uint16 z, byte *data, Graphics::Buffers buffer, Graphics::Buffers mask);