diff options
-rw-r--r-- | nuttx/graphics/nxbe/nxbe_setsize.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/nuttx/graphics/nxbe/nxbe_setsize.c b/nuttx/graphics/nxbe/nxbe_setsize.c index a736669f3..77e9653d7 100644 --- a/nuttx/graphics/nxbe/nxbe_setsize.c +++ b/nuttx/graphics/nxbe/nxbe_setsize.c @@ -81,7 +81,7 @@ void nxbe_setsize(FAR struct nxbe_window_s *wnd, FAR const struct nxgl_rect_s *size) { - struct nxgl_rect_s rect; + struct nxgl_rect_s bounds; #ifdef CONFIG_DEBUG if (!wnd) @@ -90,22 +90,32 @@ void nxbe_setsize(FAR struct nxbe_window_s *wnd, } #endif - /* Add the window origin to get the bounding box */ + /* Save the before size of the window's bounding box */ + + nxgl_rectcopy(&bounds, &wnd->bounds); + + /* Add the window origin to supplied size get the new window bounding box */ nxgl_rectoffset(&wnd->bounds, size, wnd->origin.x, wnd->origin.y); + /* We need to update the larger of the two rectangles. That will be the + * union of the before and after sizes. + */ + + nxgl_rectunion(&bounds, &bounds, &wnd->bounds); + /* Clip the bounding box so that is lies with the screen defined by the * background window. */ - nxgl_rectintersect(&rect, &wnd->bounds, &wnd->be->bkgd.bounds); + nxgl_rectintersect(&bounds, &bounds, &wnd->be->bkgd.bounds); /* Then redraw this window AND all windows below it. Having resized the * window, we may have exposed previoulsy obscured portions of windows * below this one. */ - nxbe_redrawbelow(wnd->be, wnd, &rect); + nxbe_redrawbelow(wnd->be, wnd, &bounds); /* Report the new size/position */ |