Re-ran indent on all .c & .h source code files
Like so --
find . -name "*.c" -or -name "*.h" -exec indent -nbfda -npcs -npsl -bli0 --no-tabs {} \;
The `indent` invocation differs from the last one noted in
CHANGES.txt (from 2006!?), in that I've added "--no-tabs",
to ensure indents are all space-based.
This commit is contained in:
parent
09f332367f
commit
cc05925d9e
99 changed files with 31659 additions and 27102 deletions
|
|
@ -45,29 +45,36 @@ int fisheye_get_group(magic_api * api, int which);
|
|||
char *fisheye_get_description(magic_api * api, int which, int mode);
|
||||
int fisheye_requires_colors(magic_api * api, int which);
|
||||
void fisheye_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect);
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot, int x,
|
||||
int y, SDL_Rect * update_rect);
|
||||
void fisheye_shutdown(magic_api * api);
|
||||
void fisheye_draw(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
|
||||
void fisheye_draw(void *ptr, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y);
|
||||
void fisheye_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Rect * update_rect);
|
||||
void fisheye_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
|
||||
void fisheye_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void fisheye_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
SDL_Surface * snapshot, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
void fisheye_click(magic_api * api, int which, int mode, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
|
||||
void fisheye_switchin(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
void fisheye_switchout(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
int fisheye_modes(magic_api * api, int which);
|
||||
|
||||
|
||||
// Housekeeping functions
|
||||
|
||||
void fisheye_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Rect * update_rect);
|
||||
SDL_Surface * snapshot, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
|
||||
Uint32 fisheye_api_version(void)
|
||||
{
|
||||
return (TP_MAGIC_API_VERSION);
|
||||
}
|
||||
|
||||
void fisheye_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED,
|
||||
void fisheye_set_color(magic_api * api ATTRIBUTE_UNUSED,
|
||||
Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED,
|
||||
Uint8 b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
|
||||
|
|
@ -77,7 +84,8 @@ int fisheye_init(magic_api * api)
|
|||
{
|
||||
char fname[1024];
|
||||
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/fisheye.ogg", api->data_directory);
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/fisheye.ogg",
|
||||
api->data_directory);
|
||||
fisheye_snd = Mix_LoadWAV(fname);
|
||||
|
||||
return (1);
|
||||
|
|
@ -92,34 +100,45 @@ SDL_Surface *fisheye_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
|||
{
|
||||
char fname[1024];
|
||||
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/fisheye.png", api->data_directory);
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/fisheye.png",
|
||||
api->data_directory);
|
||||
|
||||
return (IMG_Load(fname));
|
||||
}
|
||||
|
||||
char *fisheye_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
char *fisheye_get_name(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return strdup(gettext_noop("Fisheye"));
|
||||
}
|
||||
|
||||
int fisheye_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
int fisheye_get_group(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return MAGIC_TYPE_DISTORTS;
|
||||
}
|
||||
|
||||
char *fisheye_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||
char *fisheye_get_description(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED,
|
||||
int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return strdup(gettext_noop("Click on part of your picture to create a fisheye effect."));
|
||||
return
|
||||
strdup(gettext_noop
|
||||
("Click on part of your picture to create a fisheye effect."));
|
||||
}
|
||||
|
||||
int fisheye_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
int fisheye_requires_colors(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void fisheye_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * snapshot ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
void fisheye_release(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * snapshot ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED,
|
||||
SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -131,8 +150,8 @@ void fisheye_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
|||
|
||||
// do-fisheye
|
||||
|
||||
void fisheye_draw(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x, int y)
|
||||
void fisheye_draw(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas,
|
||||
SDL_Surface * last ATTRIBUTE_UNUSED, int x, int y)
|
||||
{
|
||||
magic_api *api = (magic_api *) ptr;
|
||||
|
||||
|
|
@ -147,13 +166,15 @@ void fisheye_draw(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, S
|
|||
last_x = x;
|
||||
last_y = y;
|
||||
|
||||
oryg = SDL_CreateRGBSurface(SDL_SWSURFACE, 80, 80, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask,
|
||||
canvas->format->Amask);
|
||||
oryg =
|
||||
SDL_CreateRGBSurface(SDL_SWSURFACE, 80, 80, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask,
|
||||
canvas->format->Bmask, canvas->format->Amask);
|
||||
|
||||
output = SDL_CreateRGBSurface(SDL_SWSURFACE, 80, 80, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask,
|
||||
canvas->format->Amask);
|
||||
output =
|
||||
SDL_CreateRGBSurface(SDL_SWSURFACE, 80, 80, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask,
|
||||
canvas->format->Bmask, canvas->format->Amask);
|
||||
|
||||
rect.x = x - 40;
|
||||
rect.y = y - 40;
|
||||
|
|
@ -163,79 +184,85 @@ void fisheye_draw(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, S
|
|||
|
||||
//do vertical fisheye
|
||||
for (i = 0; i < 40; i++)
|
||||
{
|
||||
temp_src = SDL_CreateRGBSurface(SDL_SWSURFACE, 1, 80, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask,
|
||||
canvas->format->Amask);
|
||||
{
|
||||
temp_src =
|
||||
SDL_CreateRGBSurface(SDL_SWSURFACE, 1, 80, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask,
|
||||
canvas->format->Bmask, canvas->format->Amask);
|
||||
|
||||
//let's take a smooth bar of scaled bitmap and copy it to temp
|
||||
//left side first
|
||||
rect.x = i;
|
||||
rect.y = 0;
|
||||
rect.w = 1;
|
||||
//let's take a smooth bar of scaled bitmap and copy it to temp
|
||||
//left side first
|
||||
rect.x = i;
|
||||
rect.y = 0;
|
||||
rect.w = 1;
|
||||
|
||||
SDL_BlitSurface(oryg, &rect, temp_src, NULL); //this bar is copied to temp_src
|
||||
SDL_BlitSurface(oryg, &rect, temp_src, NULL); //this bar is copied to temp_src
|
||||
|
||||
temp_dest = SDL_CreateRGBSurface(SDL_SWSURFACE, 1, 80 + 2 * i, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask,
|
||||
canvas->format->Amask);
|
||||
temp_dest =
|
||||
SDL_CreateRGBSurface(SDL_SWSURFACE, 1, 80 + 2 * i,
|
||||
canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask,
|
||||
canvas->format->Bmask, canvas->format->Amask);
|
||||
|
||||
temp_dest = api->scale(temp_src, 1, 80 + 2 * i, 0); //temp_dest stores scaled temp_src
|
||||
temp_dest = api->scale(temp_src, 1, 80 + 2 * i, 0); //temp_dest stores scaled temp_src
|
||||
|
||||
temp_rect.x = 0;
|
||||
temp_rect.y = i;
|
||||
temp_rect.w = 1;
|
||||
temp_rect.h = 80;
|
||||
temp_rect.x = 0;
|
||||
temp_rect.y = i;
|
||||
temp_rect.w = 1;
|
||||
temp_rect.h = 80;
|
||||
|
||||
SDL_BlitSurface(temp_dest, &temp_rect, output, &rect); //let's copy it to output
|
||||
SDL_BlitSurface(temp_dest, &temp_rect, output, &rect); //let's copy it to output
|
||||
|
||||
//right side then
|
||||
//right side then
|
||||
|
||||
rect.x = 79 - i;
|
||||
rect.x = 79 - i;
|
||||
|
||||
SDL_BlitSurface(oryg, &rect, temp_src, NULL); //this bar is copied to temp_src //OK
|
||||
SDL_BlitSurface(oryg, &rect, temp_src, NULL); //this bar is copied to temp_src //OK
|
||||
|
||||
temp_dest = api->scale(temp_src, 1, 80 + 2 * i, 0); //temp_dest stores scaled temp_src
|
||||
temp_dest = api->scale(temp_src, 1, 80 + 2 * i, 0); //temp_dest stores scaled temp_src
|
||||
|
||||
SDL_BlitSurface(temp_dest, &temp_rect, output, &rect); //let's copy it to output
|
||||
}
|
||||
SDL_BlitSurface(temp_dest, &temp_rect, output, &rect); //let's copy it to output
|
||||
}
|
||||
|
||||
//do horizontal fisheye
|
||||
for (i = 0; i < 40; i++)
|
||||
{
|
||||
temp_src = SDL_CreateRGBSurface(SDL_SWSURFACE, 80, 1, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask,
|
||||
canvas->format->Amask);
|
||||
{
|
||||
temp_src =
|
||||
SDL_CreateRGBSurface(SDL_SWSURFACE, 80, 1, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask,
|
||||
canvas->format->Bmask, canvas->format->Amask);
|
||||
|
||||
temp_dest = SDL_CreateRGBSurface(SDL_SWSURFACE, 80 + 2 * i, 1, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask,
|
||||
canvas->format->Amask);
|
||||
temp_dest =
|
||||
SDL_CreateRGBSurface(SDL_SWSURFACE, 80 + 2 * i, 1,
|
||||
canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask,
|
||||
canvas->format->Bmask, canvas->format->Amask);
|
||||
|
||||
//upper side first
|
||||
rect.x = 0;
|
||||
rect.y = i;
|
||||
rect.w = 80;
|
||||
rect.h = 1;
|
||||
//upper side first
|
||||
rect.x = 0;
|
||||
rect.y = i;
|
||||
rect.w = 80;
|
||||
rect.h = 1;
|
||||
|
||||
temp_rect.x = i;
|
||||
temp_rect.y = 0;
|
||||
temp_rect.w = 80;
|
||||
temp_rect.h = 1;
|
||||
temp_rect.x = i;
|
||||
temp_rect.y = 0;
|
||||
temp_rect.w = 80;
|
||||
temp_rect.h = 1;
|
||||
|
||||
SDL_BlitSurface(output, &rect, temp_src, NULL);
|
||||
SDL_BlitSurface(output, &rect, temp_src, NULL);
|
||||
|
||||
temp_dest = api->scale(temp_src, 80 + 2 * i, 1, 0);
|
||||
temp_dest = api->scale(temp_src, 80 + 2 * i, 1, 0);
|
||||
|
||||
SDL_BlitSurface(temp_dest, &temp_rect, output, &rect);
|
||||
SDL_BlitSurface(temp_dest, &temp_rect, output, &rect);
|
||||
|
||||
//lower side then
|
||||
//lower side then
|
||||
|
||||
rect.y = 79 - i;
|
||||
SDL_BlitSurface(output, &rect, temp_src, NULL);
|
||||
rect.y = 79 - i;
|
||||
SDL_BlitSurface(output, &rect, temp_src, NULL);
|
||||
|
||||
temp_dest = api->scale(temp_src, 80 + 2 * i, 1, 0);
|
||||
SDL_BlitSurface(temp_dest, &temp_rect, output, &rect);
|
||||
}
|
||||
temp_dest = api->scale(temp_src, 80 + 2 * i, 1, 0);
|
||||
SDL_BlitSurface(temp_dest, &temp_rect, output, &rect);
|
||||
}
|
||||
|
||||
rect.x = x - 40;
|
||||
rect.y = y - 40;
|
||||
|
|
@ -247,7 +274,8 @@ void fisheye_draw(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, S
|
|||
for (xx = x - 40; xx < x + 40; xx++)
|
||||
|
||||
if (api->in_circle(xx - x, yy - y, 40))
|
||||
api->putpixel(canvas, xx, yy, api->getpixel(output, xx + 40 - x, yy + 40 - y));
|
||||
api->putpixel(canvas, xx, yy,
|
||||
api->getpixel(output, xx + 40 - x, yy + 40 - y));
|
||||
|
||||
|
||||
SDL_FreeSurface(oryg);
|
||||
|
|
@ -259,7 +287,8 @@ void fisheye_draw(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, S
|
|||
}
|
||||
|
||||
void fisheye_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Rect * update_rect)
|
||||
SDL_Surface * snapshot, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect)
|
||||
{
|
||||
|
||||
api->line(api, which, canvas, snapshot, ox, oy, x, y, 1, fisheye_draw);
|
||||
|
|
@ -270,26 +299,30 @@ void fisheye_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
}
|
||||
|
||||
void fisheye_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect)
|
||||
SDL_Surface * canvas, SDL_Surface * last, int x, int y,
|
||||
SDL_Rect * update_rect)
|
||||
{
|
||||
last_x = -80; /* A value that will be beyond any clicked position */
|
||||
last_y = -80;
|
||||
fisheye_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
||||
}
|
||||
|
||||
void fisheye_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
void fisheye_switchin(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void fisheye_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
void fisheye_switchout(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int fisheye_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
int fisheye_modes(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return (MODE_PAINT);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue