aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2010-07-02 15:58:09 +0000
committerMartin Kiewitz2010-07-02 15:58:09 +0000
commitc1aecd0b9b32efb3a90f653eb36102f18543b49e (patch)
treea0ad46e70eb9d5a2073556e5ff300c166f043458 /engines
parent7fa26648283b1940f952c33251c27eb38d5b89e7 (diff)
downloadscummvm-rg350-c1aecd0b9b32efb3a90f653eb36102f18543b49e.tar.gz
scummvm-rg350-c1aecd0b9b32efb3a90f653eb36102f18543b49e.tar.bz2
scummvm-rg350-c1aecd0b9b32efb3a90f653eb36102f18543b49e.zip
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
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/graphics/font.cpp4
-rw-r--r--engines/sci/graphics/screen.cpp21
-rw-r--r--engines/sci/graphics/screen.h1
3 files changed, 24 insertions, 2 deletions
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<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;
}
}
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
@@ -224,6 +224,27 @@ void GfxScreen::putPixel(int x, int y, byte drawMask, byte color, byte priority,
}
/**
+ * 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
* the upscaled display screen (like japanese fonts, hires portraits, etc.).
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) {