graphics/nxglib/cursor: Correct handling of some bounding boxes.

This commit is contained in:
Gregory Nutt 2019-04-11 08:17:18 -06:00
parent 6e80562bf9
commit a759c7cdc3
3 changed files with 18 additions and 12 deletions

View File

@ -85,6 +85,7 @@ void NXGL_FUNCNAME(nxglib_cursor_backup, NXGLIB_SUFFIX)
nxgl_coord_t width;
nxgl_coord_t height;
nxgl_coord_t sstride;
nxgl_coord_t dwidth;
nxgl_coord_t dstride;
int row;
int col;
@ -98,17 +99,18 @@ void NXGL_FUNCNAME(nxglib_cursor_backup, NXGLIB_SUFFIX)
nxgl_rectintersect(&intersection, &intersection, bounds);
if (!nxgl_nullrect(&intersection))
{
/* Get the width and the height of the images in pixels/rows */
/* Get the width and the height of the images to copy in pixels/rows */
width = be->cursor.bounds.pt2.x - be->cursor.bounds.pt1.x + 1;
height = be->cursor.bounds.pt2.y - be->cursor.bounds.pt1.y + 1;
width = intersection.pt2.x - intersection.pt1.x + 1;
height = intersection.pt2.y - intersection.pt1.y + 1;
/* Get the width of the images in bytes. */
plane = &be->plane[planeno];
sstride = plane->pinfo.stride;
dstride = NXGL_SCALEX(width);
dwidth = be->cursor.bounds.pt2.x - be->cursor.bounds.pt1.x + 1;
dstride = NXGL_SCALEX(dwidth);
/* Get the origin position in the background image */

View File

@ -126,6 +126,7 @@ void NXGL_FUNCNAME(nxglib_cursor_draw, NXGLIB_SUFFIX)
FAR NXGL_PIXEL_T *dest;
nxgl_coord_t width;
nxgl_coord_t height;
nxgl_coord_t swidth;
nxgl_coord_t sstride;
nxgl_coord_t dstride;
nxgl_coord_t sshift;
@ -142,14 +143,15 @@ void NXGL_FUNCNAME(nxglib_cursor_draw, NXGLIB_SUFFIX)
nxgl_rectintersect(&intersection, &intersection, bounds);
if (!nxgl_nullrect(&intersection))
{
/* Get the width and the height of the images in pixels/rows */
/* Get the width and the height of the images to copy in pixels/rows */
width = be->cursor.bounds.pt2.x - be->cursor.bounds.pt1.x + 1;
height = be->cursor.bounds.pt2.y - be->cursor.bounds.pt1.y + 1;
width = intersection.pt2.x - intersection.pt1.x + 1;
height = intersection.pt2.y - intersection.pt1.y + 1;
/* Get the width of the images in bytes. */
sstride = (width + 3) >> 2; /* 2 bits per pixel, 4 pixels per byte */
swidth = be->cursor.bounds.pt2.x - be->cursor.bounds.pt1.x + 1;
sstride = (swidth + 3) >> 2; /* 2 bits per pixel, 4 pixels per byte */
plane = &be->plane[planeno];
dstride = plane->pinfo.stride;

View File

@ -83,6 +83,7 @@ void NXGL_FUNCNAME(nxglib_cursor_erase, NXGLIB_SUFFIX)
FAR NXGL_PIXEL_T *dest;
nxgl_coord_t width;
nxgl_coord_t height;
nxgl_coord_t swidth;
nxgl_coord_t sstride;
nxgl_coord_t dstride;
int row;
@ -97,14 +98,15 @@ void NXGL_FUNCNAME(nxglib_cursor_erase, NXGLIB_SUFFIX)
nxgl_rectintersect(&intersection, &intersection, bounds);
if (!nxgl_nullrect(&intersection))
{
/* Get the width and the height of the images in pixels/rows */
/* Get the width and the height of the images to copy in pixels/rows */
width = be->cursor.bounds.pt2.x - be->cursor.bounds.pt1.x + 1;
height = be->cursor.bounds.pt2.y - be->cursor.bounds.pt1.y + 1;
width = intersection.pt2.x - intersection.pt1.x + 1;
height = intersection.pt2.y - intersection.pt1.y + 1;
/* Get the width of the images in bytes. */
sstride = NXGL_SCALEX(width);
swidth = be->cursor.bounds.pt2.x - be->cursor.bounds.pt1.x + 1;
sstride = NXGL_SCALEX(swidth);
plane = &be->plane[planeno];
dstride = plane->pinfo.stride;