mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-10-10 08:03:04 -04:00
FS#13970 - lcd_drawline() different depending on drawing direction try#2
Last patch didn't swap both x and y so was wrong and messed up the coord pair I didn't want to add more swapping due to extra overhead ultimately the issue is that you have 1/2 pixel error (-1 0 1) and when doing the reverse line the error is on the wrong side so instead get the first point from the opposite dinc Change-Id: I141c4af36a601314f2b509a9ebfcfab3b5213bcd
This commit is contained in:
parent
20c763ff89
commit
dcdb539ca5
1 changed files with 24 additions and 16 deletions
|
|
@ -911,6 +911,18 @@ void LCDFN(drawline)(int x1, int y1, int x2, int y2)
|
|||
dinc2 = (deltay - deltax) * 2;
|
||||
xinc1 = 1;
|
||||
yinc1 = 0;
|
||||
if (x1 > x2)
|
||||
{
|
||||
xinc1 = -xinc1;
|
||||
xinc2 = -xinc2;
|
||||
}
|
||||
|
||||
if (y1 > y2)
|
||||
{
|
||||
d += dinc2;
|
||||
yinc1 = -yinc1;
|
||||
yinc2 = -yinc2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -920,25 +932,21 @@ void LCDFN(drawline)(int x1, int y1, int x2, int y2)
|
|||
dinc2 = (deltax - deltay) * 2;
|
||||
xinc1 = 0;
|
||||
yinc1 = 1;
|
||||
if (x1 > x2)
|
||||
{
|
||||
d += dinc2;
|
||||
xinc1 = -xinc1;
|
||||
xinc2 = -xinc2;
|
||||
}
|
||||
|
||||
if (y1 > y2)
|
||||
{
|
||||
yinc1 = -yinc1;
|
||||
yinc2 = -yinc2;
|
||||
}
|
||||
}
|
||||
numpixels++; /* include endpoints */
|
||||
|
||||
if (x1 > x2)
|
||||
{
|
||||
/* swap their identities */
|
||||
int x0 = x2;
|
||||
x2 = x1;
|
||||
x1 = x0;
|
||||
}
|
||||
|
||||
if (y1 > y2)
|
||||
{
|
||||
/* swap their identities */
|
||||
int y0 = y2;
|
||||
y2 = y1;
|
||||
y1 = y0;
|
||||
}
|
||||
|
||||
x = x1;
|
||||
y = y1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue