Cleaned up compiler warnings in dither.c Magic tool

This commit is contained in:
Bill Kendrick 2024-05-10 00:16:17 -07:00
parent a9e6a5ae9f
commit fbb46751c6
2 changed files with 50 additions and 19 deletions

View file

@ -6,7 +6,7 @@ Copyright (c) 2002-2024
Various contributors (see below, and AUTHORS.txt)
https://tuxpaint.org/
2024.April.28 (0.9.33)
2024.May.10 (0.9.33)
* New Magic Tools:
----------------
* WIP Specular Reflection: Draws a slightly blurred, wavy, and

View file

@ -5,7 +5,7 @@
(Using Atkinso dithering: https://en.wikipedia.org/wiki/Atkinson_dithering)
by Bill Kendrick <bill@newbreedsoftware.com>
Last updated: March 19, 2024
Last updated: May 10, 2024
*/
@ -75,13 +75,41 @@ void dither_drag(magic_api * api, int which, SDL_Surface * canvas,
void dither_line_callback(void *pointer, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, int x, int y);
Uint32 dither_api_version(void);
int dither_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_level);
int dither_get_tool_count(magic_api * api);
SDL_Surface *dither_get_icon(magic_api * api, int which);
char *dither_get_name(magic_api * api, int which);
int dither_get_group(magic_api * api, int which);
int dither_get_order(int which);
char *dither_get_description(magic_api * api, int which, int mode);
int dither_requires_colors(magic_api * api, int which);
void dither_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
void dither_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
void dither_set_size(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot,
Uint8 size, SDL_Rect * update_rect);
void dither_set_color(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot,
Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect);
void dither_release(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y,
SDL_Rect * update_rect);
void dither_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y,
SDL_Rect * update_rect);
void dither_shutdown(magic_api * api);
Uint8 dither_default_size(magic_api * api, int which, int mode);
Uint8 dither_accepted_sizes(magic_api * api, int which, int mode);
int dither_modes(magic_api * api, int which);
Uint32 dither_api_version(void)
{
return (TP_MAGIC_API_VERSION);
}
int dither_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_level)
int dither_init(magic_api * api, Uint8 disabled_features ATTRIBUTE_UNUSED, Uint8 complexity_level ATTRIBUTE_UNUSED)
{
int i;
char filename[1024];
@ -101,7 +129,7 @@ int dither_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_level
}
int dither_get_tool_count(magic_api * api)
int dither_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
{
return NUM_TOOLS;
}
@ -117,13 +145,13 @@ SDL_Surface *dither_get_icon(magic_api * api, int which)
}
char *dither_get_name(magic_api * api, int which)
char *dither_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
{
return strdup(gettext(dither_names[which]));
}
int dither_get_group(magic_api * api, int which)
int dither_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MAGIC_TYPE_COLOR_FILTERS;
}
@ -135,7 +163,7 @@ int dither_get_order(int which)
}
char *dither_get_description(magic_api * api, int which, int mode)
char *dither_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode)
{
if (mode == MODE_PAINT) {
return strdup(gettext(dither_descr[which][0]));
@ -145,7 +173,7 @@ char *dither_get_description(magic_api * api, int which, int mode)
}
int dither_requires_colors(magic_api * api, int which)
int dither_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which)
{
if (which == TOOL_DITHER_VIA_COLOR)
return 1;
@ -154,25 +182,25 @@ int dither_requires_colors(magic_api * api, int which)
}
int dither_modes(magic_api * api, int which)
int dither_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return MODE_PAINT | MODE_FULLSCREEN;
}
Uint8 dither_accepted_sizes(magic_api * api, int which, int mode)
Uint8 dither_accepted_sizes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{
return DITHER_SIZE_COUNT;
}
Uint8 dither_default_size(magic_api * api, int which, int mode)
Uint8 dither_default_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{
return DITHER_SIZE_DEFAULT;
}
void dither_shutdown(magic_api * api)
void dither_shutdown(magic_api * api ATTRIBUTE_UNUSED)
{
int i;
@ -291,8 +319,7 @@ dither_drag(magic_api * api, int which,
int dither_x_pos[6] = { 1, 2, -1, 0, 1, 0 };
int dither_y_pos[6] = { 0, 0, 1, 1, 1, 2 };
void
dither_release(magic_api * api, int which,
void dither_release(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y,
SDL_Rect * update_rect)
{
@ -361,7 +388,9 @@ dither_release(magic_api * api, int which,
}
}
void dither_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect)
void dither_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED,
Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
{
if (r <= 240 || g <= 240 || b <= 240)
{
@ -374,7 +403,9 @@ void dither_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surf
}
}
void dither_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 size, SDL_Rect * update_rect)
void dither_set_size(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * snapshot ATTRIBUTE_UNUSED,
Uint8 size, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
{
dither_sizes[which] = size * DITHER_SIZE_SCALE;
}
@ -419,7 +450,7 @@ void dither_line_callback(void *pointer, int which, SDL_Surface * canvas,
}
void dither_switchin(magic_api * api, int which, int mode,
void dither_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas)
{
if (dither_touched == NULL)
@ -435,7 +466,7 @@ void dither_switchin(magic_api * api, int which, int mode,
dither_black = SDL_MapRGB(canvas->format, 0, 0, 0);
}
void dither_switchout(magic_api * api, int which, int mode,
SDL_Surface * canvas)
void dither_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED)
{
}