}
-static inline unsigned
+static inline bool
stipple_test(int counter, ushort pattern, int factor)
{
int b = (counter / factor) & 0xf;
- return (1 << b) & pattern;
+ return !!((1 << b) & pattern);
}
const float *pos0 = v0->data[pos];
const float *pos1 = v1->data[pos];
float start = 0;
- int state = 0;
+ bool state = 0;
float x0 = pos0[0];
float x1 = pos1[0];
stipple->counter = 0;
- /* XXX ToDo: intead of iterating pixel-by-pixel, use a look-up table.
+ /* XXX ToDo: instead of iterating pixel-by-pixel, use a look-up table.
*/
for (i = 0; i < length; i++) {
- int result = stipple_test( (int) stipple->counter+i,
- (ushort) stipple->pattern, stipple->factor );
+ bool result = stipple_test((int)stipple->counter + i,
+ (ushort)stipple->pattern, stipple->factor);
if (result != state) {
/* changing from "off" to "on" or vice versa */
- if (state) {
- if (start != i) {
+ if (state) {
+ if (start != i) {
/* finishing an "on" segment */
- emit_segment( stage, header, start / length, i / length );
+ emit_segment(stage, header, start / length, i / length);
}
- }
- else {
+ }
+ else {
/* starting an "on" segment */
- start = (float) i;
- }
- state = result;
+ start = (float)i;
+ }
+ state = result;
}
}
if (state && start < length)
- emit_segment( stage, header, start / length, 1.0 );
+ emit_segment(stage, header, start / length, 1.0);
stipple->counter += length;
}