--- hatari/src/includes/screen.h 2019/04/09 08:53:08 1.1.1.15 +++ hatari/src/includes/screen.h 2019/04/09 08:56:52 1.1.1.17 @@ -10,6 +10,20 @@ #include /* for SDL_Surface */ +#if WITH_SDL2 +extern SDL_Window *sdlWindow; +static inline int SDL_SetColors(SDL_Surface *surface, SDL_Color *colors, + int firstcolor, int ncolors) +{ + return SDL_SetPaletteColors(surface->format->palette, colors, + firstcolor, ncolors); +} +void SDL_UpdateRects(SDL_Surface *screen, int numrects, SDL_Rect *rects); +void SDL_UpdateRect(SDL_Surface *screen, Sint32 x, Sint32 y, Sint32 w, Sint32 h); +#define SDL_GRAB_OFF false +#define SDL_GRAB_ON true +#define SDL_WM_GrabInput SDL_SetRelativeMouseMode +#endif /* The 'screen' is a representation of the ST video memory */ /* taking into account all the border tricks. Data are stored */ @@ -33,6 +47,9 @@ /* Number of visible screen lines including top/bottom borders */ #define NUM_VISIBLE_LINES (OVERSCAN_TOP+200+MAX_OVERSCAN_BOTTOM) +/* Number of visible pixels on each screen line including left/right borders */ +#define NUM_VISIBLE_LINE_PIXELS (48+320+48) + /* 1x16 colour palette per screen line, +1 line as may write after line 200 */ #define HBL_PALETTE_LINES ((NUM_VISIBLE_LINES+1 +3 )*16) /* [NP] FIXME we need to handle 313 hbl, not 310 ; palette code is a mess it should be removed */ /* Bit mask of palette colours changes, top bit set is resolution change */ @@ -46,7 +63,7 @@ typedef struct Uint32 HBLPaletteMasks[HBL_PALETTE_MASKS]; Uint8 *pSTScreen; /* Copy of screen built up during frame (copy each line on HBL to simulate monitor raster) */ Uint8 *pSTScreenCopy; /* Previous frames copy of above */ - int OverscanModeCopy; /* Previous screen overscan mode */ + int VerticalOverscanCopy; /* Previous screen overscan mode */ bool bFullUpdate; /* Set TRUE to cause full update on next draw */ } FRAMEBUFFER; @@ -75,13 +92,6 @@ enum #define PALETTEMASK_UPDATEFULL 0x80000000 #define PALETTEMASK_UPDATEMASK (PALETTEMASK_UPDATEFULL|PALETTEMASK_UPDATEPAL|PALETTEMASK_UPDATERES) -/* Overscan values */ -enum -{ - OVERSCANMODE_NONE, /* 0x00 */ - OVERSCANMODE_TOP, /* 0x01 */ - OVERSCANMODE_BOTTOM /* 0x02 (Top+Bottom) 0x03 */ -}; extern bool bGrabMouse; extern bool bInFullScreen; @@ -98,12 +108,17 @@ extern Uint32 ST2RGB[4096]; extern void Screen_Init(void); extern void Screen_UnInit(void); extern void Screen_Reset(void); +extern bool Screen_Lock(void); +extern void Screen_UnLock(void); extern void Screen_SetFullUpdate(void); extern void Screen_EnterFullScreen(void); extern void Screen_ReturnFromFullScreen(void); -extern void Screen_ModeChanged(void); +extern void Screen_ModeChanged(bool bForceChange); extern bool Screen_Draw(void); - -extern bool bTTSampleHold; /* TT special video mode */ +extern bool Screen_SetSDLVideoSize(int width, int height, int bitdepth, bool bForceChange); +extern void Screen_SetGenConvSize(int width, int height, int bpp, bool bForceChange); +extern void Screen_GenConvUpdate(SDL_Rect *extra, bool forced); +extern Uint32 Screen_GetGenConvWidth(void); +extern Uint32 Screen_GetGenConvHeight(void); #endif /* ifndef HATARI_SCREEN_H */