libs/libnx/nxmu/nx_filltrapezoid.c: Fix a coordinate system error. When no clipping rectangle is falls, it falls back to use the entire window as for the clip. However, that window must then then be in window relative coordinates, not in absoute device coordinates.
This commit is contained in:
parent
c134072e05
commit
372e8b86a4
@ -285,9 +285,10 @@ void nxbe_filltrapezoid(FAR struct nxbe_window_s *wnd,
|
|||||||
nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
|
nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
|
||||||
{
|
{
|
||||||
struct nxgl_rect_s remaining;
|
struct nxgl_rect_s remaining;
|
||||||
|
struct nxgl_rect_s absclip;
|
||||||
struct nxgl_trapezoid_s devtrap;
|
struct nxgl_trapezoid_s devtrap;
|
||||||
|
|
||||||
DEBUGASSERT(wnd != NULL && trap != NULL);
|
DEBUGASSERT(wnd != NULL && clip != NULL && trap != NULL);
|
||||||
|
|
||||||
/* Offset the trapezoid by the window origin to position it within
|
/* Offset the trapezoid by the window origin to position it within
|
||||||
* the device graphics coordinate system.
|
* the device graphics coordinate system.
|
||||||
@ -304,12 +305,8 @@ void nxbe_filltrapezoid(FAR struct nxbe_window_s *wnd,
|
|||||||
|
|
||||||
/* Clip to any user specified clipping window */
|
/* Clip to any user specified clipping window */
|
||||||
|
|
||||||
if (clip != NULL)
|
nxgl_rectoffset(&absclip, clip, wnd->bounds.pt1.x, wnd->bounds.pt1.y);
|
||||||
{
|
nxgl_rectintersect(&remaining, &remaining, &absclip);
|
||||||
struct nxgl_rect_s tmp;
|
|
||||||
nxgl_rectoffset(&tmp, clip, wnd->bounds.pt1.x, wnd->bounds.pt1.y);
|
|
||||||
nxgl_rectintersect(&remaining, &remaining, &tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clip to the limits of the window and of the background screen */
|
/* Clip to the limits of the window and of the background screen */
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FEATURES
|
#ifdef CONFIG_DEBUG_FEATURES
|
||||||
if (!hwnd || !vector || width < 1 || !color)
|
if (hwnd == NULL || vector == NULL || width < 1 || color == NULL)
|
||||||
{
|
{
|
||||||
set_errno(EINVAL);
|
set_errno(EINVAL);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
|
@ -60,4 +60,3 @@ void nxgl_trapoffset(FAR struct nxgl_trapezoid_s *dest,
|
|||||||
nxgl_runoffset(&dest->top, &src->top, dx, dy);
|
nxgl_runoffset(&dest->top, &src->top, dx, dy);
|
||||||
nxgl_runoffset(&dest->bot, &src->bot, dx, dy);
|
nxgl_runoffset(&dest->bot, &src->bot, dx, dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,10 +77,10 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip,
|
|||||||
struct nxsvrmsg_filltrapezoid_s outmsg;
|
struct nxsvrmsg_filltrapezoid_s outmsg;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_FEATURES
|
||||||
/* Some debug-only sanity checks */
|
/* Some debug-only sanity checks */
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FEATURES
|
if (wnd == NULL || trap == NULL || color == NULL)
|
||||||
if (!wnd || !trap || !color)
|
|
||||||
{
|
{
|
||||||
set_errno(EINVAL);
|
set_errno(EINVAL);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
@ -94,13 +94,22 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip,
|
|||||||
|
|
||||||
/* If no clipping window was provided, then use the size of the entire window */
|
/* If no clipping window was provided, then use the size of the entire window */
|
||||||
|
|
||||||
if (clip)
|
if (clip != NULL)
|
||||||
{
|
{
|
||||||
nxgl_rectcopy(&outmsg.clip, clip);
|
nxgl_rectcopy(&outmsg.clip, clip);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nxgl_rectcopy(&outmsg.clip, &wnd->bounds);
|
struct nxgl_rect_s tmpclip;
|
||||||
|
|
||||||
|
/* Convert the window bounds to window relative coordinates */
|
||||||
|
|
||||||
|
nxgl_rectoffset(&tmpclip, &wnd->bounds,
|
||||||
|
-wnd->bounds.pt1.x, -wnd->bounds.pt1.y);
|
||||||
|
|
||||||
|
/* And use that for the clipping winding */
|
||||||
|
|
||||||
|
nxgl_rectcopy(&outmsg.clip, &tmpclip);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the trapezod and the color into the message */
|
/* Copy the trapezod and the color into the message */
|
||||||
|
Loading…
Reference in New Issue
Block a user