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:
patacongo
2008-11-28 01:33:18 +00:00
parent 69adbecf5c
commit 7ae6a40baa
5 changed files with 24 additions and 13 deletions
+12 -5
View File
@@ -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) FAR const struct nxgl_point_s *origin, unsigned int stride)
{ {
struct nx_bitmap_s info; struct nx_bitmap_s info;
struct nxgl_rect_s bounds;
struct nxgl_point_s offset;
struct nxgl_rect_s remaining; struct nxgl_rect_s remaining;
int i; int i;
@@ -133,11 +135,16 @@ void nxbe_bitmap(FAR struct nxbe_window_s *wnd, FAR const struct nxgl_rect_s *de
} }
#endif #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" /* Verify that the destination rectangle begins "below" and to the "right"
* of the origin * 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"); gdbg("Bad dest start position\n");
return; 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 * 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"); gdbg("Bad dest width\n");
return; 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 */ /* 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); nxgl_rectintersect(&remaining, &remaining, &wnd->be->bkgd.bounds);
if (nxgl_nullrect(&remaining)) 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.visible = nxs_clipcopy;
info.cops.obscured = nxbe_clipnull; info.cops.obscured = nxbe_clipnull;
info.src = src[i]; info.src = src[i];
info.origin.x = origin->x; info.origin.x = offset.x;
info.origin.y = origin->y; info.origin.y = offset.y;
info.stride = stride; info.stride = stride;
nxbe_clipper(wnd->above, &remaining, NX_CLIPORDER_DEFAULT, nxbe_clipper(wnd->above, &remaining, NX_CLIPORDER_DEFAULT,
+5 -1
View File
@@ -121,9 +121,13 @@ void nxbe_fill(FAR struct nxbe_window_s *wnd,
} }
#endif #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 */ /* 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); nxgl_rectintersect(&remaining, &remaining, &wnd->be->bkgd.bounds);
if (!nxgl_nullrect(&remaining)) if (!nxgl_nullrect(&remaining))
+5 -1
View File
@@ -209,9 +209,13 @@ void nxbe_move(FAR struct nxbe_window_s *wnd, FAR const struct nxgl_rect_s *rect
} }
#endif #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 */ /* 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); nxgl_rectintersect(&remaining, &remaining, &wnd->be->bkgd.bounds);
if (nxgl_nullrect(&remaining)) if (nxgl_nullrect(&remaining))
+1 -3
View File
@@ -118,7 +118,5 @@ void nxbe_setposition(FAR struct nxbe_window_s *wnd,
/* Report the new size/position */ /* Report the new size/position */
#ifdef CONFIG_NX_MULTIUSER nxfe_reportposition(wnd);
nxmu_reportposition(wnd);
#endif
} }
+1 -3
View File
@@ -107,7 +107,5 @@ void nxbe_setsize(FAR struct nxbe_window_s *wnd,
/* Report the new size/position */ /* Report the new size/position */
#ifdef CONFIG_NX_MULTIUSER nxfe_reportposition(wnd);
nxmu_reportposition(wnd);
#endif
} }