From e4da5e3af48a71b36b8d927151aa08aa498bdcc9 Mon Sep 17 00:00:00 2001 From: Florian Kagerer Date: Fri, 5 Nov 2010 20:36:13 +0000 Subject: GRAPHICS/SJIS: cleanup svn-id: r54099 --- graphics/sjis.cpp | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'graphics/sjis.cpp') diff --git a/graphics/sjis.cpp b/graphics/sjis.cpp index f4724e0feb..06712a9226 100644 --- a/graphics/sjis.cpp +++ b/graphics/sjis.cpp @@ -53,7 +53,7 @@ FontSJIS *FontSJIS::createFont(const Common::Platform platform) { } template -void FontSJISBase::blitCharacter(const uint8 *glyph, const int w, const int h, uint8 *dst, int pitch, Color c1, Color c2, bool shadowClipRight, bool shadowClipBottom) const { +void FontSJISBase::blitCharacter(const uint8 *glyph, const int w, const int h, uint8 *dst, int pitch, Color c) const { for (int y = 0; y < h; ++y) { Color *d = (Color *)dst; dst += pitch; @@ -63,17 +63,9 @@ void FontSJISBase::blitCharacter(const uint8 *glyph, const int w, const int h, u if (!(x % 8)) mask = *glyph++; - if (mask & 0x80) { - *d = c1; - if (_drawMode == kShadowMode || _drawMode == kFMTownsShadowMode) { - if (!(shadowClipRight && (x == w - 1))) - d[1] = c2; - if (!(shadowClipBottom && (y == h - 1))) - d[pitch] = c2; - } - if (_drawMode == kShadowMode && !(shadowClipRight && (x == w - 1)) && !(shadowClipBottom && (y == h - 1))) - d[pitch + 1] = c2; - } + if (mask & 0x80) + *d = c; + ++d; mask <<= 1; } @@ -147,7 +139,6 @@ void FontSJISBase::drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, int width = 0, height = 0; int outlineExtraWidth = 2, outlineExtraHeight = 2; int outlineXOffset = 0, outlineYOffset = 0; - bool shadowClipRight = false, shadowClipBottom = false; if (is8x16(ch)) { glyphSource = getCharData8x16(ch); @@ -163,14 +154,12 @@ void FontSJISBase::drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, width = maxW; outlineExtraWidth = 0; outlineXOffset = 1; - shadowClipRight = true; } if (maxH != -1 && maxH < height) { height = maxH; outlineExtraHeight = 0; outlineYOffset = 1; - shadowClipBottom = true; } if (width <= 0 || height <= 0) @@ -196,15 +185,29 @@ void FontSJISBase::drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1, if (_drawMode == kOutlineMode) { blitCharacter(outline, width + outlineExtraWidth, height + outlineExtraHeight, (uint8 *)dst, pitch, c2); blitCharacter(glyphSource, width - outlineXOffset, height - outlineYOffset, (uint8 *)dst + pitch + 1, pitch, c1); - } else { - blitCharacter(glyphSource, width, height, (uint8 *)dst, pitch, c1, c2, shadowClipRight, shadowClipBottom); + } else { + if (_drawMode != kDefaultMode) { + blitCharacter(glyphSource, width - outlineXOffset, height, ((uint8*)dst) + 1, pitch, c2); + blitCharacter(glyphSource, width, height - outlineYOffset, ((uint8*)dst) + pitch, pitch, c2); + if (_drawMode == kShadowMode) + blitCharacter(glyphSource, width - outlineXOffset, height - outlineYOffset, ((uint8*)dst) + pitch + 1, pitch, c2); + } + + blitCharacter(glyphSource, width, height, (uint8 *)dst, pitch, c1); } } else if (bpp == 2) { if (_drawMode == kOutlineMode) { blitCharacter(outline, width + outlineExtraWidth, height + outlineExtraHeight, (uint8 *)dst, pitch, c2); blitCharacter(glyphSource, width - outlineXOffset, height - outlineYOffset, (uint8 *)dst + pitch + 2, pitch, c1); } else { - blitCharacter(glyphSource, width, height, (uint8 *)dst, pitch, c1, c2, shadowClipRight, shadowClipBottom); + if (_drawMode != kDefaultMode) { + blitCharacter(glyphSource, width - outlineXOffset, height, ((uint8*)dst) + 2, pitch, c2); + blitCharacter(glyphSource, width, height - outlineYOffset, ((uint8*)dst) + pitch, pitch, c2); + if (_drawMode == kShadowMode) + blitCharacter(glyphSource, width - outlineXOffset, height - outlineYOffset, ((uint8*)dst) + pitch + 2, pitch, c2); + } + + blitCharacter(glyphSource, width, height, (uint8 *)dst, pitch, c1); } } else { error("FontSJISBase::drawChar: unsupported bpp: %d", bpp); -- cgit v1.2.3