This commit is contained in:
Sylvain PILLOT 2023-05-11 18:51:28 +02:00
parent a823c24c66
commit b1efb3141d
2 changed files with 10 additions and 10 deletions

View File

@ -32,7 +32,7 @@ typedef struct
int16_t y;
} Pixel;
#define TABLE_WIDTH 396
#define TABLE_WIDTH 512
Pixel TablePixels[14*TABLE_WIDTH]; // 14 fragments each able to store as much pixels as width
uint16_t NbPixels[14]; // Nunmber of pixels in each fragment
@ -50,7 +50,7 @@ void AddPixel( int16_t xp, int16_t yp )
{
if (xp >= 0 && xp < azrp_width && yp >= 0 && yp < azrp_height)
{
uint8_t currfrag = yp >> 4;
uint8_t currfrag = yp / azrp_frag_height;
uint16_t nbpixinfrag = NbPixels[ currfrag ];
@ -78,17 +78,17 @@ void azrp_circle(int xc, int yc, int rad, int color)
// The circle is fully outside the screen
if ((xmax < 0) || (xmin > azrp_width) || (ymax < 0) || (ymin > azrp_height))
if ((xmax < 0) || (xmin >= azrp_width) || (ymax < 0) || (ymin >= azrp_height))
{
prof_leave(azrp_perf_cmdgen);
return;
}
int ytop = max( xmin, 0 );
int ybot = min( xmax, azrp_height );
int ytop = max( ymin, 0 );
int ybot = min( ymax, azrp_height-1 );
int frag_first = ytop >> 4;
int frag_last = ybot >> 4;
int frag_first = ytop / azrp_frag_height;
int frag_last = ybot / azrp_frag_height;
int frag_count = frag_last - frag_first + 1;

View File

@ -107,8 +107,8 @@ void azrp_line(int xA, int yA, int xB, int yB, int color)
x2 = x[1];
y2 = y[1];
int frag_first = y1 >> 4;
int frag_last = y2 >> 4;
int frag_first = y1 / azrp_frag_height;
int frag_last = y2 / azrp_frag_height;
int frag_count = frag_last - frag_first + 1;
struct command cmd;
@ -125,7 +125,7 @@ void azrp_line(int xA, int yA, int xB, int yB, int color)
cmd.sy = SGN(y2-y1);
cmd.i = 0;
cmd.cumul = (cmd.dx >= cmd.dy) ? cmd.dx >> 1 : cmd.dy >> 1;
cmd.cumul = (cmd.dx >= cmd.dy) ? cmd.dx/2 : cmd.dy/2;
azrp_queue_command(&cmd, sizeof cmd, frag_first, frag_count);
prof_leave(azrp_perf_cmdgen);