From 24b649553719312f79127bba841818a43a00fd8a Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 23 Nov 2012 15:49:06 +0000 Subject: 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 --- nuttx/graphics/nxglib/nxglib_splitline.c | 7 +++++-- nuttx/graphics/nxtk/nxtk_filltrapwindow.c | 11 +++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'nuttx/graphics') 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 #include +#include #include @@ -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); } -- cgit v1.2.3