From 3ed415a835a0c80d1a3bd1672458f19d14c5149d Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 4 Dec 2008 23:32:06 +0000 Subject: [PATCH] Fonts are integated git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1416 42af7a65-404d-4744-a932-0658087f49c3 --- ChangeLog | 1 + Documentation/NuttX.html | 3 ++- examples/nx/nx_events.c | 2 +- examples/nx/nx_kbdin.c | 1 - graphics/nxglib/nxglib_moverectangle.c | 6 ++++-- graphics/nxtk/nxtk_bitmaptoolbar.c | 15 +++++++++++++++ graphics/nxtk/nxtk_bitmapwindow.c | 17 ++++++++++++++++- 7 files changed, 39 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 77cc66237c..0865b1d6ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -596,4 +596,5 @@ run in more-or-less realtime. * Added more more extensive window support: frames, toolbars, etc. * Added support for bitmap fonts + * Integrated the new font support with a font test in examples/nx diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html index 2b0a0ee333..5a824cc8de 100644 --- a/Documentation/NuttX.html +++ b/Documentation/NuttX.html @@ -8,7 +8,7 @@

NuttX RTOS

-

Last Updated: December 3, 2008

+

Last Updated: December 4, 2008

@@ -1212,6 +1212,7 @@ nuttx-0.3.20 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> run in more-or-less realtime. * Added more more extensive window support: frames, toolbars, etc. * Added support for bitmap fonts + * Integrated the new font support with a font test in examples/nx pascal-0.1.3 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/examples/nx/nx_events.c b/examples/nx/nx_events.c index 464c8eafda..7d5dc399ca 100644 --- a/examples/nx/nx_events.c +++ b/examples/nx/nx_events.c @@ -145,10 +145,10 @@ static inline void nxeg_fillwindow(NXEGWINDOW hwnd, { message("nxeg_fillwindow: nxtk_fillwindow failed: %d\n", errno); } +#endif #ifdef CONFIG_NX_KBD nxeg_filltext(hwnd, rect, st); #endif -#endif } /**************************************************************************** diff --git a/examples/nx/nx_kbdin.c b/examples/nx/nx_kbdin.c index 3c5b3fb338..ae89acfe8c 100644 --- a/examples/nx/nx_kbdin.c +++ b/examples/nx/nx_kbdin.c @@ -316,7 +316,6 @@ void nxeg_tbkbdin(NXWINDOW hwnd, ubyte nch, const ubyte *ch, FAR void *arg) FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg; message("nxeg_tbkbdin: ERROR -- toolbar should not received keyboard input\n"); message("nxeg_tbkbdin%d: hwnd=%p nch=%d\n", st->wnum, hwnd, nch); - nxeg_kbdinfo(nch, ch); } #endif diff --git a/graphics/nxglib/nxglib_moverectangle.c b/graphics/nxglib/nxglib_moverectangle.c index c39c1c5601..20ec3d9270 100644 --- a/graphics/nxglib/nxglib_moverectangle.c +++ b/graphics/nxglib/nxglib_moverectangle.c @@ -145,9 +145,11 @@ void NXGL_FUNCNAME(nxgl_moverectangle,NXGLIB_SUFFIX) stride = pinfo->stride; - /* Get the dimensions of the rectange to fill: height in rows and width in bytes */ + /* Get the dimensions of the rectange to fill: width in pixels, height + * in rows + */ - width = NXGL_SCALEX(rect->pt2.x - rect->pt1.x + 1); + width = rect->pt2.x - rect->pt1.x + 1; rows = rect->pt2.y - rect->pt1.y + 1; #if NXGLIB_BITSPERPIXEL < 8 diff --git a/graphics/nxtk/nxtk_bitmaptoolbar.c b/graphics/nxtk/nxtk_bitmaptoolbar.c index 98b99bb47a..4e3aa2e9cf 100644 --- a/graphics/nxtk/nxtk_bitmaptoolbar.c +++ b/graphics/nxtk/nxtk_bitmaptoolbar.c @@ -99,6 +99,7 @@ int nxtk_bitmaptoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *dest, FAR const struct nxgl_point_s *origin, unsigned int stride) { FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hfwnd; + struct nxgl_point_s wndorigin; struct nxgl_rect_s clipdest; #ifdef CONFIG_DEBUG @@ -116,6 +117,20 @@ int nxtk_bitmaptoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *dest, nxtk_subwindowclip(fwnd, &clipdest, dest, &fwnd->tbrect); + /* Now, move the bitmap origin so that it is relative to the containing + * window, not the sub-window. + * + * Temporarily, position the origin in absolute screen coordinates + */ + + nxgl_vectoradd(&wndorigin, origin, &fwnd->fwrect.pt1); + + /* Then move the origin so that is relative to the containing window, not the + * client subwindow + */ + + nxgl_vectsubtract(&wndorigin, &wndorigin, &fwnd->wnd.bounds.pt1); + /* Then copy the bitmap */ nx_bitmap((NXWINDOW)hfwnd, &clipdest, src, origin, stride); diff --git a/graphics/nxtk/nxtk_bitmapwindow.c b/graphics/nxtk/nxtk_bitmapwindow.c index 954282eb31..c923ed964a 100644 --- a/graphics/nxtk/nxtk_bitmapwindow.c +++ b/graphics/nxtk/nxtk_bitmapwindow.c @@ -99,6 +99,7 @@ int nxtk_bitmapwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *dest, FAR const struct nxgl_point_s *origin, unsigned int stride) { FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hfwnd; + struct nxgl_point_s wndorigin; struct nxgl_rect_s clipdest; #ifdef CONFIG_DEBUG @@ -116,8 +117,22 @@ int nxtk_bitmapwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *dest, nxtk_subwindowclip(fwnd, &clipdest, dest, &fwnd->fwrect); + /* Now, move the bitmap origin so that it is relative to the containing + * window, not the sub-window. + * + * Temporarily, position the origin in absolute screen coordinates + */ + + nxgl_vectoradd(&wndorigin, origin, &fwnd->fwrect.pt1); + + /* Then move the origin so that is relative to the containing window, not the + * client subwindow + */ + + nxgl_vectsubtract(&wndorigin, &wndorigin, &fwnd->wnd.bounds.pt1); + /* Then copy the bitmap */ - nx_bitmap((NXWINDOW)hfwnd, &clipdest, src, origin, stride); + nx_bitmap((NXWINDOW)hfwnd, &clipdest, src, &wndorigin, stride); return OK; }