comparison src/paranormal/wave.c @ 269:69f309c8bd71 trunk

[svn] - properly calculate points
author nenolod
date Sun, 19 Nov 2006 08:23:35 -0800
parents 74f307156fa5
children 6b3773478f9e
comparison
equal deleted inserted replaced
268:a1be19f8de1f 269:69f309c8bd71
62 { 62 {
63 int channel = ( opts[0].val.ival < 0 ) ? 0 : 1; 63 int channel = ( opts[0].val.ival < 0 ) ? 0 : 1;
64 guchar value = (opts[1].val.ival < 0 || opts[1].val.ival > 255) ? 255 : opts[1].val.ival; 64 guchar value = (opts[1].val.ival < 0 || opts[1].val.ival > 255) ? 255 : opts[1].val.ival;
65 int *x_pos, *y_pos; /* dynamic tables which store the positions for the line */ 65 int *x_pos, *y_pos; /* dynamic tables which store the positions for the line */
66 int *x2_pos, *y2_pos; /* dynamic tables which store the positions for the line */ 66 int *x2_pos, *y2_pos; /* dynamic tables which store the positions for the line */
67 int i, step; 67 int i;
68 float step;
68 69
69 x_pos = g_new0(int, 257); 70 x_pos = g_new0(int, 257);
70 y_pos = g_new0(int, 257); 71 y_pos = g_new0(int, 257);
71 x2_pos = g_new0(int, 257); 72 x2_pos = g_new0(int, 257);
72 y2_pos = g_new0(int, 257); 73 y2_pos = g_new0(int, 257);
73 74
74 step = pn_image_data->width / 256; 75 step = pn_image_data->width / 256.;
75 76
76 /* calculate the line. */ 77 /* calculate the line. */
77 for (i = 0; i < 256; i++) 78 for (i = 0; i < 256; i++)
78 { 79 {
79 if (opts[0].val.ival != 0) 80 if (opts[0].val.ival != 0)
180 { 181 {
181 int channel = ( opts[0].val.ival < 0 ) ? 0 : 1; 182 int channel = ( opts[0].val.ival < 0 ) ? 0 : 1;
182 guchar value = (opts[1].val.ival < 0 || opts[1].val.ival > 255) ? 255 : opts[1].val.ival; 183 guchar value = (opts[1].val.ival < 0 || opts[1].val.ival > 255) ? 255 : opts[1].val.ival;
183 int *x_pos, *y_pos; /* dynamic tables which store the positions for the line */ 184 int *x_pos, *y_pos; /* dynamic tables which store the positions for the line */
184 int *x2_pos, *y2_pos; /* dynamic tables which store the positions for the line */ 185 int *x2_pos, *y2_pos; /* dynamic tables which store the positions for the line */
185 int i, step; 186 int i;
187 float step;
186 188
187 x_pos = g_new0(int, 129); 189 x_pos = g_new0(int, 129);
188 y_pos = g_new0(int, 129); 190 y_pos = g_new0(int, 129);
189 x2_pos = g_new0(int, 129); 191 x2_pos = g_new0(int, 129);
190 y2_pos = g_new0(int, 129); 192 y2_pos = g_new0(int, 129);
191 193
192 step = pn_image_data->height / 128; 194 step = pn_image_data->height / 128.;
193 195
194 /* calculate the line. */ 196 /* calculate the line. */
195 for (i = 0; i < 128; i++) 197 for (i = 0; i < 128; i++)
196 { 198 {
197 if (opts[0].val.ival != 0) 199 if (opts[0].val.ival != 0)