diff --git a/graphics/nxglib/cursor/nxglib_cursor_backup.c b/graphics/nxglib/cursor/nxglib_cursor_backup.c index ce37c5f02e..f6ca145765 100644 --- a/graphics/nxglib/cursor/nxglib_cursor_backup.c +++ b/graphics/nxglib/cursor/nxglib_cursor_backup.c @@ -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 */ diff --git a/graphics/nxglib/cursor/nxglib_cursor_draw.c b/graphics/nxglib/cursor/nxglib_cursor_draw.c index a5a5d9ac91..557155a9ff 100644 --- a/graphics/nxglib/cursor/nxglib_cursor_draw.c +++ b/graphics/nxglib/cursor/nxglib_cursor_draw.c @@ -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; diff --git a/graphics/nxglib/cursor/nxglib_cursor_erase.c b/graphics/nxglib/cursor/nxglib_cursor_erase.c index 5f6ce7b507..a452361bd8 100644 --- a/graphics/nxglib/cursor/nxglib_cursor_erase.c +++ b/graphics/nxglib/cursor/nxglib_cursor_erase.c @@ -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;