aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2015-02-14 10:38:24 +1000
committerinmarket <andrewh@inmarket.com.au>2015-02-14 10:38:24 +1000
commit39459872b267bd0e163f4501ac4cb8cbf617934d (patch)
tree8af04824b0e81ee57244b2a3a2c1968c16d6a2b0 /src
parent7c7459f1d2a786ae24d895e239f683b17ed6f4b3 (diff)
downloaduGFX-39459872b267bd0e163f4501ac4cb8cbf617934d.tar.gz
uGFX-39459872b267bd0e163f4501ac4cb8cbf617934d.tar.bz2
uGFX-39459872b267bd0e163f4501ac4cb8cbf617934d.zip
Fix pixel error rounding in gdispDrawConvexPoly().
The corrects strange gwin arrow button appearances for certain sizes.
Diffstat (limited to 'src')
-rw-r--r--src/gdisp/gdisp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gdisp/gdisp.c b/src/gdisp/gdisp.c
index 639581b0..f245633a 100644
--- a/src/gdisp/gdisp.c
+++ b/src/gdisp/gdisp.c
@@ -2829,6 +2829,11 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co
lk = (FIXED(lpnt->x) - lx) / (lpnt->y - y);
rk = (FIXED(rpnt->x) - rx) / (rpnt->y - y);
+ // Add error correction for rounding
+ lx += FIXED0_5;
+ rx += FIXED0_5;
+
+ // Do all the line segments
MUTEX_ENTER(g);
g->p.color = color;
while(1) {
@@ -2873,6 +2878,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co
lpnt = lpnt <= pntarray ? epnts : lpnt-1;
}
lk = (FIXED(lpnt->x) - lx) / (lpnt->y - y);
+ lx += FIXED0_5;
} else {
for (rpnt = rpnt >= epnts ? pntarray : rpnt+1; rpnt->y == y; cnt--) {
if (!cnt) {
@@ -2884,6 +2890,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co
rpnt = rpnt >= epnts ? pntarray : rpnt+1;
}
rk = (FIXED(rpnt->x) - rx) / (rpnt->y - y);
+ rx += FIXED0_5;
}
}
}