aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'graphics')
-rw-r--r--graphics/cursor.h63
-rw-r--r--graphics/fontman.cpp20
-rw-r--r--graphics/fontman.h10
-rw-r--r--graphics/fonts/bdf.cpp4
-rw-r--r--graphics/fonts/bdf.h1
-rw-r--r--graphics/imagedec.h1
-rw-r--r--graphics/maccursor.h12
-rw-r--r--graphics/primitives.h1
-rw-r--r--graphics/scaler/aspect.cpp1
-rw-r--r--graphics/scaler/hq2x_i386.asm1
-rw-r--r--graphics/scaler/hq3x_i386.asm1
-rw-r--r--graphics/scaler/scale2x.cpp1
-rw-r--r--graphics/scaler/scale2x.h1
-rw-r--r--graphics/scaler/scale3x.cpp1
-rw-r--r--graphics/scaler/scale3x.h1
-rw-r--r--graphics/scaler/scalebit.cpp1
-rw-r--r--graphics/scaler/scalebit.h1
-rw-r--r--graphics/scaler/thumbnail_intern.cpp1
-rw-r--r--graphics/sjis.cpp155
-rw-r--r--graphics/sjis.h53
-rw-r--r--graphics/surface.cpp6
-rw-r--r--graphics/thumbnail.cpp18
-rw-r--r--graphics/thumbnail.h3
-rw-r--r--graphics/wincursor.cpp57
-rw-r--r--graphics/wincursor.h14
-rw-r--r--graphics/yuv_to_rgb.cpp7
-rw-r--r--graphics/yuv_to_rgb.h8
27 files changed, 378 insertions, 65 deletions
diff --git a/graphics/cursor.h b/graphics/cursor.h
new file mode 100644
index 0000000000..b04d9c04e2
--- /dev/null
+++ b/graphics/cursor.h
@@ -0,0 +1,63 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GRAPHICS_CURSOR_H
+#define GRAPHICS_CURSOR_H
+
+#include "common/scummsys.h"
+
+namespace Graphics {
+
+/**
+ * A simple cursor representation
+ * TODO: Switch to using Graphics::Surface instead of a byte*
+ */
+class Cursor {
+public:
+ Cursor() {}
+ virtual ~Cursor() {}
+
+ /** Return the cursor's width. */
+ virtual uint16 getWidth() const = 0;
+ /** Return the cursor's height. */
+ virtual uint16 getHeight() const = 0;
+ /** Return the cursor's hotspot's x coordinate. */
+ virtual uint16 getHotspotX() const = 0;
+ /** Return the cursor's hotspot's y coordinate. */
+ virtual uint16 getHotspotY() const = 0;
+ /** Return the cursor's transparent key. */
+ virtual byte getKeyColor() const = 0;
+
+ /** Return the cursor's surface. */
+ virtual const byte *getSurface() const = 0;
+
+ /** Return the cursor's palette in RGB format. */
+ virtual const byte *getPalette() const = 0;
+ /** Return the starting index of the palette. */
+ virtual byte getPaletteStartIndex() const = 0;
+ /** Return the number of colors in the palette. */
+ virtual uint16 getPaletteCount() const = 0;
+};
+
+} // End of namespace Graphics
+
+#endif
diff --git a/graphics/fontman.cpp b/graphics/fontman.cpp
index e59e5a33c5..a10d27a2b0 100644
--- a/graphics/fontman.cpp
+++ b/graphics/fontman.cpp
@@ -79,6 +79,26 @@ bool FontManager::assignFontToName(const Common::String &name, const Font *font)
return true;
}
+bool FontManager::setFont(FontUsage usage, const Font *font) {
+ switch (usage) {
+ case kConsoleFont:
+ delete g_consolefont;
+ g_consolefont = (const BdfFont *)font;
+ break;
+ case kGUIFont:
+ delete g_sysfont;
+ g_sysfont = (const BdfFont *)font;
+ break;
+ case kBigGUIFont:
+ delete g_sysfont_big;
+ g_sysfont_big = (const BdfFont *)font;
+ break;
+ default:
+ return false;
+ }
+ return true;
+}
+
void FontManager::removeFontName(const Common::String &name) {
Common::String lowercaseName = name;
lowercaseName.toLowercase();
diff --git a/graphics/fontman.h b/graphics/fontman.h
index 858a733d45..09c1a198ff 100644
--- a/graphics/fontman.h
+++ b/graphics/fontman.h
@@ -60,6 +60,16 @@ public:
bool assignFontToName(const Common::String &name, const Font *font);
/**
+ * Associates a BDF font object with an 'usage'. This is useful for platforms
+ * with a screen DPI much larger than a regular desktop workstation.
+ *
+ * @param name the name of the font
+ * @param font the font object
+ * @return true on success, false on failure
+ */
+ bool setFont(FontUsage usage, const Font *font);
+
+ /**
* Removes binding from name to font
*
* @param name name which should be removed
diff --git a/graphics/fonts/bdf.cpp b/graphics/fonts/bdf.cpp
index b7d0f7749e..58c48ed877 100644
--- a/graphics/fonts/bdf.cpp
+++ b/graphics/fonts/bdf.cpp
@@ -81,7 +81,8 @@ void drawCharIntern(byte *ptr, uint pitch, const bitmap_t *src, int h, int minX,
void BdfFont::drawChar(Surface *dst, byte chr, const int tx, const int ty, const uint32 color) const {
assert(dst != 0);
- assert(_desc.bits != 0 && _desc.maxwidth <= 16);
+ // asserting _desc.maxwidth <= 50: let the theme designer decide what looks best
+ assert(_desc.bits != 0 && _desc.maxwidth <= 50);
assert(dst->format.bytesPerPixel == 1 || dst->format.bytesPerPixel == 2);
// If this character is not included in the font, use the default char.
@@ -793,4 +794,3 @@ BdfFont *BdfFont::loadFromCache(Common::SeekableReadStream &stream) {
}
} // End of namespace Graphics
-
diff --git a/graphics/fonts/bdf.h b/graphics/fonts/bdf.h
index 31c009eb27..0d60693736 100644
--- a/graphics/fonts/bdf.h
+++ b/graphics/fonts/bdf.h
@@ -97,4 +97,3 @@ public:
} // End of namespace Graphics
#endif
-
diff --git a/graphics/imagedec.h b/graphics/imagedec.h
index da45ecca4f..e839d097b2 100644
--- a/graphics/imagedec.h
+++ b/graphics/imagedec.h
@@ -64,4 +64,3 @@ public:
} // End of namespace Graphics
#endif
-
diff --git a/graphics/maccursor.h b/graphics/maccursor.h
index cca7f3456b..f5efc20655 100644
--- a/graphics/maccursor.h
+++ b/graphics/maccursor.h
@@ -28,18 +28,19 @@
* - scumm
*/
-#include "common/stream.h"
-
#ifndef GRAPHICS_MACCURSOR_H
#define GRAPHICS_MACCURSOR_H
+#include "common/stream.h"
+
+#include "graphics/cursor.h"
+
namespace Graphics {
/**
* A Mac crsr or CURS cursor
- * TODO: Think about making a base class with WinCursor
*/
-class MacCursor {
+class MacCursor : public Cursor {
public:
MacCursor();
~MacCursor();
@@ -56,7 +57,10 @@ public:
byte getKeyColor() const { return 0xFF; }
const byte *getSurface() const { return _surface; }
+
const byte *getPalette() const { return _palette; }
+ byte getPaletteStartIndex() const { return 0; }
+ uint16 getPaletteCount() const { return 256; }
/** Read the cursor's data out of a stream. */
bool readFromStream(Common::SeekableReadStream &stream, bool forceMonochrome = false);
diff --git a/graphics/primitives.h b/graphics/primitives.h
index 6055404b96..0ab2dabcd8 100644
--- a/graphics/primitives.h
+++ b/graphics/primitives.h
@@ -30,4 +30,3 @@ void drawThickLine(int x0, int y0, int x1, int y1, int thickness, int color, voi
} // End of namespace Graphics
#endif
-
diff --git a/graphics/scaler/aspect.cpp b/graphics/scaler/aspect.cpp
index b12fac418b..7ad37b1ba8 100644
--- a/graphics/scaler/aspect.cpp
+++ b/graphics/scaler/aspect.cpp
@@ -292,4 +292,3 @@ void Normal2xAspect(const uint8 *srcPtr,
}
#endif // USE_ARM_SCALER_ASM
-
diff --git a/graphics/scaler/hq2x_i386.asm b/graphics/scaler/hq2x_i386.asm
index 9393f00e01..4f8e0713b7 100644
--- a/graphics/scaler/hq2x_i386.asm
+++ b/graphics/scaler/hq2x_i386.asm
@@ -1901,4 +1901,3 @@ FuncTable2:
%ifidn __OUTPUT_FORMAT__,elf
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
-
diff --git a/graphics/scaler/hq3x_i386.asm b/graphics/scaler/hq3x_i386.asm
index 92c0058711..209a7b8a34 100644
--- a/graphics/scaler/hq3x_i386.asm
+++ b/graphics/scaler/hq3x_i386.asm
@@ -2477,4 +2477,3 @@ FuncTable2:
%ifidn __OUTPUT_FORMAT__,elf
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
-
diff --git a/graphics/scaler/scale2x.cpp b/graphics/scaler/scale2x.cpp
index ec2aa2086e..ac2dbadefa 100644
--- a/graphics/scaler/scale2x.cpp
+++ b/graphics/scaler/scale2x.cpp
@@ -500,4 +500,3 @@ void scale2x_32_mmx(scale2x_uint32* dst0, scale2x_uint32* dst1, const scale2x_ui
}
#endif
-
diff --git a/graphics/scaler/scale2x.h b/graphics/scaler/scale2x.h
index a6365c113e..b0c887d43c 100644
--- a/graphics/scaler/scale2x.h
+++ b/graphics/scaler/scale2x.h
@@ -66,4 +66,3 @@ extern "C" void scale2x_32_arm(scale2x_uint32* dst0, scale2x_uint32* dst1, const
#endif
#endif
-
diff --git a/graphics/scaler/scale3x.cpp b/graphics/scaler/scale3x.cpp
index 788c8694c5..4ce738a37a 100644
--- a/graphics/scaler/scale3x.cpp
+++ b/graphics/scaler/scale3x.cpp
@@ -220,4 +220,3 @@ void scale3x_32_def(scale3x_uint32* dst0, scale3x_uint32* dst1, scale3x_uint32*
scale3x_32_def_center(dst1, src0, src1, src2, count);
scale3x_32_def_border(dst2, src2, src1, src0, count);
}
-
diff --git a/graphics/scaler/scale3x.h b/graphics/scaler/scale3x.h
index 671a207570..ad5604d086 100644
--- a/graphics/scaler/scale3x.h
+++ b/graphics/scaler/scale3x.h
@@ -38,4 +38,3 @@ void scale3x_16_def(scale3x_uint16* dst0, scale3x_uint16* dst1, scale3x_uint16*
void scale3x_32_def(scale3x_uint32* dst0, scale3x_uint32* dst1, scale3x_uint32* dst2, const scale3x_uint32* src0, const scale3x_uint32* src1, const scale3x_uint32* src2, unsigned count);
#endif
-
diff --git a/graphics/scaler/scalebit.cpp b/graphics/scaler/scalebit.cpp
index c6d2a0d752..c8b54f4b25 100644
--- a/graphics/scaler/scalebit.cpp
+++ b/graphics/scaler/scalebit.cpp
@@ -340,4 +340,3 @@ void scale(unsigned scale, void* void_dst, unsigned dst_slice, const void* void_
break;
}
}
-
diff --git a/graphics/scaler/scalebit.h b/graphics/scaler/scalebit.h
index dd46883f97..6e4a30caf0 100644
--- a/graphics/scaler/scalebit.h
+++ b/graphics/scaler/scalebit.h
@@ -40,4 +40,3 @@ int scale_precondition(unsigned scale, unsigned pixel, unsigned width, unsigned
void scale(unsigned scale, void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height);
#endif
-
diff --git a/graphics/scaler/thumbnail_intern.cpp b/graphics/scaler/thumbnail_intern.cpp
index 154763070a..ef540b8cd8 100644
--- a/graphics/scaler/thumbnail_intern.cpp
+++ b/graphics/scaler/thumbnail_intern.cpp
@@ -236,4 +236,3 @@ bool createThumbnail(Graphics::Surface *surf, const uint8 *pixels, int w, int h,
return createThumbnail(*surf, screen);
}
-
diff --git a/graphics/sjis.cpp b/graphics/sjis.cpp
index 10c780b156..4dd24d9dcc 100644
--- a/graphics/sjis.cpp
+++ b/graphics/sjis.cpp
@@ -40,10 +40,27 @@ FontSJIS *FontSJIS::createFont(const Common::Platform platform) {
// Try the font ROM of the specified platform
if (platform == Common::kPlatformFMTowns) {
ret = new FontTowns();
- if (ret && ret->loadData())
- return ret;
+ if (ret) {
+ if (ret->loadData())
+ return ret;
+ }
delete ret;
- }
+ } else if (platform == Common::kPlatformPCEngine) {
+ ret = new FontPCEngine();
+ if (ret) {
+ if (ret->loadData())
+ return ret;
+ }
+ delete ret;
+ } // TODO: PC98 font rom support
+ /* else if (platform == Common::kPlatformPC98) {
+ ret = new FontPC98();
+ if (ret) {
+ if (ret->loadData())
+ return ret;
+ }
+ delete ret;
+ }*/
// Try ScummVM's font.
ret = new FontSjisSVM(platform);
@@ -59,15 +76,21 @@ void FontSJIS::drawChar(Graphics::Surface &dst, uint16 ch, int x, int y, uint32
}
FontSJISBase::FontSJISBase()
- : _drawMode(kDefaultMode), _flippedMode(false), _fontWidth(16), _fontHeight(16) {
+ : _drawMode(kDefaultMode), _flippedMode(false), _fontWidth(16), _fontHeight(16), _bitPosNewLineMask(0) {
}
void FontSJISBase::setDrawingMode(DrawingMode mode) {
- _drawMode = mode;
+ if (hasFeature(1 << mode))
+ _drawMode = mode;
+ else
+ warning("Unsupported drawing mode selected");
}
void FontSJISBase::toggleFlippedMode(bool enable) {
- _flippedMode = enable;
+ if (hasFeature(kFeatFlipped))
+ _flippedMode = enable;
+ else
+ warning("Flipped mode unsupported by this font");
}
uint FontSJISBase::getFontHeight() const {
@@ -98,26 +121,30 @@ uint FontSJISBase::getMaxFontWidth() const {
uint FontSJISBase::getCharWidth(uint16 ch) const {
if (isASCII(ch))
- return (_drawMode == kOutlineMode) ? 10 : (_drawMode == kDefaultMode ? 8 : 9);
+ return ((_drawMode == kOutlineMode) ? 10 : (_drawMode == kDefaultMode ? 8 : 9));
else
return getMaxFontWidth();
}
template<typename Color>
void FontSJISBase::blitCharacter(const uint8 *glyph, const int w, const int h, uint8 *dst, int pitch, Color c) const {
+ uint8 bitPos = 0;
+ uint8 mask = 0;
+
for (int y = 0; y < h; ++y) {
Color *d = (Color *)dst;
dst += pitch;
- uint8 mask = 0;
+ bitPos &= _bitPosNewLineMask;
for (int x = 0; x < w; ++x) {
- if (!(x % 8))
+ if (!(bitPos % 8))
mask = *glyph++;
if (mask & 0x80)
*d = c;
++d;
+ ++bitPos;
mask <<= 1;
}
}
@@ -176,9 +203,6 @@ const uint8 *FontSJISBase::flipCharacter(const uint8 *glyph, const int w) const
0x0F, 0x8F, 0x4F, 0xC7, 0x2F, 0xAF, 0x6F, 0xEF, 0x1F, 0x97, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF
};
- // TODO: This code looks like it will only work with 16 pixel wide
- // characters we should really take care that we only call it on these
- // or we fix this to support a generic width.
for (int i = 0; i < w; i++) {
_tempGlyph[i] = flipData[glyph[(w * 2 - 1) - i]];
_tempGlyph[(w * 2 - 1) - i] = flipData[glyph[i]];
@@ -225,9 +249,6 @@ void FontSJISBase::drawChar(void *dst, uint16 ch, int pitch, int bpp, uint32 c1,
}
#ifndef DISABLE_FLIPPED_MODE
- // TODO: This code inside flopCharater looks like it will only work with
- // 16 pixel wide characters we should really take care that we only call
- // it on these or we fix it to support a generic width.
if (_flippedMode)
glyphSource = flipCharacter(glyphSource, width);
#endif
@@ -303,7 +324,7 @@ const uint8 *FontTowns::getCharData(uint16 ch) const {
uint8 f = ch & 0xFF;
uint8 s = ch >> 8;
- // copied from scumm\charset.cpp
+ // moved from scumm\charset.cpp
enum {
KANA = 0,
KANJI = 1,
@@ -392,6 +413,98 @@ const uint8 *FontTowns::getCharData(uint16 ch) const {
}
}
+bool FontTowns::hasFeature(int feat) const {
+ static const int features = kFeatDefault | kFeatOutline | kFeatShadow | kFeatFMTownsShadow | kFeatFlipped;
+ return (features & feat) ? true : false;
+}
+
+// PC-Engine ROM font
+
+bool FontPCEngine::loadData() {
+ Common::SeekableReadStream *data = SearchMan.createReadStreamForMember("pce.cdbios");
+ if (!data)
+ return false;
+
+ data->seek((data->size() & 0x200) ? 0x30200 : 0x30000);
+ data->read(_fontData12x12, kFont12x12Chars * 18);
+
+ _fontWidth = _fontHeight = 12;
+ _bitPosNewLineMask = _fontWidth & 7;
+
+ bool retValue = !data->err();
+ delete data;
+ return retValue;
+}
+
+const uint8 *FontPCEngine::getCharData(uint16 ch) const {
+ // Converts sjis code to pce font offset
+ // (moved from scumm\charset.cpp).
+ // rangeTbl maps SJIS char-codes to the PCE System Card font rom.
+ // Each pair {<upperBound>,<lowerBound>} in the array represents a SJIS range.
+ const int rangeCnt = 45;
+ static const uint16 rangeTbl[rangeCnt][2] = {
+ // Symbols
+ {0x8140,0x817E},{0x8180,0x81AC},
+ // 0-9
+ {0x824F,0x8258},
+ // Latin upper
+ {0x8260,0x8279},
+ // Latin lower
+ {0x8281,0x829A},
+ // Kana
+ {0x829F,0x82F1},{0x8340,0x837E},{0x8380,0x8396},
+ // Greek upper
+ {0x839F,0x83B6},
+ // Greek lower
+ {0x83BF,0x83D6},
+ // Cyrillic upper
+ {0x8440,0x8460},
+ // Cyrillic lower
+ {0x8470,0x847E},{0x8480,0x8491},
+ // Kanji
+ {0x889F,0x88FC},
+ {0x8940,0x897E},{0x8980,0x89FC},
+ {0x8A40,0x8A7E},{0x8A80,0x8AFC},
+ {0x8B40,0x8B7E},{0x8B80,0x8BFC},
+ {0x8C40,0x8C7E},{0x8C80,0x8CFC},
+ {0x8D40,0x8D7E},{0x8D80,0x8DFC},
+ {0x8E40,0x8E7E},{0x8E80,0x8EFC},
+ {0x8F40,0x8F7E},{0x8F80,0x8FFC},
+ {0x9040,0x907E},{0x9080,0x90FC},
+ {0x9140,0x917E},{0x9180,0x91FC},
+ {0x9240,0x927E},{0x9280,0x92FC},
+ {0x9340,0x937E},{0x9380,0x93FC},
+ {0x9440,0x947E},{0x9480,0x94FC},
+ {0x9540,0x957E},{0x9580,0x95FC},
+ {0x9640,0x967E},{0x9680,0x96FC},
+ {0x9740,0x977E},{0x9780,0x97FC},
+ {0x9840,0x9872}
+ };
+
+ ch = (ch << 8) | (ch >> 8);
+ int offset = 0;
+ for (int i = 0; i < rangeCnt; ++i) {
+ if (ch >= rangeTbl[i][0] && ch <= rangeTbl[i][1]) {
+ return _fontData12x12 + 18 * (offset + ch - rangeTbl[i][0]);
+ break;
+ }
+ offset += rangeTbl[i][1] - rangeTbl[i][0] + 1;
+ }
+
+ debug(4, "Invalid Char: 0x%x", ch);
+ return 0;
+}
+
+bool FontPCEngine::hasFeature(int feat) const {
+ // Outline mode not supported due to use of _bitPosNewLineMask. This could be implemented,
+ // but is not needed for any particular target at the moment.
+ // Flipped mode is also not supported since the hard coded table (taken from SCUMM 5 FM-TOWNS)
+ // is set up for font sizes of 8/16. This mode is also not required at the moment, since
+ // there aren't any SCUMM 5 PC-Engine games.
+ static const int features = kFeatDefault | kFeatShadow | kFeatFMTownsShadow;
+ return (features & feat) ? true : false;
+}
+
// ScummVM SJIS font
FontSjisSVM::FontSjisSVM(const Common::Platform platform)
@@ -464,6 +577,15 @@ const uint8 *FontSjisSVM::getCharData(uint16 c) const {
return getCharDataDefault(c);
}
+bool FontSjisSVM::hasFeature(int feat) const {
+ // Flipped mode is not supported since the hard coded table (taken from SCUMM 5 FM-TOWNS)
+ // is set up for font sizes of 8/16. This mode is also not required at the moment, since
+ // there aren't any SCUMM 5 PC-Engine games.
+ static const int features16 = kFeatDefault | kFeatOutline | kFeatShadow | kFeatFMTownsShadow | kFeatFlipped;
+ static const int features12 = kFeatDefault | kFeatOutline | kFeatShadow | kFeatFMTownsShadow;
+ return (((_fontWidth == 12) ? features12 : features16) & feat) ? true : false;
+}
+
const uint8 *FontSjisSVM::getCharDataPCE(uint16 c) const {
if (isASCII(c))
return 0;
@@ -533,4 +655,3 @@ void FontSjisSVM::mapKANJIChar(const uint8 fB, const uint8 sB, int &base, int &i
} // End of namespace Graphics
#endif // defined(GRAPHICS_SJIS_H)
-
diff --git a/graphics/sjis.h b/graphics/sjis.h
index 62e68013da..185b6cc593 100644
--- a/graphics/sjis.h
+++ b/graphics/sjis.h
@@ -75,7 +75,7 @@ public:
virtual bool loadData() = 0;
/**
- * Enable drawing with outline or shadow.
+ * Enable drawing with outline or shadow if supported by the Font.
*
* After changing outline state, getFontHeight and getMaxFontWidth / getCharWidth might return
* different values!
@@ -90,11 +90,17 @@ public:
virtual void setDrawingMode(DrawingMode mode) {}
/**
- * Enable flipped character drawing (e.g. in the MI1 circus scene after Guybrush gets shot out of the cannon).
+ * Enable flipped character drawing if supported by the Font (e.g. in the MI1 circus scene after Guybrush gets shot out of the cannon).
*/
virtual void toggleFlippedMode(bool enable) {}
/**
+ * Set spacing between characters and lines. This affects font height / char width
+ */
+ virtual void setCharSpacing(int spacing) {}
+ virtual void setLineSpacing(int spacing) {}
+
+ /**
* Returns the height of the font.
*/
virtual uint getFontHeight() const = 0;
@@ -162,16 +168,27 @@ protected:
DrawingMode _drawMode;
bool _flippedMode;
int _fontWidth, _fontHeight;
-
+ uint8 _bitPosNewLineMask;
+
bool isASCII(uint16 ch) const;
virtual const uint8 *getCharData(uint16 c) const = 0;
+
+ enum DrawingFeature {
+ kFeatDefault = 1 << 0,
+ kFeatOutline = 1 << 1,
+ kFeatShadow = 1 << 2,
+ kFeatFMTownsShadow = 1 << 3,
+ kFeatFlipped = 1 << 4
+ };
+
+ virtual bool hasFeature(int feat) const = 0;
};
/**
* FM-TOWNS ROM based SJIS compatible font.
*
- * This is used in KYRA and SCI.
+ * This is used in KYRA, SCUMM and SCI.
*/
class FontTowns : public FontSJISBase {
public:
@@ -189,6 +206,31 @@ private:
uint8 _fontData8x16[kFont8x16Chars * 32];
virtual const uint8 *getCharData(uint16 c) const;
+
+ bool hasFeature(int feat) const;
+};
+
+/**
+ * PC-Engine System Card based SJIS compatible font.
+ *
+ * This is used in LOOM.
+ */
+class FontPCEngine : public FontSJISBase {
+public:
+ /**
+ * Loads the ROM data from "pce.cdbios".
+ */
+ bool loadData();
+private:
+ enum {
+ kFont12x12Chars = 3418
+ };
+
+ uint8 _fontData12x12[kFont12x12Chars * 18];
+
+ virtual const uint8 *getCharData(uint16 c) const;
+
+ bool hasFeature(int feat) const;
};
/**
@@ -215,6 +257,8 @@ private:
virtual const uint8 *getCharData(uint16 c) const;
+ bool hasFeature(int feat) const;
+
const uint8 *getCharDataPCE(uint16 c) const;
const uint8 *getCharDataDefault(uint16 c) const;
@@ -228,4 +272,3 @@ private:
#endif
#endif // engine and dynamic plugins guard
-
diff --git a/graphics/surface.cpp b/graphics/surface.cpp
index 0fad25734c..e0b25f22e9 100644
--- a/graphics/surface.cpp
+++ b/graphics/surface.cpp
@@ -56,8 +56,10 @@ void Surface::create(uint16 width, uint16 height, const PixelFormat &f) {
format = f;
pitch = w * format.bytesPerPixel;
- pixels = calloc(width * height, format.bytesPerPixel);
- assert(pixels);
+ if (width && height) {
+ pixels = calloc(width * height, format.bytesPerPixel);
+ assert(pixels);
+ }
}
void Surface::free() {
diff --git a/graphics/thumbnail.cpp b/graphics/thumbnail.cpp
index 5fad25967e..db61d828d2 100644
--- a/graphics/thumbnail.cpp
+++ b/graphics/thumbnail.cpp
@@ -94,23 +94,24 @@ bool skipThumbnail(Common::SeekableReadStream &in) {
return true;
}
-bool loadThumbnail(Common::SeekableReadStream &in, Graphics::Surface &to) {
+Graphics::Surface *loadThumbnail(Common::SeekableReadStream &in) {
ThumbnailHeader header;
if (!loadHeader(in, header, true))
- return false;
+ return 0;
if (header.bpp != 2) {
warning("trying to load thumbnail with unsupported bit depth %d", header.bpp);
- return false;
+ return 0;
}
Graphics::PixelFormat format = g_system->getOverlayFormat();
- to.create(header.width, header.height, format);
+ Graphics::Surface *const to = new Graphics::Surface();
+ to->create(header.width, header.height, format);
- OverlayColor *pixels = (OverlayColor *)to.pixels;
- for (int y = 0; y < to.h; ++y) {
- for (int x = 0; x < to.w; ++x) {
+ OverlayColor *pixels = (OverlayColor *)to->pixels;
+ for (int y = 0; y < to->h; ++y) {
+ for (int x = 0; x < to->w; ++x) {
uint8 r, g, b;
colorToRGB<ColorMasks<565> >(in.readUint16BE(), r, g, b);
@@ -119,7 +120,7 @@ bool loadThumbnail(Common::SeekableReadStream &in, Graphics::Surface &to) {
}
}
- return true;
+ return to;
}
bool saveThumbnail(Common::WriteStream &out) {
@@ -166,4 +167,3 @@ bool saveThumbnail(Common::WriteStream &out, const Graphics::Surface &thumb) {
}
} // End of namespace Graphics
-
diff --git a/graphics/thumbnail.h b/graphics/thumbnail.h
index bf48fd1189..df99568f42 100644
--- a/graphics/thumbnail.h
+++ b/graphics/thumbnail.h
@@ -53,7 +53,7 @@ bool skipThumbnail(Common::SeekableReadStream &in);
* The loaded thumbnail will be automatically converted to the
* current overlay pixelformat.
*/
-bool loadThumbnail(Common::SeekableReadStream &in, Graphics::Surface &to);
+Graphics::Surface *loadThumbnail(Common::SeekableReadStream &in);
/**
* Saves a thumbnail to the given write stream.
@@ -69,4 +69,3 @@ bool saveThumbnail(Common::WriteStream &out, const Graphics::Surface &thumb);
} // End of namespace Graphics
#endif
-
diff --git a/graphics/wincursor.cpp b/graphics/wincursor.cpp
index 6208f5f053..2db72a2874 100644
--- a/graphics/wincursor.cpp
+++ b/graphics/wincursor.cpp
@@ -308,4 +308,61 @@ WinCursorGroup *WinCursorGroup::createCursorGroup(Common::PEResources &exe, cons
return group;
}
+/**
+ * The default Windows cursor
+ */
+class DefaultWinCursor : public Cursor {
+public:
+ DefaultWinCursor() {}
+ ~DefaultWinCursor() {}
+
+ uint16 getWidth() const { return 12; }
+ uint16 getHeight() const { return 20; }
+ uint16 getHotspotX() const { return 0; }
+ uint16 getHotspotY() const { return 0; }
+ byte getKeyColor() const { return 0; }
+
+ const byte *getSurface() const {
+ static const byte defaultCursor[] = {
+ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0,
+ 1, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0,
+ 1, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0,
+ 1, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0,
+ 1, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0,
+ 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0,
+ 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0,
+ 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1,
+ 1, 2, 2, 2, 1, 2, 2, 1, 0, 0, 0, 0,
+ 1, 2, 2, 1, 1, 2, 2, 1, 0, 0, 0, 0,
+ 1, 2, 1, 0, 1, 1, 2, 2, 1, 0, 0, 0,
+ 1, 1, 0, 0, 0, 1, 2, 2, 1, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 1, 2, 2, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 2, 2, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0
+ };
+
+ return defaultCursor;
+ }
+
+ const byte *getPalette() const {
+ static const byte bwPalette[] = {
+ 0x00, 0x00, 0x00, // Black
+ 0xFF, 0xFF, 0xFF // White
+ };
+
+ return bwPalette;
+ }
+ byte getPaletteStartIndex() const { return 1; }
+ uint16 getPaletteCount() const { return 2; }
+};
+
+Cursor *makeDefaultWinCursor() {
+ return new DefaultWinCursor();
+}
+
} // End of namespace Graphics
diff --git a/graphics/wincursor.h b/graphics/wincursor.h
index 86693db88b..e6b35dc80c 100644
--- a/graphics/wincursor.h
+++ b/graphics/wincursor.h
@@ -26,6 +26,8 @@
#include "common/array.h"
#include "common/winexe.h"
+#include "graphics/cursor.h"
+
namespace Common {
class NEResources;
class PEResources;
@@ -35,7 +37,7 @@ class SeekableReadStream;
namespace Graphics {
/** A Windows cursor. */
-class WinCursor {
+class WinCursor : public Cursor {
public:
WinCursor();
~WinCursor();
@@ -52,7 +54,10 @@ public:
byte getKeyColor() const;
const byte *getSurface() const { return _surface; }
+
const byte *getPalette() const { return _palette; }
+ byte getPaletteStartIndex() const { return 0; }
+ uint16 getPaletteCount() const { return 256; }
/** Read the cursor's data out of a stream. */
bool readFromStream(Common::SeekableReadStream &stream);
@@ -97,6 +102,13 @@ struct WinCursorGroup {
static WinCursorGroup *createCursorGroup(Common::PEResources &exe, const Common::WinResourceID &id);
};
+/**
+ * Create a Cursor for the default Windows cursor.
+ *
+ * @note The calling code is responsible for deleting the returned pointer.
+ */
+Cursor *makeDefaultWinCursor();
+
} // End of namespace Graphics
#endif
diff --git a/graphics/yuv_to_rgb.cpp b/graphics/yuv_to_rgb.cpp
index bdc481016e..feda48bf6d 100644
--- a/graphics/yuv_to_rgb.cpp
+++ b/graphics/yuv_to_rgb.cpp
@@ -8,19 +8,16 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
// The YUV to RGB conversion code is derived from SDL's YUV overlay code, which
diff --git a/graphics/yuv_to_rgb.h b/graphics/yuv_to_rgb.h
index 9b561f2002..2d3b9e634e 100644
--- a/graphics/yuv_to_rgb.h
+++ b/graphics/yuv_to_rgb.h
@@ -8,24 +8,22 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * $URL$
- * $Id$
- *
*/
/**
* @file
* YUV to RGB conversion used in engines:
+ * - scumm (he)
* - sword25
*/