diff options
author | Walter van Niftrik | 2019-08-01 00:32:11 +0200 |
---|---|---|
committer | Walter van Niftrik | 2019-08-12 02:18:34 +0200 |
commit | 32824ea83f05ee28be5816c30ff14ba57b84ade1 (patch) | |
tree | 746f6f3329c32e7587a177426d9c7e20647105d6 /engines/adl/display_a2.h | |
parent | d5c7e9d2073c54ed284e1aa4e532f36bf68c3818 (diff) | |
download | scummvm-rg350-32824ea83f05ee28be5816c30ff14ba57b84ade1.tar.gz scummvm-rg350-32824ea83f05ee28be5816c30ff14ba57b84ade1.tar.bz2 scummvm-rg350-32824ea83f05ee28be5816c30ff14ba57b84ade1.zip |
ADL: Improve color accuracy
This adds two new display modes to replace the old one. One is a
16-color mode and the other does TV "emulation" based on code in
AppleWin. Both of these modes should deliver more accurate colors,
including NTSC artifact colors.
Diffstat (limited to 'engines/adl/display_a2.h')
-rw-r--r-- | engines/adl/display_a2.h | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/engines/adl/display_a2.h b/engines/adl/display_a2.h index 4e84facd58..8de3a775c7 100644 --- a/engines/adl/display_a2.h +++ b/engines/adl/display_a2.h @@ -36,9 +36,10 @@ public: kGfxWidth = 280, kGfxHeight = 192, kGfxPitch = kGfxWidth / 7, - kGfxSize = kGfxWidth * kGfxHeight, + kGfxSize = kGfxPitch * kGfxHeight, kTextWidth = 40, - kTextHeight = 24 + kTextHeight = 24, + kSplitHeight = 32 }; void init() override; @@ -47,7 +48,7 @@ public: uint getGfxWidth() const { return kGfxWidth; } uint getGfxHeight() const { return kGfxHeight; } uint getGfxPitch() const { return kGfxPitch; } - void loadFrameBuffer(Common::ReadStream &stream, byte *dst); + void loadFrameBuffer(Common::ReadStream &stream, byte *dst) const ; void loadFrameBuffer(Common::ReadStream &stream); void putPixel(const Common::Point &p, byte color); void setPixelByte(const Common::Point &p, byte color); @@ -63,13 +64,60 @@ public: void showCursor(bool enable) override; protected: + class TextReader { + public: + static uint16 getBits(const Display_A2 *display, uint y, uint x) { + const uint charPos = (y >> 3) * kTextWidth + x; + byte m = display->_textBuf[charPos]; + + if (display->_showCursor && charPos == display->_cursorPos) + m = (m & 0x3f) | 0x40; + + byte b = _font[m & 0x3f][y % 8]; + + if (!(m & 0x80) && (!(m & 0x40) || display->_blink)) + b = ~b; + + return b & 0x7f; + } + + static uint8 getStartY(const Display_A2 *display) { + if (display->_mode == kModeText) + return 0; + else + return kGfxHeight - kSplitHeight; + } + + static uint8 getEndY(const Display_A2 *display) { return kGfxHeight; } + }; + + class GfxReader { + public: + static uint16 getBits(const Display_A2 *display, uint y, uint x) { + return display->_frameBuf[y * kGfxPitch + x]; + } + + static uint8 getStartY(const Display_A2 *display) { return 0; } + + static uint8 getEndY(const Display_A2 *display) { + if (display->_mode == kModeGraphics) + return kGfxHeight; + else + return kGfxHeight - kSplitHeight; + } + }; + byte *_frameBuf; bool _showCursor; + bool _enableColor; + bool _enableScanlines; + bool _enableMonoText; + bool _blink; private: void writeFrameBuffer(const Common::Point &p, byte color, byte mask); - virtual void showScanlines(bool enable) { }; + static const byte _font[64][8]; }; Display_A2 *Display_A2_create(); |