From fbb46751c65f9015645a5124c6692753b7ad3b03 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Fri, 10 May 2024 00:16:17 -0700 Subject: [PATCH] Cleaned up compiler warnings in dither.c Magic tool --- docs/CHANGES.txt | 2 +- magic/src/dither.c | 67 +++++++++++++++++++++++++++++++++------------- 2 files changed, 50 insertions(+), 19 deletions(-) diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 89e863010..f7f84601d 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -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 diff --git a/magic/src/dither.c b/magic/src/dither.c index 1f1929347..316bf8dc0 100644 --- a/magic/src/dither.c +++ b/magic/src/dither.c @@ -5,7 +5,7 @@ (Using Atkinso dithering: https://en.wikipedia.org/wiki/Atkinson_dithering) by Bill Kendrick - 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) { }