| 1 | #ifndef __MDFN_VIDEO_H |
| 2 | #define __MDFN_VIDEO_H |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | #if defined(FRONTEND_SUPPORTS_RGB565) |
| 7 | /* 16bit color - RGB565 */ |
| 8 | #define RED_MASK 0xf800 |
| 9 | #define GREEN_MASK 0x7e0 |
| 10 | #define BLUE_MASK 0x1f |
| 11 | #define RED_EXPAND 3 |
| 12 | #define GREEN_EXPAND 2 |
| 13 | #define BLUE_EXPAND 3 |
| 14 | #define RED_SHIFT 11 |
| 15 | #define GREEN_SHIFT 5 |
| 16 | #define BLUE_SHIFT 0 |
| 17 | #define MAKECOLOR(r, g, b, a) (((r >> RED_EXPAND) << RED_SHIFT) | ((g >> GREEN_EXPAND) << GREEN_SHIFT) | ((b >> BLUE_EXPAND) << BLUE_SHIFT)) |
| 18 | #else |
| 19 | /* 16bit color - RGB555 */ |
| 20 | #define RED_MASK 0x7c00 |
| 21 | #define GREEN_MASK 0x3e0 |
| 22 | #define BLUE_MASK 0x1f |
| 23 | #define RED_EXPAND 3 |
| 24 | #define GREEN_EXPAND 3 |
| 25 | #define BLUE_EXPAND 3 |
| 26 | #define RED_SHIFT 10 |
| 27 | #define GREEN_SHIFT 5 |
| 28 | #define BLUE_SHIFT 0 |
| 29 | #define MAKECOLOR(r, g, b, a) (((r >> RED_EXPAND) << RED_SHIFT) | ((g >> GREEN_EXPAND) << GREEN_SHIFT) | ((b >> BLUE_EXPAND) << BLUE_SHIFT)) |
| 30 | #endif |
| 31 | |
| 32 | #ifdef __cplusplus |
| 33 | extern "C" { |
| 34 | #endif |
| 35 | |
| 36 | typedef struct |
| 37 | { |
| 38 | int32_t x, y, w, h; |
| 39 | } MDFN_Rect; |
| 40 | |
| 41 | typedef struct |
| 42 | { |
| 43 | unsigned int colorspace; |
| 44 | uint8_t r_shift; |
| 45 | uint8_t g_shift; |
| 46 | uint8_t b_shift; |
| 47 | uint8_t a_shift; |
| 48 | } MDFN_PixelFormat; |
| 49 | |
| 50 | typedef struct |
| 51 | { |
| 52 | uint16_t *pixels; |
| 53 | int32_t width; |
| 54 | int32_t height; |
| 55 | int32_t pitch; |
| 56 | } MDFN_Surface; |
| 57 | |
| 58 | #ifdef __cplusplus |
| 59 | } |
| 60 | #endif |
| 61 | |
| 62 | #endif |