fn step(&mut self, cury: i32) {
        // if we have a shift that means we have a curve
        if self.shift != 0 {
            //printf("inner cur %d,%d next %d %d %f\n", curx, cury, next_x>>16, next_y>>16, fnext_y);
            if cury >= (self.next_y >> 16) {
                self.old_y = self.next_y;
                self.old_x = self.next_x;
                self.fullx = self.next_x;
                // increment until we have a next_y that's greater
                while self.count > 0 && (cury >= (self.next_y >> 16)) {
                    self.next_x += self.dx >> self.shift;
                    self.dx += self.ddx;
                    self.next_y += self.dy >> self.shift;
                    self.dy += self.ddy;
                    self.count -= 1;
                }
                if self.count == 0 {
                    // for the last line sgement we can
                    // just set next_y,x to the end point
                    self.next_y = self.y2 << 16;
                    self.next_x = self.x2 << 16;
                }
                // update slope if we're going to be using it
                // we want to avoid dividing by 0 which can happen if we exited the loop above early
                if (cury + 1) < self.y2 {
                    // the maximum our x value can be is 4095 (which is 12 bits).
                    // 12 + 3 + 16 = 31 which gives us an extra bit of room
                    // to handle overflow.
                    self.slope_x =
                        ((self.next_x - self.old_x) << 3) / ((self.next_y - self.old_y) >> 13);
                }
            }
            self.fullx += self.slope_x;
        } else {
            // XXX: look into bresenham to control error here

            self.fullx += self.slope_x;
        }
        //cury += 1;
    }
// we want this to inline into step_edges() to
// avoid the call overhead
we want this to inline into step_edges() to
avoid the call overhead
we want this to inline into step_edges () to avoid the call overhead
fn step(&mut self, cury: i32) {
        // if we have a shift that means we have a curve
        if self.shift != 0 {
            //printf("inner cur %d,%d next %d %d %f\n", curx, cury, next_x>>16, next_y>>16, fnext_y);
            if cury >= (self.next_y >> 16) {
                self.old_y = self.next_y;
                self.old_x = self.next_x;
                self.fullx = self.next_x;
                // increment until we have a next_y that's greater
                while self.count > 0 && (cury >= (self.next_y >> 16)) {
                    self.next_x += self.dx >> self.shift;
                    self.dx += self.ddx;
                    self.next_y += self.dy >> self.shift;
                    self.dy += self.ddy;
                    self.count -= 1;
                }
                if self.count == 0 {
                    // for the last line sgement we can
                    // just set next_y,x to the end point
                    self.next_y = self.y2 << 16;
                    self.next_x = self.x2 << 16;
                }
                // update slope if we're going to be using it
                // we want to avoid dividing by 0 which can happen if we exited the loop above early
                if (cury + 1) < self.y2 {
                    // the maximum our x value can be is 4095 (which is 12 bits).
                    // 12 + 3 + 16 = 31 which gives us an extra bit of room
                    // to handle overflow.
                    self.slope_x =
                        ((self.next_x - self.old_x) << 3) / ((self.next_y - self.old_y) >> 13);
                }
            }
            self.fullx += self.slope_x;
        } else {
            // XXX: look into bresenham to control error here
            self.fullx += self.slope_x;
        }
        //cury += 1;
    }
fn step ( & mut self , cury : i32 ) { // if we have a shift that means we have a curve if self . shift != 0 { //printf("inner cur %d,%d next %d %d %f\n", curx, cury, next_x>>16, next_y>>16, fnext_y); if cury >= ( self . next_y >> 16 ) { self . old_y = self . next_y ; self . old_x = self . next_x ; self . fullx = self . next_x ; // increment until we have a next_y that's greater while self . count > 0 && ( cury >= ( self . next_y >> 16 ) ) { self . next_x += self . dx >> self . shift ; self . dx += self . ddx ; self . next_y += self . dy >> self . shift ; self . dy += self . ddy ; self . count -= 1 ; } if self . count == 0 { // for the last line sgement we can // just set next_y,x to the end point self . next_y = self . y2 << 16 ; self . next_x = self . x2 << 16 ; } // update slope if we're going to be using it // we want to avoid dividing by 0 which can happen if we exited the loop above early if ( cury + 1 ) < self . y2 { // the maximum our x value can be is 4095 (which is 12 bits). // 12 + 3 + 16 = 31 which gives us an extra bit of room // to handle overflow. self . slope_x = ( ( self . next_x - self . old_x ) << 3 ) / ( ( self . next_y - self . old_y ) >> 13 ) ; } } self . fullx += self . slope_x ; } else { // XXX: look into bresenham to control error here self . fullx += self . slope_x ; } //cury += 1; }
we want this to inline into step_edges() to
avoid the call overhead
we want this to inline into step_edges () to avoid the call overhead
&mut self
cury
i32
&mut self
cury
i32