isolate dependencies to SDL

Do not access directly the SDL_Surface Screen_pixels
use new functions Get_Screen_pixel_ptr() Set_Screen_pixel(),
Get_Screen_pixel()
And SetPalette()

Signed-off-by: Thomas Bernard <miniupnp@free.fr>
This commit is contained in:
Thomas Bernard
2018-05-26 23:49:19 +02:00
parent c6975afe94
commit 72fea0290f
21 changed files with 1006 additions and 440 deletions

View File

@@ -2,6 +2,7 @@
*/
/* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2018 Thomas Bernard
Copyright 2008 Yves Rizoud
Copyright 2007 Adrien Destugues
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
@@ -32,16 +33,17 @@
#include "struct.h"
#include "global.h"
///
/// This is the number of bytes in a video line for the current mode.
/// On many platforms it will be the video mode's width (in pixels), rounded up
/// to be a multiple of 4.
#define VIDEO_LINE_WIDTH (Screen_SDL->pitch)
void Set_mode_SDL(int *,int *,int);
GFX2_GLOBAL SDL_Rect ** List_SDL_video_modes;
GFX2_GLOBAL byte* Screen_pixels;
byte Get_Screen_pixel(int x, int y);
void Set_Screen_pixel(int x, int y, byte value);
byte* Get_Screen_pixel_ptr(int x, int y);
void Screen_FillRect(int x, int y, int w, int h, byte color);
void Update_rect(short x, short y, unsigned short width, unsigned short height);
void Flush_update(void);
@@ -64,6 +66,8 @@ void Set_SDL_pixel_8(SDL_Surface *bmp, int x, int y, byte color);
/// Convert a SDL Palette to a grafx2 palette
void Get_SDL_Palette(const SDL_Palette * sdl_palette, T_Palette palette);
int SetPalette(const T_Components * colors, int firstcolor, int ncolors);
///
/// Clears the parts of screen that are outside of the editing area.
/// There is such area only if the screen mode is not a multiple of the pixel