aboutsummaryrefslogtreecommitdiff
path: root/nuttx/graphics
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-23 15:49:06 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-23 15:49:06 +0000
commit24b649553719312f79127bba841818a43a00fd8a (patch)
tree217f8115528194e63b6b681ed7e2b8746ec1c241 /nuttx/graphics
parent99cc52c0763dea695fc740ed2dcfaed7468febd5 (diff)
downloadpx4-firmware-24b649553719312f79127bba841818a43a00fd8a.tar.gz
px4-firmware-24b649553719312f79127bba841818a43a00fd8a.tar.bz2
px4-firmware-24b649553719312f79127bba841818a43a00fd8a.zip
Several changes (mostly graphics related) from Petteri Aimonen
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5385 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/graphics')
-rw-r--r--nuttx/graphics/nxglib/nxglib_splitline.c7
-rw-r--r--nuttx/graphics/nxtk/nxtk_filltrapwindow.c11
2 files changed, 14 insertions, 4 deletions
diff --git a/nuttx/graphics/nxglib/nxglib_splitline.c b/nuttx/graphics/nxglib/nxglib_splitline.c
index 84892b67e..cbf2d5ff3 100644
--- a/nuttx/graphics/nxglib/nxglib_splitline.c
+++ b/nuttx/graphics/nxglib/nxglib_splitline.c
@@ -41,6 +41,7 @@
#include <string.h>
#include <errno.h>
+#include <stdlib.h>
#include <nuttx/nx/nxglib.h>
@@ -192,9 +193,11 @@ int nxgl_splitline(FAR struct nxgl_vector_s *vector,
/* The final degenerate case */
- if (linewidth == 1)
+ if (linewidth == 1 &&
+ abs(line.pt2.x - line.pt1.x) < (line.pt2.y - line.pt1.y))
{
- /* A line of width 1 is basically a single parallelogram of width 1 */
+ /* A close to vertical line of width 1 is basically
+ * a single parallelogram of width 1 */
traps[1].top.x1 = itob16(line.pt1.x);
traps[1].top.x2 = traps[1].top.x1;
diff --git a/nuttx/graphics/nxtk/nxtk_filltrapwindow.c b/nuttx/graphics/nxtk/nxtk_filltrapwindow.c
index c1032f1e7..55c051ffd 100644
--- a/nuttx/graphics/nxtk/nxtk_filltrapwindow.c
+++ b/nuttx/graphics/nxtk/nxtk_filltrapwindow.c
@@ -94,6 +94,7 @@ int nxtk_filltrapwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_trapezoid_s *tra
{
FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hfwnd;
struct nxgl_rect_s relclip;
+ struct nxgl_trapezoid_s reltrap;
#ifdef CONFIG_DEBUG
if (!hfwnd || !trap || !color)
@@ -103,8 +104,14 @@ int nxtk_filltrapwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_trapezoid_s *tra
}
#endif
- /* Perform the fill, clipping to the client window */
+ /* Move the trapezoid from window contents area to window area */
+ nxgl_trapoffset(&reltrap, trap,
+ fwnd->fwrect.pt1.x - fwnd->wnd.bounds.pt1.x,
+ fwnd->fwrect.pt1.y - fwnd->wnd.bounds.pt1.y);
+
+ /* Perform the fill, clipping to the client window */
nxgl_rectoffset(&relclip, &fwnd->fwrect, -fwnd->wnd.bounds.pt1.x, -fwnd->wnd.bounds.pt1.y);
- return nx_filltrapezoid((NXWINDOW)hfwnd, &relclip, trap, color);
+
+ return nx_filltrapezoid((NXWINDOW)hfwnd, &relclip, &reltrap, color);
}