aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorFlorian Kagerer2010-10-17 13:08:00 +0000
committerFlorian Kagerer2010-10-17 13:08:00 +0000
commitc841c3fb7c9b93d48512c4480753ca409770990f (patch)
tree8e54a799b750048d770f5778c7ad4d64b8ff4778 /graphics
parent728a231d7b8b392b933e507f17f20afe91fd0eed (diff)
downloadscummvm-rg350-c841c3fb7c9b93d48512c4480753ca409770990f.tar.gz
scummvm-rg350-c841c3fb7c9b93d48512c4480753ca409770990f.tar.bz2
scummvm-rg350-c841c3fb7c9b93d48512c4480753ca409770990f.zip
SCUMM/FM-TOWNS: more improvements to japanese font drawing
- made use of LordHotos graphics/sjis code to reduce code duplication - japanese mode for version 3 and 5 works fine now with few exceptions (some line spacing glitches in MI1 intro etc.) svn-id: r53554
Diffstat (limited to 'graphics')
-rw-r--r--graphics/sjis.cpp23
-rw-r--r--graphics/sjis.h24
2 files changed, 30 insertions, 17 deletions
diff --git a/graphics/sjis.cpp b/graphics/sjis.cpp
index af286346ca..97375c884b 100644
--- a/graphics/sjis.cpp
+++ b/graphics/sjis.cpp
@@ -53,7 +53,7 @@ FontSJIS *FontSJIS::createFont(const Common::Platform platform) {
}
template<typename Color>
-void FontSJISBase::blitCharacter(const uint8 *glyph, const int w, const int h, uint8 *dst, int pitch, Color c) const {
+void FontSJISBase::blitCharacter(const uint8 *glyph, const int w, const int h, uint8 *dst, int pitch, Color c1, Color c2) const {
for (int y = 0; y < h; ++y) {
Color *d = (Color *)dst;
dst += pitch;
@@ -63,8 +63,13 @@ void FontSJISBase::blitCharacter(const uint8 *glyph, const int w, const int h, u
if (!(x % 8))
mask = *glyph++;
- if (mask & 0x80)
- *d = c;
+ if (mask & 0x80) {
+ *d = c1;
+ if (_shadowType == kShadowTypeScumm3 || _shadowType == kShadowTypeScumm3Towns)
+ d[1] = d[pitch] = c2;
+ if (_shadowType == kShadowTypeScumm3)
+ d[pitch + 1] = c2;
+ }
++d;
mask <<= 1;
}
@@ -122,24 +127,24 @@ void FontSJISBase::drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1,
}
uint8 outline[18 * 18];
- if (_outlineEnabled) {
+ if (_shadowType == kShadowTypeOutline) {
memset(outline, 0, sizeof(outline));
createOutline(outline, glyphSource, width, height);
}
if (bpp == 1) {
- if (_outlineEnabled) {
+ if (_shadowType == kShadowTypeOutline) {
blitCharacter<uint8>(outline, width + 2, height + 2, (uint8 *)dst, pitch, c2);
blitCharacter<uint8>(glyphSource, width, height, (uint8 *)dst + pitch + 1, pitch, c1);
} else {
- blitCharacter<uint8>(glyphSource, width, height, (uint8 *)dst, pitch, c1);
+ blitCharacter<uint8>(glyphSource, width, height, (uint8 *)dst, pitch, c1, c2);
}
} else if (bpp == 2) {
- if (_outlineEnabled) {
+ if (_shadowType == kShadowTypeOutline) {
blitCharacter<uint16>(outline, width + 2, height + 2, (uint8 *)dst, pitch, c2);
blitCharacter<uint16>(glyphSource, width, height, (uint8 *)dst + pitch + 2, pitch, c1);
} else {
- blitCharacter<uint16>(glyphSource, width, height, (uint8 *)dst, pitch, c1);
+ blitCharacter<uint16>(glyphSource, width, height, (uint8 *)dst, pitch, c1, c2);
}
} else {
error("FontSJISBase::drawChar: unsupported bpp: %d", bpp);
@@ -148,7 +153,7 @@ void FontSJISBase::drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1,
uint FontSJISBase::getCharWidth(uint16 ch) const {
if (is8x16(ch))
- return _outlineEnabled ? 10 : 8;
+ return (_shadowType == kShadowTypeOutline) ? 10 : (_shadowType == kShadowTypeNone ? 8 : 9);
else
return getMaxFontWidth();
}
diff --git a/graphics/sjis.h b/graphics/sjis.h
index e0b760fc78..b6e99c7f91 100644
--- a/graphics/sjis.h
+++ b/graphics/sjis.h
@@ -71,12 +71,19 @@ public:
virtual bool loadData() = 0;
/**
- * Enable outline drawing.
+ * Enable outline/shadow drawing.
*
* After changing outline state, getFontHeight and getMaxFontWidth / getCharWidth might return
* different values!
*/
- virtual void enableOutline(bool enable) {}
+ enum ShadowType {
+ kShadowTypeNone,
+ kShadowTypeOutline,
+ kShadowTypeScumm3,
+ kShadowTypeScumm3Towns
+ };
+
+ virtual void setShadowMode(ShadowType type) {}
/**
* Returns the height of the font.
@@ -122,22 +129,23 @@ public:
*/
class FontSJISBase : public FontSJIS {
public:
- FontSJISBase() : _outlineEnabled(false) {}
+ FontSJISBase() : _shadowType(kShadowTypeNone) {}
- void enableOutline(bool enable) { _outlineEnabled = enable; }
+ void setShadowMode(ShadowType type) { _shadowType = type; }
- uint getFontHeight() const { return _outlineEnabled ? 18 : 16; }
- uint getMaxFontWidth() const { return _outlineEnabled ? 18 : 16; }
+ uint getFontHeight() const { return (_shadowType == kShadowTypeOutline) ? 18 : (_shadowType == kShadowTypeNone ? 16 : 17); }
+
+ uint getMaxFontWidth() const { return (_shadowType == kShadowTypeOutline) ? 18 : (_shadowType == kShadowTypeNone ? 16 : 17); }
uint getCharWidth(uint16 ch) const;
void drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, uint32 c2) const;
private:
template<typename Color>
- void blitCharacter(const uint8 *glyph, const int w, const int h, uint8 *dst, int pitch, Color c) const;
+ void blitCharacter(const uint8 *glyph, const int w, const int h, uint8 *dst, int pitch, Color c1, Color c2 = 0) const;
void createOutline(uint8 *outline, const uint8 *glyph, const int w, const int h) const;
protected:
- bool _outlineEnabled;
+ ShadowType _shadowType;
bool is8x16(uint16 ch) const;