From: Clive Crous (ccrous@shoprite.co.za)
Date: Tue 30 Nov 1999 - 16:33:35 IST
ack i realized after the post how easy it would be to add proper bounds checking so *shrug* folows: ---------------------------------------------------------- <SNIP> >>void putsemipixel(int x, int y) { >> if ((y<0)||(y>MAX_Y)||(x<0)||(x>MAX_X)) return above line becomes : if ((y<0)||(y>MAX_Y)) return <SNIP> >>for (counter=y_min;counter<=y_max;counter++) { >> if (x_max[counter]>=x_min[counter]) { >> gl_hline(x_min[counter], counter, x_max[counter], color); >> } >>} becomes: for (counter=y_min;counter<=y_max;counter++) { if (x_max[counter]>=x_min[counter]) { if (x_min[counter]<0) x_min[counter] = 0; if (x_max[counter]>MAX_X) x_max[counter] = MAX_X; gl_hline(x_min[counter], counter, x_max[counter], color); } } sorry about wasted bandwidth Clive
This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:22 IST