2012-06-03 15:48:14 +00:00
|
|
|
#ifndef __MDFN_VIDEO_H
|
|
|
|
#define __MDFN_VIDEO_H
|
|
|
|
|
2015-07-25 02:15:26 +00:00
|
|
|
#include <stdint.h>
|
2012-06-03 15:48:14 +00:00
|
|
|
|
2015-07-25 02:15:26 +00:00
|
|
|
#if defined(FRONTEND_SUPPORTS_RGB565)
|
|
|
|
/* 16bit color - RGB565 */
|
|
|
|
#define RED_MASK 0xf800
|
|
|
|
#define GREEN_MASK 0x7e0
|
|
|
|
#define BLUE_MASK 0x1f
|
|
|
|
#define RED_EXPAND 3
|
|
|
|
#define GREEN_EXPAND 2
|
|
|
|
#define BLUE_EXPAND 3
|
|
|
|
#define RED_SHIFT 11
|
|
|
|
#define GREEN_SHIFT 5
|
|
|
|
#define BLUE_SHIFT 0
|
|
|
|
#define MAKECOLOR(r, g, b, a) (((r >> RED_EXPAND) << RED_SHIFT) | ((g >> GREEN_EXPAND) << GREEN_SHIFT) | ((b >> BLUE_EXPAND) << BLUE_SHIFT))
|
|
|
|
#else
|
|
|
|
/* 16bit color - RGB555 */
|
|
|
|
#define RED_MASK 0x7c00
|
|
|
|
#define GREEN_MASK 0x3e0
|
|
|
|
#define BLUE_MASK 0x1f
|
|
|
|
#define RED_EXPAND 3
|
|
|
|
#define GREEN_EXPAND 3
|
|
|
|
#define BLUE_EXPAND 3
|
|
|
|
#define RED_SHIFT 10
|
|
|
|
#define GREEN_SHIFT 5
|
|
|
|
#define BLUE_SHIFT 0
|
|
|
|
#define MAKECOLOR(r, g, b, a) (((r >> RED_EXPAND) << RED_SHIFT) | ((g >> GREEN_EXPAND) << GREEN_SHIFT) | ((b >> BLUE_EXPAND) << BLUE_SHIFT))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int32_t x, y, w, h;
|
|
|
|
} MDFN_Rect;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
unsigned int colorspace;
|
|
|
|
uint8_t r_shift;
|
|
|
|
uint8_t g_shift;
|
|
|
|
uint8_t b_shift;
|
|
|
|
uint8_t a_shift;
|
|
|
|
} MDFN_PixelFormat;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
uint16_t *pixels;
|
|
|
|
int32_t width;
|
|
|
|
int32_t height;
|
|
|
|
int32_t pitch;
|
|
|
|
} MDFN_Surface;
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2012-06-03 15:48:14 +00:00
|
|
|
|
|
|
|
#endif
|