GRAPHICS: Remove default values from FontSJIS::drawChar.

drawChar is overloaded in FontSJIS. One takes a "Surface &" as first
parameter another one "void *", they furthermore have the exact same
number of required parameters. The one "void *" just had a few extra
parameters with default values. This resulted in a bug in SCUMM, where
"VirtScreen *" (a subclass of Surface) was passed instead of "VirtScreen &"
and thus the method taking "void *" was incorrectly used.

To make it easier to spot such bugs in the future I just removed the default
values and thus disallow such calls.
This commit is contained in:
Johannes Schickel 2011-07-01 05:38:20 +02:00
parent 685e32dbd7
commit 933ee5b156
4 changed files with 6 additions and 6 deletions

View File

@ -3359,7 +3359,7 @@ void SJISFont::drawChar(uint16 c, byte *dst, int pitch) const {
color2 = _colorMap[0];
}
_font->drawChar(dst, c, 640, 1, color1, color2);
_font->drawChar(dst, c, 640, 1, color1, color2, 640, 400);
}
#pragma mark -

View File

@ -338,7 +338,7 @@ void GfxScreen::drawLine(Common::Point startPoint, Common::Point endPoint, byte
void GfxScreen::putKanjiChar(Graphics::FontSJIS *commonFont, int16 x, int16 y, uint16 chr, byte color) {
byte *displayPtr = _displayScreen + y * _displayWidth * 2 + x * 2;
// we don't use outline, so color 0 is actually not used
commonFont->drawChar(displayPtr, chr, _displayWidth, 1, color, 0);
commonFont->drawChar(displayPtr, chr, _displayWidth, 1, color, 0, -1, -1);
}
byte GfxScreen::getVisual(int x, int y) {

View File

@ -779,7 +779,7 @@ void CharsetRendererV3::printChar(int chr, bool ignoreCharsetMask) {
drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight, vs->format.bytesPerPixel);
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
else if (_vm->_cjkFont)
_vm->_cjkFont->drawChar(vs, chr, _left, drawTop, _color, _shadowColor);
_vm->_cjkFont->drawChar(*vs, chr, _left, drawTop, _color, _shadowColor);
#endif
} else {
dst = (byte *)_vm->_textSurface.getBasePtr(_left * _vm->_textSurfaceMultiplier, _top * _vm->_textSurfaceMultiplier);

View File

@ -123,10 +123,10 @@ public:
* @param bpp bytes per pixel of the destination buffer
* @param c1 forground color
* @param c2 outline color
* @param maxW max draw width (to ensure that character drawing takes place within surface boundaries)
* @param maxH max draw height (to ensure that character drawing takes place within surface boundaries)
* @param maxW max draw width (to ensure that character drawing takes place within surface boundaries), -1 = no check
* @param maxH max draw height (to ensure that character drawing takes place within surface boundaries), -1 = no check
*/
virtual void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, uint32 c2, int maxW = -1, int maxH = -1) const = 0;
virtual void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, uint32 c2, int maxW, int maxH) const = 0;
};
/**