1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-25 17:25:13 +03:00

lcd_line now accepts DOTTED pattern

This commit is contained in:
bsongis 2014-05-22 16:46:19 +02:00
parent c6aff45638
commit e4f550085a
2 changed files with 32 additions and 38 deletions

View file

@ -686,49 +686,43 @@ void lcd_hline(xcoord_t x, uint8_t y, xcoord_t w, LcdFlags att)
} }
#if defined(CPUARM) #if defined(CPUARM)
void lcd_line(int x1, int y1, int x2, int y2, LcdFlags att) void lcd_line(xcoord_t x1, int8_t y1, xcoord_t x2, int8_t y2, uint8_t pat, LcdFlags att)
{ {
int i,dx,dy,sdx,sdy,dxabs,dyabs,x,y,px,py; int dx = x2-x1; /* the horizontal distance of the line */
int dy = y2-y1; /* the vertical distance of the line */
int dxabs = abs(dx);
int dyabs = abs(dy);
int sdx = sgn(dx);
int sdy = sgn(dy);
int x = dyabs>>1;
int y = dxabs>>1;
int px = x1;
int py = y1;
dx=x2-x1; /* the horizontal distance of the line */ if (dxabs >= dyabs) {
dy=y2-y1; /* the vertical distance of the line */ /* the line is more horizontal than vertical */
dxabs=abs(dx); for (int i=0; i<dxabs; i++) {
dyabs=abs(dy); y += dyabs;
sdx=sgn(dx); if (y>=dxabs) {
sdy=sgn(dy); y -= dxabs;
x=dyabs>>1; py += sdy;
y=dxabs>>1;
px=x1;
py=y1;
// VGA[(py<<8)+(py<<6)+px]=color;
if (dxabs>=dyabs) /* the line is more horizontal than vertical */
{
for(i=0;i<dxabs;i++)
{
y+=dyabs;
if (y>=dxabs)
{
y-=dxabs;
py+=sdy;
} }
px+=sdx; px += sdx;
lcd_plot(px,py,att); if ((1<<(px%8)) & pat)
lcd_plot(px, py, att);
} }
} }
else /* the line is more vertical than horizontal */ else {
{ /* the line is more vertical than horizontal */
for(i=0;i<dyabs;i++) for (int i=0; i<dyabs; i++) {
{ x += dxabs;
x+=dxabs; if (x >= dyabs) {
if (x>=dyabs) x -= dyabs;
{ px += sdx;
x-=dyabs;
px+=sdx;
} }
py+=sdy; py += sdy;
lcd_plot(px,py,att); if ((1<<(py%8)) & pat)
lcd_plot(px, py, att);
} }
} }
} }

View file

@ -220,7 +220,7 @@ void lcd_vline(xcoord_t x, int8_t y, int8_t h);
void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat, LcdFlags att=0); void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat, LcdFlags att=0);
#endif #endif
#if defined(CPUARM) #if defined(CPUARM)
void lcd_line(int x1, int y1, int x2, int y2, LcdFlags att=0); void lcd_line(xcoord_t x1, int8_t y1, xcoord_t x2, int8_t y2, uint8_t pat=SOLID, LcdFlags att=0);
#endif #endif
void lcd_rect(xcoord_t x, uint8_t y, xcoord_t w, uint8_t h, uint8_t pat=SOLID, LcdFlags att=0); void lcd_rect(xcoord_t x, uint8_t y, xcoord_t w, uint8_t h, uint8_t pat=SOLID, LcdFlags att=0);