From 683cd4c0459d6ac468762f8446eca4a1a38a7e6e Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 18 Mar 2019 13:29:58 -0600 Subject: [PATCH] libs/libnx/nxtk: Fix more cases where we were using the wrong coordinate system. --- libs/libnx/nxtk/nxtk_closetoolbar.c | 11 ++++++++++- libs/libnx/nxtk/nxtk_opentoolbar.c | 11 ++++++++++- libs/libnx/nxtk/nxtk_setsize.c | 11 ++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/libs/libnx/nxtk/nxtk_closetoolbar.c b/libs/libnx/nxtk/nxtk_closetoolbar.c index 67f333b774..e3b060205b 100644 --- a/libs/libnx/nxtk/nxtk_closetoolbar.c +++ b/libs/libnx/nxtk/nxtk_closetoolbar.c @@ -89,7 +89,16 @@ int nxtk_closetoolbar(NXTKWINDOW hfwnd) if (NXBE_ISRAMBACKED(&fwnd->wnd)) { - (void)nxtk_drawframe(fwnd, &fwnd->wnd.bounds); /* Does not fail */ + struct nxgl_rect_s relbounds; + + /* Convert to a window-relative bounding box */ + + nxgl_rectoffset(&relbounds, &fwnd->wnd.bounds, + -fwnd->wnd.bounds.pt1.x, -fwnd->wnd.bounds.pt1.y); + + /* Then re-draw the frame */ + + (void)nxtk_drawframe(fwnd, &relbounds); /* Does not fail */ } else #endif diff --git a/libs/libnx/nxtk/nxtk_opentoolbar.c b/libs/libnx/nxtk/nxtk_opentoolbar.c index 5bfc48bbd8..33ccdb4d07 100644 --- a/libs/libnx/nxtk/nxtk_opentoolbar.c +++ b/libs/libnx/nxtk/nxtk_opentoolbar.c @@ -103,7 +103,16 @@ int nxtk_opentoolbar(NXTKWINDOW hfwnd, nxgl_coord_t height, if (NXBE_ISRAMBACKED(&fwnd->wnd)) { - (void)nxtk_drawframe(fwnd, &fwnd->wnd.bounds); /* Does not fail */ + struct nxgl_rect_s relbounds; + + /* Convert to a window-relative bounding box */ + + nxgl_rectoffset(&relbounds, &fwnd->wnd.bounds, + -fwnd->wnd.bounds.pt1.x, -fwnd->wnd.bounds.pt1.y); + + /* Then re-draw the frame */ + + (void)nxtk_drawframe(fwnd, &relbounds); /* Does not fail */ } else #endif diff --git a/libs/libnx/nxtk/nxtk_setsize.c b/libs/libnx/nxtk/nxtk_setsize.c index de246dcaa8..3ca99e17f0 100644 --- a/libs/libnx/nxtk/nxtk_setsize.c +++ b/libs/libnx/nxtk/nxtk_setsize.c @@ -103,7 +103,16 @@ int nxtk_setsize(NXTKWINDOW hfwnd, FAR const struct nxgl_size_s *size) if (ret >= 0 && NXBE_ISRAMBACKED(&fwnd->wnd)) { - ret = nxtk_drawframe(fwnd, &fwnd->wnd.bounds); + struct nxgl_rect_s relbounds; + + /* Convert to a window-relative bounding box */ + + nxgl_rectoffset(&relbounds, &fwnd->wnd.bounds, + -fwnd->wnd.bounds.pt1.x, -fwnd->wnd.bounds.pt1.y); + + /* Then re-draw the frame */ + + (void)nxtk_drawframe(fwnd, &relbounds); /* Does not fail */ } #endif