mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 21:08:08 +01:00
Change to the linux kernel coding style
for arq in `git ls-files *.c`; do
echo $arq;
indent -linux -l115 $arq;
done
The different line break at 115 columns is because
I use a widescreen monitor :-)
This commit is contained in:
@@ -36,9 +36,10 @@
|
||||
#include <time.h>
|
||||
#include "generic.h"
|
||||
|
||||
RImage *waves (int argc, char **argv, int width, int height, int relief) {
|
||||
RImage *waves(int argc, char **argv, int width, int height, int relief)
|
||||
{
|
||||
|
||||
int i, j, k, done, sine [256];
|
||||
int i, j, k, done, sine[256];
|
||||
int from[3] = { 0x00, 0x00, 0x00 };
|
||||
int to[3] = { 0xff, 0xff, 0xff };
|
||||
int layers, range, dx[1000], dy[1000];
|
||||
@@ -49,29 +50,28 @@ RImage *waves (int argc, char **argv, int width, int height, int relief) {
|
||||
int c;
|
||||
|
||||
optind = 1;
|
||||
for (done=0; !done; ) {
|
||||
for (done = 0; !done;) {
|
||||
static struct option long_options[] = {
|
||||
{"from", 1, 0, 'f'},
|
||||
{"to", 1, 0, 't'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
c = getopt_long (argc, argv, "f:t:",
|
||||
long_options, &option_index);
|
||||
c = getopt_long(argc, argv, "f:t:", long_options, &option_index);
|
||||
if (c == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
switch (c) {
|
||||
case 'f':
|
||||
if (!parse_color (optarg, from)) {
|
||||
error ("invalid color: %s\n", optarg);
|
||||
if (!parse_color(optarg, from)) {
|
||||
error("invalid color: %s\n", optarg);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
if (!parse_color (optarg, to)) {
|
||||
error ("invalid color: %s\n", optarg);
|
||||
if (!parse_color(optarg, to)) {
|
||||
error("invalid color: %s\n", optarg);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
@@ -84,12 +84,12 @@ RImage *waves (int argc, char **argv, int width, int height, int relief) {
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (!start_image ("waves", argc, 2, 3, width, height, &image)) {
|
||||
return (RImage *)0;
|
||||
if (!start_image("waves", argc, 2, 3, width, height, &image)) {
|
||||
return (RImage *) 0;
|
||||
}
|
||||
|
||||
layers = atoi (argv[0]);
|
||||
range = atoi (argv[1]);
|
||||
layers = atoi(argv[0]);
|
||||
range = atoi(argv[1]);
|
||||
|
||||
if (layers <= 0) {
|
||||
layers = 1;
|
||||
@@ -102,33 +102,32 @@ RImage *waves (int argc, char **argv, int width, int height, int relief) {
|
||||
range = 1;
|
||||
}
|
||||
|
||||
for (i=0; i<256; i++) {
|
||||
sine[i] = (int) (127.0 * sin (2.0 * M_PI * i / 256)) + 128;
|
||||
for (i = 0; i < 256; i++) {
|
||||
sine[i] = (int)(127.0 * sin(2.0 * M_PI * i / 256)) + 128;
|
||||
}
|
||||
|
||||
srand (time (0));
|
||||
srand(time(0));
|
||||
|
||||
for (i=0; i<layers; i++) {
|
||||
dx[i] = random_int (range) - range / 2;
|
||||
dy[i] = random_int (range) - range / 2;
|
||||
for (i = 0; i < layers; i++) {
|
||||
dx[i] = random_int(range) - range / 2;
|
||||
dy[i] = random_int(range) - range / 2;
|
||||
}
|
||||
|
||||
cptr = image->data;
|
||||
for (i=0; i<height; i++) {
|
||||
for (j=0; j<width; j++) {
|
||||
for (i = 0; i < height; i++) {
|
||||
for (j = 0; j < width; j++) {
|
||||
int output[3], value = 0;
|
||||
for (k=0; k<layers; k++) {
|
||||
value += sine[(j*dx[k]+i*dy[k]) & 255];
|
||||
for (k = 0; k < layers; k++) {
|
||||
value += sine[(j * dx[k] + i * dy[k]) & 255];
|
||||
}
|
||||
interpolate_color (output, from, to, value / layers);
|
||||
interpolate_color(output, from, to, value / layers);
|
||||
*cptr++ = output[0];
|
||||
*cptr++ = output[1];
|
||||
*cptr++ = output[2];
|
||||
if ( RRGBAFormat==image->format )
|
||||
if (RRGBAFormat == image->format)
|
||||
cptr++;
|
||||
}
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user