| 1 |
#ifndef CHARACTERCONVERTER_HH |
| 2 |
#define CHARACTERCONVERTER_HH |
| 3 |
|
| 4 |
#include <cstdint> |
| 5 |
#include <span> |
| 6 |
|
| 7 |
namespace openmsx { |
| 8 |
|
| 9 |
class VDP; |
| 10 |
class VDPVRAM; |
| 11 |
class DisplayMode; |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
class CharacterConverter |
| 17 |
{ |
| 18 |
public: |
| 19 |
using Pixel = uint32_t; |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
CharacterConverter(VDP& vdp, std::span<const Pixel, 16> palFg, std::span<const Pixel, 16> palBg); |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
void convertLine(std::span<Pixel> buf, int line) const; |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
void setDisplayMode(DisplayMode mode); |
| 48 |
|
| 49 |
private: |
| 50 |
inline void renderText1 (std::span<Pixel, 256> buf, int line) const; |
| 51 |
inline void renderText1Q (std::span<Pixel, 256> buf, int line) const; |
| 52 |
inline void renderText2 (std::span<Pixel, 512> buf, int line) const; |
| 53 |
inline void renderGraphic1(std::span<Pixel, 256> buf, int line) const; |
| 54 |
inline void renderGraphic2(std::span<Pixel, 256> buf, int line) const; |
| 55 |
inline void renderMulti (std::span<Pixel, 256> buf, int line) const; |
| 56 |
inline void renderMultiQ (std::span<Pixel, 256> buf, int line) const; |
| 57 |
inline void renderBogus (std::span<Pixel, 256> buf) const; |
| 58 |
inline void renderBlank (std::span<Pixel, 256> buf) const; |
| 59 |
inline void renderMultiHelper(Pixel* pixelPtr, int line, |
| 60 |
unsigned mask, unsigned patternQuarter) const; |
| 61 |
|
| 62 |
[[nodiscard]] std::span<const uint8_t, 32> getNamePtr(int line, int scroll) const; |
| 63 |
|
| 64 |
private: |
| 65 |
VDP& vdp; |
| 66 |
VDPVRAM& vram; |
| 67 |
|
| 68 |
std::span<const Pixel, 16> palFg; |
| 69 |
std::span<const Pixel, 16> palBg; |
| 70 |
|
| 71 |
unsigned modeBase = 0; |
| 72 |
}; |
| 73 |
|
| 74 |
} |
| 75 |
|
| 76 |
#endif |