openMSX
BitmapConverter.hh
Go to the documentation of this file.
1 #ifndef BITMAPCONVERTER_HH
2 #define BITMAPCONVERTER_HH
3 
4 #include "DisplayMode.hh"
5 #include "openmsx.hh"
6 #include <concepts>
7 #include <cstdint>
8 
9 namespace openmsx {
10 
11 template<int N> struct DoublePixel;
12 template<> struct DoublePixel<2> { using type = uint32_t; };
13 template<> struct DoublePixel<4> { using type = uint64_t; };
14 
17 template<std::unsigned_integral Pixel>
19 {
20 public:
42  BitmapConverter(const Pixel* palette16,
43  const Pixel* palette256,
44  const Pixel* palette32768);
45 
51  void convertLine(Pixel* linePtr, const byte* vramPtr);
52 
59  void convertLinePlanar(Pixel* linePtr,
60  const byte* vramPtr0, const byte* vramPtr1);
61 
65  inline void setDisplayMode(DisplayMode mode_)
66  {
67  mode = mode_;
68  }
69 
72  inline void palette16Changed()
73  {
74  dPaletteValid = false;
75  }
76 
77 private:
78  void calcDPalette();
79 
80  inline void renderGraphic4(Pixel* pixelPtr, const byte* vramPtr0);
81  inline void renderGraphic5(Pixel* pixelPtr, const byte* vramPtr0);
82  inline void renderGraphic6(
83  Pixel* pixelPtr, const byte* vramPtr0, const byte* vramPtr1);
84  inline void renderGraphic7(
85  Pixel* pixelPtr, const byte* vramPtr0, const byte* vramPtr1);
86  inline void renderYJK(
87  Pixel* pixelPtr, const byte* vramPtr0, const byte* vramPtr1);
88  inline void renderYAE(
89  Pixel* pixelPtr, const byte* vramPtr0, const byte* vramPtr1);
90  inline void renderBogus(Pixel* pixelPtr);
91 
92 private:
93  const Pixel* const __restrict palette16;
94  const Pixel* const __restrict palette256;
95  const Pixel* const __restrict palette32768;
96 
97  using DPixel = typename DoublePixel<sizeof(Pixel)>::type;
98  DPixel dPalette[16 * 16];
99  DisplayMode mode;
100  bool dPaletteValid;
101 };
102 
103 } // namespace openmsx
104 
105 #endif
Utility class for converting VRAM contents to host pixels.
void convertLinePlanar(Pixel *linePtr, const byte *vramPtr0, const byte *vramPtr1)
Convert a line of V9938 VRAM to 512 host pixels.
void setDisplayMode(DisplayMode mode_)
Select the display mode to use for scanline conversion.
BitmapConverter(const Pixel *palette16, const Pixel *palette256, const Pixel *palette32768)
Create a new bitmap scanline converter.
void convertLine(Pixel *linePtr, const byte *vramPtr)
Convert a line of V9938 VRAM to 512 host pixels.
void palette16Changed()
Inform this class about changes in the palette16 array.
Represents a VDP display mode.
Definition: DisplayMode.hh:16
This file implemented 3 utility functions:
Definition: Autofire.cc:9
uint32_t Pixel