mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 08:38:38 +08:00
minor refactoring
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1322 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
69adbecf5c
commit
7ae6a40baa
5 changed files with 24 additions and 13 deletions
|
@ -123,6 +123,8 @@ void nxbe_bitmap(FAR struct nxbe_window_s *wnd, FAR const struct nxgl_rect_s *de
|
|||
FAR const struct nxgl_point_s *origin, unsigned int stride)
|
||||
{
|
||||
struct nx_bitmap_s info;
|
||||
struct nxgl_rect_s bounds;
|
||||
struct nxgl_point_s offset;
|
||||
struct nxgl_rect_s remaining;
|
||||
int i;
|
||||
|
||||
|
@ -133,11 +135,16 @@ void nxbe_bitmap(FAR struct nxbe_window_s *wnd, FAR const struct nxgl_rect_s *de
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Offset the rectangle and image origin by the window origin */
|
||||
|
||||
nxgl_rectoffset(&bounds, dest, wnd->origin.x, wnd->origin.y);
|
||||
nxgl_vectoradd(&offset, origin, &wnd->origin);
|
||||
|
||||
/* Verify that the destination rectangle begins "below" and to the "right"
|
||||
* of the origin
|
||||
*/
|
||||
|
||||
if (dest->pt1.x < origin->x || dest->pt1.y < origin->y)
|
||||
if (bounds.pt1.x < origin->x || bounds.pt1.y < origin->y)
|
||||
{
|
||||
gdbg("Bad dest start position\n");
|
||||
return;
|
||||
|
@ -147,7 +154,7 @@ void nxbe_bitmap(FAR struct nxbe_window_s *wnd, FAR const struct nxgl_rect_s *de
|
|||
* with of the source bitmap data
|
||||
*/
|
||||
|
||||
if ((((dest->pt2.x - origin->x) * wnd->be->plane[0].pinfo.bpp) >> 3) > stride)
|
||||
if ((((bounds.pt2.x - offset.x) * wnd->be->plane[0].pinfo.bpp) >> 3) > stride)
|
||||
{
|
||||
gdbg("Bad dest width\n");
|
||||
return;
|
||||
|
@ -155,7 +162,7 @@ void nxbe_bitmap(FAR struct nxbe_window_s *wnd, FAR const struct nxgl_rect_s *de
|
|||
|
||||
/* Clip to the limits of the window and of the background screen */
|
||||
|
||||
nxgl_rectintersect(&remaining, dest, &wnd->bounds);
|
||||
nxgl_rectintersect(&remaining, &bounds, &wnd->bounds);
|
||||
nxgl_rectintersect(&remaining, &remaining, &wnd->be->bkgd.bounds);
|
||||
if (nxgl_nullrect(&remaining))
|
||||
{
|
||||
|
@ -173,8 +180,8 @@ void nxbe_bitmap(FAR struct nxbe_window_s *wnd, FAR const struct nxgl_rect_s *de
|
|||
info.cops.visible = nxs_clipcopy;
|
||||
info.cops.obscured = nxbe_clipnull;
|
||||
info.src = src[i];
|
||||
info.origin.x = origin->x;
|
||||
info.origin.y = origin->y;
|
||||
info.origin.x = offset.x;
|
||||
info.origin.y = offset.y;
|
||||
info.stride = stride;
|
||||
|
||||
nxbe_clipper(wnd->above, &remaining, NX_CLIPORDER_DEFAULT,
|
||||
|
|
|
@ -121,9 +121,13 @@ void nxbe_fill(FAR struct nxbe_window_s *wnd,
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Offset the rectangle by the window origin to convert it into a bounding box */
|
||||
|
||||
nxgl_rectoffset(&remaining, rect, wnd->origin.x, wnd->origin.y);
|
||||
|
||||
/* Clip to the limits of the window and of the background screen */
|
||||
|
||||
nxgl_rectintersect(&remaining, rect, &wnd->bounds);
|
||||
nxgl_rectintersect(&remaining, &remaining, &wnd->bounds);
|
||||
nxgl_rectintersect(&remaining, &remaining, &wnd->be->bkgd.bounds);
|
||||
|
||||
if (!nxgl_nullrect(&remaining))
|
||||
|
|
|
@ -209,9 +209,13 @@ void nxbe_move(FAR struct nxbe_window_s *wnd, FAR const struct nxgl_rect_s *rect
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Offset the rectangle by the window origin to create a bounding box */
|
||||
|
||||
nxgl_rectoffset(&remaining, rect, wnd->origin.x, wnd->origin.y);
|
||||
|
||||
/* Clip to the limits of the window and of the background screen */
|
||||
|
||||
nxgl_rectintersect(&remaining, rect, &wnd->bounds);
|
||||
nxgl_rectintersect(&remaining, &remaining, &wnd->bounds);
|
||||
nxgl_rectintersect(&remaining, &remaining, &wnd->be->bkgd.bounds);
|
||||
|
||||
if (nxgl_nullrect(&remaining))
|
||||
|
|
|
@ -118,7 +118,5 @@ void nxbe_setposition(FAR struct nxbe_window_s *wnd,
|
|||
|
||||
/* Report the new size/position */
|
||||
|
||||
#ifdef CONFIG_NX_MULTIUSER
|
||||
nxmu_reportposition(wnd);
|
||||
#endif
|
||||
nxfe_reportposition(wnd);
|
||||
}
|
||||
|
|
|
@ -107,7 +107,5 @@ void nxbe_setsize(FAR struct nxbe_window_s *wnd,
|
|||
|
||||
/* Report the new size/position */
|
||||
|
||||
#ifdef CONFIG_NX_MULTIUSER
|
||||
nxmu_reportposition(wnd);
|
||||
#endif
|
||||
nxfe_reportposition(wnd);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue