From c4f618e590461ab74d8d9a00389c2012c8497485 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 13 Apr 2019 15:08:32 -0600 Subject: [PATCH] graphics/nxbe: This seems to fix the last of software cursor bugs. On the LPC54, it looks pretty clean. Not flickery as I feared. Probably not so good on low end displays. Possible transient artifacts? Not sure, maybe. Or maybe my eyes are playing tricks froom staring at this too long. --- graphics/nxbe/nxbe.h | 12 ++++++------ graphics/nxbe/nxbe_bitmap.c | 6 +++--- graphics/nxbe/nxbe_cursor_backupdraw.c | 6 +++--- graphics/nxbe/nxbe_fill.c | 2 +- graphics/nxbe/nxbe_flush.c | 10 +++++----- graphics/nxglib/cursor/nxglib_cursor_backup.c | 4 ++-- graphics/nxglib/cursor/nxglib_cursor_draw.c | 4 ++-- graphics/nxglib/cursor/nxglib_cursor_erase.c | 4 ++-- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/graphics/nxbe/nxbe.h b/graphics/nxbe/nxbe.h index 89c8aa78e5..f2be127c6e 100644 --- a/graphics/nxbe/nxbe.h +++ b/graphics/nxbe/nxbe.h @@ -620,7 +620,7 @@ void nxbe_move(FAR struct nxbe_window_s *wnd, * Input Parameters: * wnd - The window that will receive the bitmap image * dest - Describes the rectangular region on the display that will - * receive the the bit map. + * receive the the bit map (window coordinate frame). * src - The start of the source image. * origin - The origin of the upper, left-most corner of the full bitmap. * Both dest and origin are in window coordinates, however, origin @@ -651,7 +651,7 @@ void nxbe_bitmap_dev(FAR struct nxbe_window_s *wnd, * Input Parameters: * wnd - The window that will receive the bitmap image * dest - Describes the rectangular region on the display that will - * receive the the bit map. + * receive the the bit map (window coordinate frame). * src - The start of the source image. * origin - The origin of the upper, left-most corner of the full bitmap. * Both dest and origin are in window coordinates, however, origin @@ -687,12 +687,12 @@ void nxbe_bitmap(FAR struct nxbe_window_s *wnd, * * Input Parameters (same as for nxbe_bitmap_dev): * wnd - The window that will receive the bitmap image - * dest - Describes the rectangular region on the display that will - * receive the the bit map. + * dest - Describes the rectangular region in the window that will + * receive the the bit map (window coordinate frame). * src - The start of the source image. * origin - The origin of the upper, left-most corner of the full bitmap. - * Both dest and origin are in window coordinates, however, origin - * may lie outside of the display. + * Both dest and origin are in window coordinates, however, + * origin may lie outside of the display. * stride - The width of the full source image in bytes. * * Returned Value: diff --git a/graphics/nxbe/nxbe_bitmap.c b/graphics/nxbe/nxbe_bitmap.c index 0ba79c4213..2bb8bb3d7c 100644 --- a/graphics/nxbe/nxbe_bitmap.c +++ b/graphics/nxbe/nxbe_bitmap.c @@ -100,7 +100,7 @@ static void bitmap_clipcopy(FAR struct nxbe_clipops_s *cops, * Input Parameters: * wnd - The window that will receive the bitmap image * dest - Describes the rectangular on the display that will receive the - * the bit map. + * the bit map (window coordinate frame). * src - The start of the source image. * origin - The origin of the upper, left-most corner of the full bitmap. * Both dest and origin are in window coordinates, however, origin @@ -193,7 +193,7 @@ static inline void nxbe_bitmap_pwfb(FAR struct nxbe_window_s *wnd, * Input Parameters: * wnd - The window that will receive the bitmap image * dest - Describes the rectangular region on the display that will - * receive the the bit map. + * receive the the bit map (window coordinate frame). * src - The start of the source image. * origin - The origin of the upper, left-most corner of the full bitmap. * Both dest and origin are in window coordinates, however, origin @@ -293,7 +293,7 @@ void nxbe_bitmap_dev(FAR struct nxbe_window_s *wnd, * Input Parameters: * wnd - The window that will receive the bitmap image * dest - Describes the rectangular region on the display that will - * receive the the bit map. + * receive the the bit map (window coordinate frame). * src - The start of the source image. * origin - The origin of the upper, left-most corner of the full bitmap. * Both dest and origin are in window coordinates, however, origin diff --git a/graphics/nxbe/nxbe_cursor_backupdraw.c b/graphics/nxbe/nxbe_cursor_backupdraw.c index 7171c713d9..e8dbe4f21f 100644 --- a/graphics/nxbe/nxbe_cursor_backupdraw.c +++ b/graphics/nxbe/nxbe_cursor_backupdraw.c @@ -114,7 +114,7 @@ void nxbe_cursor_backupdraw_dev(FAR struct nxbe_state_s *be, { /* Clip to the limits of the display */ - nxgl_rectintersect(&bounds, &bounds, &be->bkgd.bounds); + nxgl_rectintersect(&bounds, rect, &be->bkgd.bounds); if (!nxgl_nullrect(&bounds)) { _nxbe_cursor_backupdraw_dev(be, &bounds, plane); @@ -214,10 +214,10 @@ void nxbe_cursor_backupdraw_all(FAR struct nxbe_window_s *wnd, /* And then let nxbe_cursor_backupdraw_devall() do the rest */ - nxbe_cursor_backupdraw_all(be, &bounds); + nxbe_cursor_backupdraw_all(wnd, &bounds); } #else - nxbe_cursor_backupdraw(wnd->be, rect, 0); + nxbe_cursor_backupdraw(wnd, rect, 0); #endif } diff --git a/graphics/nxbe/nxbe_fill.c b/graphics/nxbe/nxbe_fill.c index f42ea766f7..c8d8826a9b 100644 --- a/graphics/nxbe/nxbe_fill.c +++ b/graphics/nxbe/nxbe_fill.c @@ -129,7 +129,7 @@ static inline void nxbe_fill_dev(FAR struct nxbe_window_s *wnd, &info.cops, &wnd->be->plane[i]); #ifdef CONFIG_NX_SWCURSOR - /* Backup and redraw the cursor in the affect region. + /* Backup and redraw the cursor in the affected region. * * REVISIT: This and the following logic belongs in the function * nxbe_clipfill(). It is here only because the struct nxbe_state_s diff --git a/graphics/nxbe/nxbe_flush.c b/graphics/nxbe/nxbe_flush.c index 277da62487..e1036756fd 100644 --- a/graphics/nxbe/nxbe_flush.c +++ b/graphics/nxbe/nxbe_flush.c @@ -71,8 +71,8 @@ * * Input Parameters (same as for nxbe_flush): * wnd - The window that will receive the bitmap image - * dest - Describes the rectangular on the display that will receive the - * the bit map (device corrdinates). + * dest - Describes the rectangular region in the window that will + * receive the the bit map (window coordinate frame). * src - The start of the source image. * origin - The origin of the upper, left-most corner of the full bitmap. * Both dest and origin are in window coordinates, however, origin @@ -95,11 +95,11 @@ void nxbe_flush(FAR struct nxbe_window_s *wnd, nxbe_bitmap_dev(wnd, dest, src, origin, stride); #ifdef CONFIG_NX_SWCURSOR - /* Update cursor backup memory and redraw the cursor in the modified window - * region. + /* Update cursor backup memory and redraw the cursor in the modified + * window region. */ - nxbe_cursor_backupdraw_devall(wnd, dest); + nxbe_cursor_backupdraw_all(wnd, dest); #endif } diff --git a/graphics/nxglib/cursor/nxglib_cursor_backup.c b/graphics/nxglib/cursor/nxglib_cursor_backup.c index 15932f97bb..814903076c 100644 --- a/graphics/nxglib/cursor/nxglib_cursor_backup.c +++ b/graphics/nxglib/cursor/nxglib_cursor_backup.c @@ -119,8 +119,8 @@ void NXGL_FUNCNAME(nxglib_cursor_backup, NXGLIB_SUFFIX) /* Get the source and destination addresses */ fbmem = (FAR uint8_t *)plane->pinfo.fbmem; - sline = (FAR uint8_t *)fbmem + sstride * be->cursor.bounds.pt1.y + - NXGL_SCALEX(be->cursor.bounds.pt1.x); + sline = (FAR uint8_t *)fbmem + sstride * intersection.pt1.y + + NXGL_SCALEX(intersection.pt1.x); dline = (FAR uint8_t *)be->cursor.bkgd + dstride * origin.y + NXGL_SCALEX(origin.x); diff --git a/graphics/nxglib/cursor/nxglib_cursor_draw.c b/graphics/nxglib/cursor/nxglib_cursor_draw.c index 557155a9ff..000dc5bfc2 100644 --- a/graphics/nxglib/cursor/nxglib_cursor_draw.c +++ b/graphics/nxglib/cursor/nxglib_cursor_draw.c @@ -169,8 +169,8 @@ void NXGL_FUNCNAME(nxglib_cursor_draw, NXGLIB_SUFFIX) fbmem = (FAR uint8_t *)plane->pinfo.fbmem; sline = be->cursor.image + sstride * origin.y + (origin.x >> 2); - dline = (FAR uint8_t *)fbmem + dstride * be->cursor.bounds.pt1.y + - NXGL_SCALEX(be->cursor.bounds.pt1.x); + dline = (FAR uint8_t *)fbmem + dstride * intersection.pt1.y + + NXGL_SCALEX(intersection.pt1.x); sshift = (3 - (origin.y & 3)) << 1; /* MS first {0, 2, 4, 6} */ diff --git a/graphics/nxglib/cursor/nxglib_cursor_erase.c b/graphics/nxglib/cursor/nxglib_cursor_erase.c index 19c968b8a9..1970e896b9 100644 --- a/graphics/nxglib/cursor/nxglib_cursor_erase.c +++ b/graphics/nxglib/cursor/nxglib_cursor_erase.c @@ -120,8 +120,8 @@ void NXGL_FUNCNAME(nxglib_cursor_erase, NXGLIB_SUFFIX) fbmem = (FAR uint8_t *)plane->pinfo.fbmem; sline = (FAR uint8_t *)be->cursor.bkgd + sstride * origin.y + NXGL_SCALEX(origin.x); - dline = (FAR uint8_t *)fbmem + dstride * be->cursor.bounds.pt1.y + - NXGL_SCALEX(be->cursor.bounds.pt1.x); + dline = (FAR uint8_t *)fbmem + dstride * intersection.pt1.y + + NXGL_SCALEX(intersection.pt1.x); /* Erase the old cursor position by copying the previous content */