| 1 |
#ifndef BITMAPCONVERTER_HH |
| 2 |
#define BITMAPCONVERTER_HH |
| 3 |
|
| 4 |
#include "DisplayMode.hh" |
| 5 |
|
| 6 |
#include <array> |
| 7 |
#include <cstdint> |
| 8 |
#include <span> |
| 9 |
|
| 10 |
namespace openmsx { |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
class BitmapConverter |
| 15 |
{ |
| 16 |
public: |
| 17 |
using Pixel = uint32_t; |
| 18 |
using DPixel = uint64_t; |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
BitmapConverter(std::span<const Pixel, 16 * 2> palette16, |
| 42 |
std::span<const Pixel, 256> palette256, |
| 43 |
std::span<const Pixel, 32768> palette32768); |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
void convertLine(std::span<Pixel> buf, std::span<const uint8_t, 128> vramPtr); |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
void convertLinePlanar(std::span<Pixel> buf, |
| 65 |
std::span<const uint8_t, 128> vramPtr0, |
| 66 |
std::span<const uint8_t, 128> vramPtr1); |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
void setDisplayMode(DisplayMode mode_) |
| 72 |
{ |
| 73 |
mode = mode_; |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
void palette16Changed() |
| 79 |
{ |
| 80 |
dPaletteValid = false; |
| 81 |
} |
| 82 |
|
| 83 |
private: |
| 84 |
void calcDPalette(); |
| 85 |
|
| 86 |
void renderGraphic4(std::span<Pixel, 256> buf, |
| 87 |
std::span<const uint8_t, 128> vramPtr0); |
| 88 |
void renderGraphic5(std::span<Pixel, 512> buf, |
| 89 |
std::span<const uint8_t, 128> vramPtr0) const; |
| 90 |
void renderGraphic6(std::span<Pixel, 512> buf, |
| 91 |
std::span<const uint8_t, 128> vramPtr0, |
| 92 |
std::span<const uint8_t, 128> vramPtr1); |
| 93 |
void renderGraphic7(std::span<Pixel, 256> buf, |
| 94 |
std::span<const uint8_t, 128> vramPtr0, |
| 95 |
std::span<const uint8_t, 128> vramPtr1) const; |
| 96 |
void renderYJK( std::span<Pixel, 256> buf, |
| 97 |
std::span<const uint8_t, 128> vramPtr0, |
| 98 |
std::span<const uint8_t, 128> vramPtr1) const; |
| 99 |
void renderYAE( std::span<Pixel, 256> buf, |
| 100 |
std::span<const uint8_t, 128> vramPtr0, |
| 101 |
std::span<const uint8_t, 128> vramPtr1) const; |
| 102 |
void renderBogus( std::span<Pixel, 256> buf) const; |
| 103 |
|
| 104 |
private: |
| 105 |
std::span<const Pixel, 16 * 2> palette16; |
| 106 |
std::span<const Pixel, 256> palette256; |
| 107 |
std::span<const Pixel, 32768> palette32768; |
| 108 |
|
| 109 |
std::array<DPixel, 16 * 16> dPalette; |
| 110 |
DisplayMode mode; |
| 111 |
bool dPaletteValid = false; |
| 112 |
}; |
| 113 |
|
| 114 |
} |
| 115 |
|
| 116 |
#endif |