| 1 | #cxx . . $ `<file>/mednafen/video/surface.h`/ifndef __MDFN_SURFACE_H |
| 2 | #define __MDFN_SURFACE_Hcxx . . $ `mednafen/video/surface.h:2:9`! |
| 3 | |
| 4 | #if defined(WANT_32BPPcxx . . $ `<built-in>:480:9`!) |
| 5 | #define RED_SHIFTcxx . . $ `mednafen/video/surface.h:5:9`! 16 |
| 6 | #define GREEN_SHIFTcxx . . $ `mednafen/video/surface.h:6:9`! 8 |
| 7 | #define BLUE_SHIFTcxx . . $ `mednafen/video/surface.h:7:9`! 0 |
| 8 | #define ALPHA_SHIFTcxx . . $ `mednafen/video/surface.h:8:9`! 24 |
| 9 | #define MAKECOLORcxx . . $ `mednafen/video/surface.h:9:9`!(r, g, b, a) ((r << RED_SHIFT) | (g << GREEN_SHIFT) | (b << BLUE_SHIFT) | (a << ALPHA_SHIFT)) |
| 10 | #elif defined(WANT_16BPP) && defined(FRONTEND_SUPPORTS_RGB565) |
| 11 | /* 16bit color - RGB565 */ |
| 12 | #define RED_MASK 0xf800 |
| 13 | #define GREEN_MASK 0x7e0 |
| 14 | #define BLUE_MASK 0x1f |
| 15 | #define RED_EXPAND 3 |
| 16 | #define GREEN_EXPAND 2 |
| 17 | #define BLUE_EXPAND 3 |
| 18 | #define RED_SHIFT 11 |
| 19 | #define GREEN_SHIFT 5 |
| 20 | #define BLUE_SHIFT 0 |
| 21 | #define MAKECOLOR(r, g, b, a) (((r >> RED_EXPAND) << RED_SHIFT) | ((g >> GREEN_EXPAND) << GREEN_SHIFT) | ((b >> BLUE_EXPAND) << BLUE_SHIFT)) |
| 22 | #elif defined(WANT_16BPP) && !defined(FRONTEND_SUPPORTS_RGB565) |
| 23 | /* 16bit color - RGB555 */ |
| 24 | #define RED_MASK 0x7c00 |
| 25 | #define GREEN_MASK 0x3e0 |
| 26 | #define BLUE_MASK 0x1f |
| 27 | #define RED_EXPAND 3 |
| 28 | #define GREEN_EXPAND 3 |
| 29 | #define BLUE_EXPAND 3 |
| 30 | #define RED_SHIFT 10 |
| 31 | #define GREEN_SHIFT 5 |
| 32 | #define BLUE_SHIFT 0 |
| 33 | #define MAKECOLOR(r, g, b, a) (((r >> RED_EXPAND) << RED_SHIFT) | ((g >> GREEN_EXPAND) << GREEN_SHIFT) | ((b >> BLUE_EXPAND) << BLUE_SHIFT)) |
| 34 | #endif |
| 35 | |
| 36 | struct MDFN_PaletteEntrycxx . . $ MDFN_PaletteEntry# |
| 37 | { |
| 38 | uint8cxx . . $ uint8# rcxx . . $ MDFN_PaletteEntry#r., gcxx . . $ MDFN_PaletteEntry#g., bcxx . . $ MDFN_PaletteEntry#b.; |
| 39 | }; |
| 40 | |
| 41 | typedef structcxx . . $ $anonymous_type_d9695e4ae1560f11_0# |
| 42 | { |
| 43 | int32cxx . . $ int32# xcxx . . $ $anonymous_type_d9695e4ae1560f11_0#x., ycxx . . $ $anonymous_type_d9695e4ae1560f11_0#y., wcxx . . $ $anonymous_type_d9695e4ae1560f11_0#w., hcxx . . $ $anonymous_type_d9695e4ae1560f11_0#h.; |
| 44 | } MDFN_Rectcxx . . $ MDFN_Rect#; |
| 45 | |
| 46 | enumcxx . . $ $anonymous_type_d9695e4ae1560f11_1# |
| 47 | { |
| 48 | MDFN_COLORSPACE_RGBcxx . . $ MDFN_COLORSPACE_RGB. = 0, |
| 49 | MDFN_COLORSPACE_YCbCrcxx . . $ MDFN_COLORSPACE_YCbCr. = 1, |
| 50 | MDFN_COLORSPACE_YUVcxx . . $ MDFN_COLORSPACE_YUV. = 2, // TODO, maybe. |
| 51 | }; |
| 52 | |
| 53 | class MDFN_PixelFormatcxx . . $ MDFN_PixelFormat# |
| 54 | { |
| 55 | public: |
| 56 | |
| 57 | MDFN_PixelFormatcxx . . $ MDFN_PixelFormat#MDFN_PixelFormat(49f6e7a06ebc5aa8).(); |
| 58 | MDFN_PixelFormatcxx . . $ MDFN_PixelFormat#MDFN_PixelFormat(fc65991e97fa879e).(const unsigned int p_colorspace, const uint8cxx . . $ uint8# p_rs, const uint8cxx . . $ uint8# p_gs, const uint8cxx . . $ uint8# p_bs, const uint8cxx . . $ uint8# p_as); |
| 59 | |
| 60 | unsigned int bppcxx . . $ MDFN_PixelFormat#bpp.; |
| 61 | unsigned int colorspacecxx . . $ MDFN_PixelFormat#colorspace.; |
| 62 | |
| 63 | unioncxx . . $ MDFN_PixelFormat#$anonymous_type_2# |
| 64 | { |
| 65 | uint8cxx . . $ uint8# Rshiftcxx . . $ MDFN_PixelFormat#$anonymous_type_2#Rshift.; // Bit position of the lowest bit of the red component |
| 66 | uint8cxx . . $ uint8# Yshiftcxx . . $ MDFN_PixelFormat#$anonymous_type_2#Yshift.; |
| 67 | }; |
| 68 | |
| 69 | unioncxx . . $ MDFN_PixelFormat#$anonymous_type_3# |
| 70 | { |
| 71 | uint8cxx . . $ uint8# Gshiftcxx . . $ MDFN_PixelFormat#$anonymous_type_3#Gshift.; // [...] green component |
| 72 | uint8cxx . . $ uint8# Ushiftcxx . . $ MDFN_PixelFormat#$anonymous_type_3#Ushift.; |
| 73 | uint8cxx . . $ uint8# Cbshiftcxx . . $ MDFN_PixelFormat#$anonymous_type_3#Cbshift.; |
| 74 | }; |
| 75 | |
| 76 | unioncxx . . $ MDFN_PixelFormat#$anonymous_type_4# |
| 77 | { |
| 78 | uint8cxx . . $ uint8# Bshiftcxx . . $ MDFN_PixelFormat#$anonymous_type_4#Bshift.; // [...] blue component |
| 79 | uint8cxx . . $ uint8# Vshiftcxx . . $ MDFN_PixelFormat#$anonymous_type_4#Vshift.; |
| 80 | uint8cxx . . $ uint8# Crshiftcxx . . $ MDFN_PixelFormat#$anonymous_type_4#Crshift.; |
| 81 | }; |
| 82 | |
| 83 | uint8cxx . . $ uint8# Ashiftcxx . . $ MDFN_PixelFormat#Ashift.; // [...] alpha component. |
| 84 | }; // MDFN_PixelFormat; |
| 85 | |
| 86 | // Supports 32-bit RGBA |
| 87 | // 16-bit is WIP |
| 88 | class MDFN_Surfacecxx . . $ MDFN_Surface# //typedef struct |
| 89 | { |
| 90 | public: |
| 91 | |
| 92 | MDFN_Surfacecxx . . $ MDFN_Surface#MDFN_Surface(49f6e7a06ebc5aa8).(); |
| 93 | MDFN_Surfacecxx . . $ MDFN_Surface#MDFN_Surface(82b88fc256abb892).(void *const p_pixels, const uint32cxx . . $ uint32# p_width, const uint32cxx . . $ uint32# p_height, const uint32cxx . . $ uint32# p_pitchinpix, const MDFN_PixelFormatcxx . . $ MDFN_PixelFormat# &nf); |
| 94 | |
| 95 | ~cxx . . $ MDFN_Surface#`~MDFN_Surface`(ced63f7c635d850d).MDFN_Surfacecxx . . $ MDFN_Surface#(); |
| 96 | |
| 97 | uint8cxx . . $ uint8# *pixels8cxx . . $ MDFN_Surface#pixels8.; |
| 98 | uint16cxx . . $ uint16# *pixels16cxx . . $ MDFN_Surface#pixels16.; |
| 99 | uint32cxx . . $ uint32# *pixelscxx . . $ MDFN_Surface#pixels.; |
| 100 | |
| 101 | // w, h, and pitch32 should always be > 0 |
| 102 | int32cxx . . $ int32# wcxx . . $ MDFN_Surface#w.; |
| 103 | int32cxx . . $ int32# hcxx . . $ MDFN_Surface#h.; |
| 104 | |
| 105 | unioncxx . . $ MDFN_Surface#$anonymous_type_5# |
| 106 | { |
| 107 | int32cxx . . $ int32# pitch32cxx . . $ MDFN_Surface#$anonymous_type_5#pitch32.; // In pixels, not in bytes. |
| 108 | int32cxx . . $ int32# pitchinpixcxx . . $ MDFN_Surface#$anonymous_type_5#pitchinpix.; // New name, new code should use this. |
| 109 | }; |
| 110 | |
| 111 | MDFN_PaletteEntrycxx . . $ MDFN_PaletteEntry# *palettecxx . . $ MDFN_Surface#palette.; |
| 112 | |
| 113 | MDFN_PixelFormatcxx . . $ MDFN_PixelFormat# formatcxx . . $ MDFN_Surface#format.; |
| 114 | |
| 115 | void SetFormatcxx . . $ MDFN_Surface#SetFormat(ddcbab6c6d8fc277).(const MDFN_PixelFormatcxx . . $ MDFN_PixelFormat# &new_format, bool convert); |
| 116 | |
| 117 | private: |
| 118 | void Initcxx . . $ MDFN_Surface#Init(82b88fc256abb892).(void *const p_pixels, const uint32cxx . . $ uint32# p_width, const uint32cxx . . $ uint32# p_height, const uint32cxx . . $ uint32# p_pitchinpix, const MDFN_PixelFormatcxx . . $ MDFN_PixelFormat# &nf); |
| 119 | }; |
| 120 | |
| 121 | #endif |