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
This commit is contained in:
Martin Kiewitz 2010-07-02 15:58:09 +00:00
parent 7fa2664828
commit c1aecd0b9b
3 changed files with 24 additions and 2 deletions

View File

@ -82,7 +82,7 @@ void GfxFontFromResource::draw(uint16 chr, int16 top, int16 left, byte color, bo
int charWidth = MIN<int>(getCharWidth(chr), _screen->getWidth() - left);
int charHeight = MIN<int>(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;
}
}

View File

@ -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

View File

@ -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) {