From c1aecd0b9b32efb3a90f653eb36102f18543b49e Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Fri, 2 Jul 2010 15:58:09 +0000 Subject: SCI: change drawing of fonts, so that we never do triple pixel line duplications. sierra didn't do this, but it looks much better - "fixes" gk1, kq6 font rendering when running in hires svn-id: r50599 --- engines/sci/graphics/font.cpp | 4 ++-- engines/sci/graphics/screen.cpp | 21 +++++++++++++++++++++ engines/sci/graphics/screen.h | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/sci/graphics/font.cpp b/engines/sci/graphics/font.cpp index 91cf01c912..ce4c1fafb3 100644 --- a/engines/sci/graphics/font.cpp +++ b/engines/sci/graphics/font.cpp @@ -82,7 +82,7 @@ void GfxFontFromResource::draw(uint16 chr, int16 top, int16 left, byte color, bo int charWidth = MIN(getCharWidth(chr), _screen->getWidth() - left); int charHeight = MIN(getCharHeight(chr), _screen->getHeight() - top); byte b = 0, mask = 0xFF; - int y = top; + int y = 0; byte *pIn = getCharData(chr); for (int i = 0; i < charHeight; i++, y++) { @@ -92,7 +92,7 @@ void GfxFontFromResource::draw(uint16 chr, int16 top, int16 left, byte color, bo if ((done & 7) == 0) // fetching next data byte b = *(pIn++) & mask; if (b & 0x80) // if MSB is set - paint it - _screen->putPixel(left + done, y, 1, color, 0, 0); + _screen->putFontPixel(top, left + done, y, color); b = b << 1; } } diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp index a314405eb1..1d3a4ea1f7 100644 --- a/engines/sci/graphics/screen.cpp +++ b/engines/sci/graphics/screen.cpp @@ -223,6 +223,27 @@ void GfxScreen::putPixel(int x, int y, byte drawMask, byte color, byte priority, _controlScreen[offset] = control; } +/** + * This is used to put font pixels onto the screen - we adjust differently, so that we won't + * do triple pixel lines in any case on upscaled hires. That way the font will not get distorted + * Sierra SCI didn't do this + */ +void GfxScreen::putFontPixel(int startingY, int x, int y, byte color) { + int offset = (startingY + y) * _width + x; + + _visualScreen[offset] = color; + if (!_upscaledHires) { + _displayScreen[offset] = color; + } else { + int displayOffset = (_upscaledMapping[startingY] + y * 2) * _displayWidth + x * 2; + _displayScreen[displayOffset] = color; + _displayScreen[displayOffset + 1] = color; + displayOffset += _displayWidth; + _displayScreen[displayOffset] = color; + _displayScreen[displayOffset + 1] = color; + } +} + /** * This will just change a pixel directly on displayscreen. It is supposed to be * only used on upscaled-Hires games where hires content needs to get drawn ONTO diff --git a/engines/sci/graphics/screen.h b/engines/sci/graphics/screen.h index 113cf911a6..900c338bb2 100644 --- a/engines/sci/graphics/screen.h +++ b/engines/sci/graphics/screen.h @@ -83,6 +83,7 @@ public: byte getDrawingMask(byte color, byte prio, byte control); void putPixel(int x, int y, byte drawMask, byte color, byte prio, byte control); + void putFontPixel(int startingY, int x, int y, byte color); void putPixelOnDisplay(int x, int y, byte color); void drawLine(Common::Point startPoint, Common::Point endPoint, byte color, byte prio, byte control); void drawLine(int16 left, int16 top, int16 right, int16 bottom, byte color, byte prio, byte control) { -- cgit v1.2.3