void nxbe_setsize(FAR struct nxbe_window_s *wnd, FAR const struct nxgl_size_s *size) { struct nxgl_rect_s bounds; #ifdef CONFIG_DEBUG if (!wnd) { return; } #endif /* Save the before size of the window's bounding box */ nxgl_rectcopy(&bounds, &wnd->bounds); /* Add the window origin to the supplied size get the new window bounding box */ wnd->bounds.pt2.x = wnd->bounds.pt1.x + size->w - 1; wnd->bounds.pt2.y = wnd->bounds.pt1.y + size->h - 1; /* Clip the new bounding box so that lies within the background screen */ nxgl_rectintersect(&wnd->bounds, &wnd->bounds, &wnd->be->bkgd.bounds); /* 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); /* Report the new size/position */ nxfe_reportposition(wnd); /* 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, &bounds); }
void nxbe_setposition(FAR struct nxbe_window_s *wnd, FAR const struct nxgl_point_s *pos) { struct nxgl_rect_s before; struct nxgl_rect_s rect; #ifdef CONFIG_DEBUG if (!wnd) { return; } #endif /* Back out the old window origin position from the bounding box */ nxgl_rectoffset(&rect, &wnd->bounds, -wnd->bounds.pt1.x, -wnd->bounds.pt1.y); /* Add the new window origin into the bounding box */ nxgl_rectcopy(&before, &wnd->bounds); nxgl_rectoffset(&wnd->bounds, &rect, pos->x, pos->y); /* Get the union of the 'before' bounding box and the 'after' bounding * this union is the region of the display that must be updated. */ nxgl_rectunion(&rect, &before, &wnd->bounds); nxgl_rectintersect(&rect, &rect, &wnd->be->bkgd.bounds); /* Report the new size/position */ nxfe_reportposition(wnd); /* Then redraw this window AND all windows below it. Having moved the * window, we may have exposed previoulsy obscured portions of windows * below this one. */ nxbe_redrawbelow(wnd->be, wnd, &rect); }