Ok guy's, i spent 2 or 3 days to optimize my UNEXT/os windowing system,to make some performance
but i got stuck in Graphic Primitives, lines,rectangles,...,i noticed the current implementation is too slow,
and look like this
Code: Select all
void lineH(int x, int y, int len, int color,dword buffer){//draw horizontal line
for(int i=0; i<len;i++)
putPixel(x+i,y,color,buffer); //this function check border
}
Code: Select all
#define VGA 0xA0000
#define screen_width 800L
void lineH(int x, int y, int len, int color,dword buffer){//draw horizontal line
dword p;
p=buffer+(long)y*screen_width +(long)x;
memset32(p, colour, len);
}
memset32() is 32bit FLAT-mode code used to fill in the line with color.
The above function does not check to see if the line goes off the right edge of the screen.
If the line did extend past the right edge it would continue on the next line starting at the left edge.
Drawing a very long line at (800,600) can crash program, and this is my question
How to improve the code to check borders
CheerS ,
a.T.d