graph.c: Pixel_figure is not a global var anymore

This commit is contained in:
Thomas Bernard 2018-03-03 02:07:08 +01:00
parent be8b05a384
commit ce1b55be03
4 changed files with 11 additions and 5 deletions

View File

@ -1244,7 +1244,7 @@ void Capture_brush_with_lasso(int vertices, short * points,short clear)
Brush_offset_X=start_x;
Brush_offset_Y=start_y;
Pixel_figure=Pixel_figure_in_brush;
Set_Pixel_figure(Pixel_figure_in_brush);
memset(Brush,Back_color,(long)Brush_width*Brush_height);
Polyfill_general(vertices,points,xor_lut[Back_color]);

View File

@ -524,7 +524,7 @@ int L_DrawLine(lua_State* L)
LUA_ARG_NUMBER(4, "drawline", y2, INT_MIN, INT_MAX);
LUA_ARG_NUMBER(5, "drawline", c, INT_MIN, INT_MAX);
Pixel_figure = (void (*) (word,word,byte))Pixel_figure_no_screen;
Set_Pixel_figure((void (*) (word,word,byte))Pixel_figure_no_screen);
Draw_line_general(x1, y1, x2, y2, c);
return 0;
@ -598,7 +598,7 @@ int L_DrawCircle(lua_State* L)
LUA_ARG_NUMBER(3, "drawcircle", r, INT_MIN, INT_MAX);
LUA_ARG_NUMBER(4, "drawcircle", c, INT_MIN, INT_MAX);
Pixel_figure = (void (*) (word,word,byte))Pixel_figure_no_screen;
Set_Pixel_figure((void (*) (word,word,byte))Pixel_figure_no_screen);
Circle_limit = r*r;
Draw_empty_circle_general(x1, y1, r, c);

View File

@ -57,7 +57,13 @@
#endif
// Generic pixel-drawing function.
Func_pixel Pixel_figure;
static Func_pixel Pixel_figure;
void Set_Pixel_figure(Func_pixel func)
{
Pixel_figure = func;
}
typedef struct
{

View File

@ -115,7 +115,7 @@ void Remap_spare(void);
/// - ::Pixel_figure_preview_xor : On screen, XORing the color.
/// - ::Pixel_figure_permanent : On screen and in the image.
/// - ::Pixel_figure_clear_preview : On screen, reverting to the image's pixels.
extern Func_pixel Pixel_figure;
void Set_Pixel_figure(Func_pixel func);
void Update_part_of_screen(short x, short y, short width, short height);