diff options
author | Johannes Schickel | 2011-07-01 05:38:20 +0200 |
---|---|---|
committer | Johannes Schickel | 2011-07-01 05:42:54 +0200 |
commit | 933ee5b156fd8031a75b84bae5329843221208dc (patch) | |
tree | 17c2c8480e338aeae0479608e662a0e3130a34a9 | |
parent | 685e32dbd7bf352c27e935b930ea24dc8b3380da (diff) | |
download | scummvm-rg350-933ee5b156fd8031a75b84bae5329843221208dc.tar.gz scummvm-rg350-933ee5b156fd8031a75b84bae5329843221208dc.tar.bz2 scummvm-rg350-933ee5b156fd8031a75b84bae5329843221208dc.zip |
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.
-rw-r--r-- | engines/kyra/screen.cpp | 2 | ||||
-rw-r--r-- | engines/sci/graphics/screen.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/charset.cpp | 2 | ||||
-rw-r--r-- | graphics/sjis.h | 6 |
4 files changed, 6 insertions, 6 deletions
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index b4304a6de0..8f008a58b6 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -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 - diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp index 4ab0b9719f..dbe2135143 100644 --- a/engines/sci/graphics/screen.cpp +++ b/engines/sci/graphics/screen.cpp @@ -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) { diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index 7fb834ce98..eaae64dc77 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -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); diff --git a/graphics/sjis.h b/graphics/sjis.h index 90357af446..58bcaf121f 100644 --- a/graphics/sjis.h +++ b/graphics/sjis.h @@ -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; }; /** |