graphics: fix nxstyle errors

Fix nxstyle errors to pass CI

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
This commit is contained in:
Alin Jerpelea
2021-02-05 09:05:48 +01:00
committed by Alan Carvalho de Assis
parent 87596d74dd
commit f177951c39
55 changed files with 453 additions and 312 deletions
+13 -11
View File
@@ -75,7 +75,7 @@ struct nxbe_clipstack_s
{ {
uint16_t npushed; /* Number of deferred rectangles in stack */ uint16_t npushed; /* Number of deferred rectangles in stack */
uint16_t mxrects; /* The capacity of the stack */ uint16_t mxrects; /* The capacity of the stack */
struct nxbe_cliprect_s *stack; /* The stack of deferred rectangles */ struct nxbe_cliprect_s *stack; /* The stack of deferred rectangles */
}; };
/**************************************************************************** /****************************************************************************
@@ -87,7 +87,7 @@ static const uint8_t g_nxcliporder[4][4] =
{ NX_TOP_NDX, NX_LEFT_NDX, NX_RIGHT_NDX, NX_BOTTOM_NDX }, /* index = NX_CLIPORDER_TLRB */ { NX_TOP_NDX, NX_LEFT_NDX, NX_RIGHT_NDX, NX_BOTTOM_NDX }, /* index = NX_CLIPORDER_TLRB */
{ NX_TOP_NDX, NX_RIGHT_NDX, NX_LEFT_NDX, NX_BOTTOM_NDX }, /* NX_CLIPORDER_TRLB */ { NX_TOP_NDX, NX_RIGHT_NDX, NX_LEFT_NDX, NX_BOTTOM_NDX }, /* NX_CLIPORDER_TRLB */
{ NX_BOTTOM_NDX, NX_LEFT_NDX, NX_RIGHT_NDX, NX_TOP_NDX }, /* NX_CLIPORDER_BLRT */ { NX_BOTTOM_NDX, NX_LEFT_NDX, NX_RIGHT_NDX, NX_TOP_NDX }, /* NX_CLIPORDER_BLRT */
{ NX_BOTTOM_NDX, NX_RIGHT_NDX, NX_LEFT_NDX, NX_TOP_NDX } /* NX_CLIPORDER_BRLT */ { NX_BOTTOM_NDX, NX_RIGHT_NDX, NX_LEFT_NDX, NX_TOP_NDX }, /* NX_CLIPORDER_BRLT */
}; };
/**************************************************************************** /****************************************************************************
@@ -108,7 +108,8 @@ static inline void nxbe_pushrectangle(FAR struct nxbe_clipstack_s *stack,
{ {
/* No then we will need to reallocate the stack to hold more */ /* No then we will need to reallocate the stack to hold more */
int mxrects = stack->mxrects ? 2 * stack->mxrects : NX_INITIAL_STACKSIZE; int mxrects = stack->mxrects ? 2 *
stack->mxrects : NX_INITIAL_STACKSIZE;
struct nxbe_cliprect_s *newstack; struct nxbe_cliprect_s *newstack;
newstack = kmm_realloc(stack->stack, newstack = kmm_realloc(stack->stack,
@@ -163,8 +164,8 @@ static inline bool nxbe_poprectangle(struct nxbe_clipstack_s *stack,
* Input Parameters: * Input Parameters:
* wnd - The window to be clipped. * wnd - The window to be clipped.
* rect - The region of concern within the window * rect - The region of concern within the window
* order - Specifies the order to process the parts of the non-intersecting * order - Specifies the order to process the parts of the
* sub-rectangles. * non-intersecting sub-rectangles.
* cops - The callbacks to handle obscured and visible parts of the * cops - The callbacks to handle obscured and visible parts of the
* sub-rectangles. * sub-rectangles.
* plane - The raster operations to be used by the callback functions. * plane - The raster operations to be used by the callback functions.
@@ -199,8 +200,8 @@ void nxbe_clipper(FAR struct nxbe_window_s *wnd,
nxgl_rectcopy(&rect, dest); /* Start with the whole dest rectangle */ nxgl_rectcopy(&rect, dest); /* Start with the whole dest rectangle */
do do
{ {
/* Loop for every window from the current window and above. Only windows /* Loop for every window from the current window and above.
* above the current window can obscure the current window * Only windows above the current window can obscure the current window
*/ */
for (currw = wnd; currw; currw = currw->above) for (currw = wnd; currw; currw = currw->above)
@@ -211,9 +212,9 @@ void nxbe_clipper(FAR struct nxbe_window_s *wnd,
if (nxgl_rectoverlap(&rect, &currbounds)) if (nxgl_rectoverlap(&rect, &currbounds))
{ {
/* Yes.. then it obscures all or part of the dest rectangle. /* Yes.. then it obscures all or part of the dest rectangle.
* Divide the potentially visible, non-overlapping regions into 4 * Divide the potentially visible, non-overlapping regions into
* smaller rectangles and push them onto the stack for processing * 4 smaller rectangles and push them onto the stack for
* on the next time through the outer loop. * processing on the next time through the outer loop.
*/ */
nxgl_nonintersecting(nonoverlapped, &rect, &currbounds); nxgl_nonintersecting(nonoverlapped, &rect, &currbounds);
@@ -223,7 +224,8 @@ void nxbe_clipper(FAR struct nxbe_window_s *wnd,
* argument of that name. * argument of that name.
*/ */
struct nxgl_rect_s *candidate = &nonoverlapped[g_nxcliporder[order][i]]; struct nxgl_rect_s *candidate =
&nonoverlapped[g_nxcliporder[order][i]];
if (!nxgl_nullrect(candidate)) if (!nxgl_nullrect(candidate))
{ {
nxbe_pushrectangle(&stack, currw->above, candidate); nxbe_pushrectangle(&stack, currw->above, candidate);
+3 -3
View File
@@ -105,15 +105,15 @@ int nxbe_colormap(FAR NX_DRIVERTYPE *dev)
ndx = 0; ndx = 0;
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
{ {
rval = (i * (CONFIG_NX_NCOLORS-1) / 5) << 8; rval = (i * (CONFIG_NX_NCOLORS - 1) / 5) << 8;
for (j = 0; j < 6; j++) for (j = 0; j < 6; j++)
{ {
gval = (j * (CONFIG_NX_NCOLORS-1) / 5) << 8; gval = (j * (CONFIG_NX_NCOLORS - 1) / 5) << 8;
for (k = 0; k < 6; k++) for (k = 0; k < 6; k++)
{ {
red[ndx] = rval; red[ndx] = rval;
green[ndx] = gval; green[ndx] = gval;
blue[ndx] = k * (CONFIG_NX_NCOLORS-1) / 5; blue[ndx] = k * (CONFIG_NX_NCOLORS - 1) / 5;
ndx++; ndx++;
} }
} }
+9 -3
View File
@@ -134,7 +134,9 @@ void nxbe_cursor_enable(FAR struct nxbe_state_s *be, bool enable)
#ifdef CONFIG_NX_SWCURSOR #ifdef CONFIG_NX_SWCURSOR
DEBUGASSERT(be->cursor.bkgd != NULL); DEBUGASSERT(be->cursor.bkgd != NULL);
/* Handle the case where some or all of the cursor is off the display. */ /* Handle the case where some or all of the cursor is
* off the display.
*/
nxgl_rectintersect(&bounds, &be->cursor.bounds, &be->bkgd.bounds); nxgl_rectintersect(&bounds, &be->cursor.bounds, &be->bkgd.bounds);
if (!nxgl_nullrect(&bounds)) if (!nxgl_nullrect(&bounds))
@@ -196,7 +198,9 @@ void nxbe_cursor_setimage(FAR struct nxbe_state_s *be,
if (be->cursor.visible) if (be->cursor.visible)
{ {
/* Handle the case where some or all of the cursor is off the display. */ /* Handle the case where some or all of the cursor is
* off the display.
*/
nxgl_rectintersect(&bounds, &be->cursor.bounds, &be->bkgd.bounds); nxgl_rectintersect(&bounds, &be->cursor.bounds, &be->bkgd.bounds);
if (!nxgl_nullrect(&bounds)) if (!nxgl_nullrect(&bounds))
@@ -344,7 +348,9 @@ void nxbe_cursor_setposition(FAR struct nxbe_state_s *be,
{ {
struct nxgl_rect_s bounds; struct nxgl_rect_s bounds;
/* Handle the case where some or all of the cursor is off the display. */ /* Handle the case where some or all of the cursor is
* off the display.
*/
nxgl_rectintersect(&bounds, &be->cursor.bounds, &be->bkgd.bounds); nxgl_rectintersect(&bounds, &be->cursor.bounds, &be->bkgd.bounds);
if (!nxgl_nullrect(&bounds)) if (!nxgl_nullrect(&bounds))
+4 -3
View File
@@ -67,9 +67,10 @@
* *
****************************************************************************/ ****************************************************************************/
static inline void _nxbe_cursor_backupdraw_dev(FAR struct nxbe_state_s *be, static inline void _nxbe_cursor_backupdraw_dev(
FAR const struct nxgl_rect_s *rect, FAR struct nxbe_state_s *be,
int plane) FAR const struct nxgl_rect_s *rect,
int plane)
{ {
/* Save the modified cursor background region. */ /* Save the modified cursor background region. */
+5 -2
View File
@@ -164,8 +164,10 @@ static inline void nxbe_getrectangle_pwfb(FAR struct nxbe_window_s *wnd,
****************************************************************************/ ****************************************************************************/
void nxbe_getrectangle(FAR struct nxbe_window_s *wnd, void nxbe_getrectangle(FAR struct nxbe_window_s *wnd,
FAR const struct nxgl_rect_s *rect, unsigned int plane, FAR const struct nxgl_rect_s *rect,
FAR uint8_t *dest, unsigned int deststride) unsigned int plane,
FAR uint8_t *dest,
unsigned int deststride)
{ {
struct nxgl_rect_s remaining; struct nxgl_rect_s remaining;
@@ -217,6 +219,7 @@ void nxbe_getrectangle(FAR struct nxbe_window_s *wnd,
wnd->be->plane[0].cursor.erase(wnd->be, &remaining, 0); wnd->be->plane[0].cursor.erase(wnd->be, &remaining, 0);
} }
#endif #endif
/* Get the rectangle from the graphics device memory. /* Get the rectangle from the graphics device memory.
* NOTE: Since raw graphic memory is returned, the returned memory * NOTE: Since raw graphic memory is returned, the returned memory
+2 -1
View File
@@ -70,7 +70,8 @@ static void nxbe_clipvisible(FAR struct nxbe_clipops_s *cops,
FAR struct nxbe_plane_s *plane, FAR struct nxbe_plane_s *plane,
FAR const struct nxgl_rect_s *rect) FAR const struct nxgl_rect_s *rect)
{ {
FAR struct nxbe_setvisibility_s *info = (FAR struct nxbe_setvisibility_s *)cops; FAR struct nxbe_setvisibility_s *info =
(FAR struct nxbe_setvisibility_s *)cops;
info->visible = true; info->visible = true;
} }
+2 -1
View File
@@ -59,7 +59,8 @@
* *
****************************************************************************/ ****************************************************************************/
void nxbe_redrawbelow(FAR struct nxbe_state_s *be, FAR struct nxbe_window_s *wnd, void nxbe_redrawbelow(FAR struct nxbe_state_s *be,
FAR struct nxbe_window_s *wnd,
FAR const struct nxgl_rect_s *rect) FAR const struct nxgl_rect_s *rect)
{ {
FAR struct nxbe_window_s *currwnd; FAR struct nxbe_window_s *currwnd;
+4 -1
View File
@@ -69,7 +69,10 @@ void nxbe_setposition(FAR struct nxbe_window_s *wnd,
/* Back out the old window origin position from the bounding box */ /* Back out the old window origin position from the bounding box */
nxgl_rectoffset(&rect, &wnd->bounds, -wnd->bounds.pt1.x, -wnd->bounds.pt1.y); nxgl_rectoffset(&rect,
&wnd->bounds,
-wnd->bounds.pt1.x,
-wnd->bounds.pt1.y);
/* Add the new window origin into the bounding box */ /* Add the new window origin into the bounding box */
+2 -2
View File
@@ -232,8 +232,8 @@ static void nxbe_realloc(FAR struct nxbe_window_s *wnd,
nxmu_redrawreq(wnd, &bounds); nxmu_redrawreq(wnd, &bounds);
} }
/* If the window became taller, then send a message requesting an update /* If the window became taller, then send a message requesting an
* of the new territory at the bottom. * update of the new territory at the bottom.
*/ */
if (oldheight < newheight) if (oldheight < newheight)
+1 -1
View File
@@ -87,7 +87,7 @@ void nxbe_show_window(FAR struct nxbe_window_s *wnd)
be->topwnd->below = wnd; be->topwnd->below = wnd;
/* Redraw this window and the other that are below us */ /* Redraw this window and the other that are below us */
nxbe_redrawbelow(be, wnd, &wnd->bounds); nxbe_redrawbelow(be, wnd, &wnd->bounds);
} }
@@ -72,7 +72,10 @@
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(nxglib_cursor_backup, NXGLIB_SUFFIX) void NXGL_FUNCNAME(nxglib_cursor_backup, NXGLIB_SUFFIX)
(FAR struct nxbe_state_s *be, FAR const struct nxgl_rect_s *bounds, int planeno) (
FAR struct nxbe_state_s *be,
FAR const struct nxgl_rect_s *bounds,
int planeno)
{ {
struct nxgl_rect_s intersection; struct nxgl_rect_s intersection;
struct nxgl_point_s origin; struct nxgl_point_s origin;
@@ -94,7 +97,9 @@ void NXGL_FUNCNAME(nxglib_cursor_backup, NXGLIB_SUFFIX)
nxgl_rectintersect(&intersection, &be->cursor.bounds, &be->bkgd.bounds); nxgl_rectintersect(&intersection, &be->cursor.bounds, &be->bkgd.bounds);
/* Check if there is anything in the modified region that we need to handle. */ /* Check if there is anything in the modified region that
* we need to handle.
*/
nxgl_rectintersect(&intersection, &intersection, bounds); nxgl_rectintersect(&intersection, &intersection, bounds);
if (!nxgl_nullrect(&intersection)) if (!nxgl_nullrect(&intersection))
@@ -146,7 +151,7 @@ void NXGL_FUNCNAME(nxglib_cursor_backup, NXGLIB_SUFFIX)
sline += sstride; sline += sstride;
dline += dstride; dline += dstride;
} }
} }
} }
#endif /* CONFIG_NX_SWCURSOR */ #endif /* CONFIG_NX_SWCURSOR */
+8 -3
View File
@@ -114,7 +114,10 @@ static NXGL_PIXEL_T nxbe_map_color(FAR struct nxbe_state_s *be, int plane,
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(nxglib_cursor_draw, NXGLIB_SUFFIX) void NXGL_FUNCNAME(nxglib_cursor_draw, NXGLIB_SUFFIX)
(FAR struct nxbe_state_s *be, FAR const struct nxgl_rect_s *bounds, int planeno) (
FAR struct nxbe_state_s *be,
FAR const struct nxgl_rect_s *bounds,
int planeno)
{ {
struct nxgl_rect_s intersection; struct nxgl_rect_s intersection;
struct nxgl_point_s origin; struct nxgl_point_s origin;
@@ -138,7 +141,9 @@ void NXGL_FUNCNAME(nxglib_cursor_draw, NXGLIB_SUFFIX)
nxgl_rectintersect(&intersection, &be->cursor.bounds, &be->bkgd.bounds); nxgl_rectintersect(&intersection, &be->cursor.bounds, &be->bkgd.bounds);
/* Check if there is anything in the modified region that we need to handle. */ /* Check if there is anything in the modified region that we
* need to handle.
*/
nxgl_rectintersect(&intersection, &intersection, bounds); nxgl_rectintersect(&intersection, &intersection, bounds);
if (!nxgl_nullrect(&intersection)) if (!nxgl_nullrect(&intersection))
@@ -228,7 +233,7 @@ void NXGL_FUNCNAME(nxglib_cursor_draw, NXGLIB_SUFFIX)
sline += sstride; sline += sstride;
dline += dstride; dline += dstride;
} }
} }
} }
+8 -3
View File
@@ -71,7 +71,10 @@
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(nxglib_cursor_erase, NXGLIB_SUFFIX) void NXGL_FUNCNAME(nxglib_cursor_erase, NXGLIB_SUFFIX)
(FAR struct nxbe_state_s *be, FAR const struct nxgl_rect_s *bounds, int planeno) (
FAR struct nxbe_state_s *be,
FAR const struct nxgl_rect_s *bounds,
int planeno)
{ {
struct nxgl_rect_s intersection; struct nxgl_rect_s intersection;
struct nxgl_point_s origin; struct nxgl_point_s origin;
@@ -93,7 +96,9 @@ void NXGL_FUNCNAME(nxglib_cursor_erase, NXGLIB_SUFFIX)
nxgl_rectintersect(&intersection, &be->cursor.bounds, &be->bkgd.bounds); nxgl_rectintersect(&intersection, &be->cursor.bounds, &be->bkgd.bounds);
/* Check if there is anything in the modified region that we need to handle. */ /* Check if there is anything in the modified region that
* we need to handle.
*/
nxgl_rectintersect(&intersection, &intersection, bounds); nxgl_rectintersect(&intersection, &intersection, bounds);
if (!nxgl_nullrect(&intersection)) if (!nxgl_nullrect(&intersection))
@@ -145,7 +150,7 @@ void NXGL_FUNCNAME(nxglib_cursor_erase, NXGLIB_SUFFIX)
sline += sstride; sline += sstride;
dline += dstride; dline += dstride;
} }
} }
} }
+16 -12
View File
@@ -60,9 +60,12 @@
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(nxgl_copyrectangle, NXGLIB_SUFFIX) void NXGL_FUNCNAME(nxgl_copyrectangle, NXGLIB_SUFFIX)
(FAR struct fb_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *dest, (
FAR const void *src, FAR const struct nxgl_point_s *origin, FAR struct fb_planeinfo_s *pinfo,
unsigned int srcstride) FAR const struct nxgl_rect_s *dest,
FAR const void *src,
FAR const struct nxgl_point_s *origin,
unsigned int srcstride)
{ {
FAR const uint8_t *sline; FAR const uint8_t *sline;
FAR uint8_t *dline; FAR uint8_t *dline;
@@ -99,14 +102,14 @@ void NXGL_FUNCNAME(nxgl_copyrectangle, NXGLIB_SUFFIX)
*/ */
leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(dest->pt1.x))); leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(dest->pt1.x)));
tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(dest->pt2.x-1))); tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(dest->pt2.x - 1)));
# else # else
/* Get the mask for pixels that are ordered so that they pack from the /* Get the mask for pixels that are ordered so that they pack from the
* LS byte up. * LS byte up.
*/ */
leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(dest->pt1.x))); leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(dest->pt1.x)));
tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(dest->pt1.x-1))); tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(dest->pt1.x - 1)));
# endif # endif
#endif #endif
@@ -121,14 +124,14 @@ void NXGL_FUNCNAME(nxgl_copyrectangle, NXGLIB_SUFFIX)
while (rows--) while (rows--)
{ {
#if NXGLIB_BITSPERPIXEL < 8 #if NXGLIB_BITSPERPIXEL < 8
/* Handle masking of the fractional initial byte */ /* Handle masking of the fractional initial byte */
mask = leadmask; mask = leadmask;
sptr = sline; sptr = sline;
dptr = dline; dptr = dline;
lnlen = width; lnlen = width;
if (lnlen > 1 && mask) if (lnlen > 1 && mask)
{ {
dptr[0] = (dptr[0] & ~mask) | (sptr[0] & mask); dptr[0] = (dptr[0] & ~mask) | (sptr[0] & mask);
mask = 0xff; mask = 0xff;
@@ -142,7 +145,8 @@ void NXGL_FUNCNAME(nxgl_copyrectangle, NXGLIB_SUFFIX)
mask &= tailmask; mask &= tailmask;
if (lnlen > 0 && mask) if (lnlen > 0 && mask)
{ {
dptr[lnlen-1] = (dptr[lnlen-1] & ~mask) | (sptr[lnlen-1] & mask); dptr[lnlen - 1] = (dptr[lnlen - 1] & ~mask) |
(sptr[lnlen - 1] & mask);
lnlen--; /* REVISIT: Is this correct? */ lnlen--; /* REVISIT: Is this correct? */
} }
+13 -12
View File
@@ -67,9 +67,10 @@
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(nxgl_fillrectangle, NXGLIB_SUFFIX) void NXGL_FUNCNAME(nxgl_fillrectangle, NXGLIB_SUFFIX)
(FAR struct fb_planeinfo_s *pinfo, (
FAR const struct nxgl_rect_s *rect, FAR struct fb_planeinfo_s *pinfo,
NXGL_PIXEL_T color) FAR const struct nxgl_rect_s *rect,
NXGL_PIXEL_T color)
{ {
FAR uint8_t *line; FAR uint8_t *line;
unsigned int width; unsigned int width;
@@ -106,14 +107,14 @@ void NXGL_FUNCNAME(nxgl_fillrectangle, NXGLIB_SUFFIX)
*/ */
leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x))); leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x)));
tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt2.x-1))); tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt2.x - 1)));
# else # else
/* Get the mask for pixels that are ordered so that they pack from the /* Get the mask for pixels that are ordered so that they pack from the
* LS byte up. * LS byte up.
*/ */
leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt1.x))); leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt1.x)));
tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x-1))); tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x - 1)));
# endif # endif
#endif #endif
@@ -122,13 +123,13 @@ void NXGL_FUNCNAME(nxgl_fillrectangle, NXGLIB_SUFFIX)
while (rows-- > 0) while (rows-- > 0)
{ {
#if NXGLIB_BITSPERPIXEL < 8 #if NXGLIB_BITSPERPIXEL < 8
/* Handle masking of the fractional initial byte */ /* Handle masking of the fractional initial byte */
mask = leadmask; mask = leadmask;
dest = line; dest = line;
lnlen = width; lnlen = width;
if (lnlen > 1 && mask) if (lnlen > 1 && mask)
{ {
dest[0] = (dest[0] & ~mask) | (mpixel & mask); dest[0] = (dest[0] & ~mask) | (mpixel & mask);
mask = 0xff; mask = 0xff;
@@ -141,8 +142,8 @@ void NXGL_FUNCNAME(nxgl_fillrectangle, NXGLIB_SUFFIX)
mask &= tailmask; mask &= tailmask;
if (lnlen > 0 && mask) if (lnlen > 0 && mask)
{ {
dest[lnlen-1] = (dest[lnlen-1] & ~mask) | (mpixel & mask); dest[lnlen - 1] = (dest[lnlen - 1] & ~mask) | (mpixel & mask);
lnlen--; lnlen--;
} }
/* Handle all of the unmasked bytes in-between */ /* Handle all of the unmasked bytes in-between */
+9 -7
View File
@@ -50,6 +50,7 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Make sure that this file is used in the proper context */ /* Make sure that this file is used in the proper context */
#ifndef NXGLIB_SUFFIX #ifndef NXGLIB_SUFFIX
@@ -70,7 +71,8 @@
* *
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(nxgl_filltrapezoid, NXGLIB_SUFFIX)( void NXGL_FUNCNAME(nxgl_filltrapezoid, NXGLIB_SUFFIX)
(
FAR struct fb_planeinfo_s *pinfo, FAR struct fb_planeinfo_s *pinfo,
FAR const struct nxgl_trapezoid_s *trap, FAR const struct nxgl_trapezoid_s *trap,
FAR const struct nxgl_rect_s *bounds, FAR const struct nxgl_rect_s *bounds,
@@ -202,9 +204,9 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid, NXGLIB_SUFFIX)(
if (x1 <= x2 && ix2 >= bounds->pt1.x && ix1 <= bounds->pt2.x) if (x1 <= x2 && ix2 >= bounds->pt1.x && ix1 <= bounds->pt2.x)
{ {
/* Get a clipped copies of the starting and ending X positions. This /* Get a clipped copies of the starting and ending X positions.
* clipped truncates "down" and gives the quantized pixel holding the * This clipped truncates "down" and gives the quantized pixel
* fractional X position * holding the fractional X position
*/ */
ix1 = ngl_clipl(ix1, bounds->pt1.x); ix1 = ngl_clipl(ix1, bounds->pt1.x);
@@ -242,7 +244,7 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid, NXGLIB_SUFFIX)(
#endif #endif
if (lnlen > 0 && mask) if (lnlen > 0 && mask)
{ {
dest[lnlen-1] = (dest[lnlen-1] & ~mask) | (mpixel & mask); dest[lnlen - 1] = (dest[lnlen - 1] & ~mask) | (mpixel & mask);
lnlen--; lnlen--;
} }
@@ -274,12 +276,12 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid, NXGLIB_SUFFIX)(
if (width > 1) if (width > 1)
{ {
NXGL_MEMSET(dest, (NXGL_PIXEL_T)color, width-1); NXGL_MEMSET(dest, (NXGL_PIXEL_T)color, width - 1);
} }
/* And blend the final pixel */ /* And blend the final pixel */
dest += NXGL_SCALEX(width-1); dest += NXGL_SCALEX(width - 1);
frac = b16frac(x2); frac = b16frac(x2);
NXGL_BLEND(dest, (NXGL_PIXEL_T)color, frac); NXGL_BLEND(dest, (NXGL_PIXEL_T)color, frac);
} }
+29 -25
View File
@@ -55,9 +55,11 @@
****************************************************************************/ ****************************************************************************/
#if NXGLIB_BITSPERPIXEL < 8 #if NXGLIB_BITSPERPIXEL < 8
static inline void nxgl_lowresmemcpy(FAR uint8_t *dline, FAR const uint8_t *sline, static inline void nxgl_lowresmemcpy(FAR uint8_t *dline,
FAR const uint8_t *sline,
unsigned int width, unsigned int width,
uint8_t leadmask, uint8_t tailmask) uint8_t leadmask,
uint8_t tailmask)
{ {
FAR const uint8_t *sptr; FAR const uint8_t *sptr;
FAR uint8_t *dptr; FAR uint8_t *dptr;
@@ -72,29 +74,29 @@ static inline void nxgl_lowresmemcpy(FAR uint8_t *dline, FAR const uint8_t *slin
lnlen = width; lnlen = width;
if (lnlen > 1 && mask) if (lnlen > 1 && mask)
{ {
dptr[0] = (dptr[0] & ~mask) | (sptr[0] & mask); dptr[0] = (dptr[0] & ~mask) | (sptr[0] & mask);
mask = 0xff; mask = 0xff;
dptr++; dptr++;
sptr++; sptr++;
lnlen--; lnlen--;
} }
/* Handle masking of the fractional final byte */ /* Handle masking of the fractional final byte */
mask &= tailmask; mask &= tailmask;
if (lnlen > 0 && mask) if (lnlen > 0 && mask)
{ {
dptr[lnlen-1] = (dptr[lnlen-1] & ~mask) | (sptr[lnlen-1] & mask); dptr[lnlen - 1] = (dptr[lnlen - 1] & ~mask) | (sptr[lnlen - 1] & mask);
lnlen--; lnlen--;
} }
/* Handle all of the unmasked bytes in-between */ /* Handle all of the unmasked bytes in-between */
if (lnlen > 0) if (lnlen > 0)
{ {
NXGL_MEMCPY(dptr, sptr, lnlen); NXGL_MEMCPY(dptr, sptr, lnlen);
} }
} }
#endif #endif
@@ -112,8 +114,10 @@ static inline void nxgl_lowresmemcpy(FAR uint8_t *dline, FAR const uint8_t *slin
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(nxgl_getrectangle, NXGLIB_SUFFIX) void NXGL_FUNCNAME(nxgl_getrectangle, NXGLIB_SUFFIX)
(FAR struct fb_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *rect, (
FAR void *dest, unsigned int deststride) FAR struct fb_planeinfo_s *pinfo,
FAR const struct nxgl_rect_s *rect,
FAR void *dest, unsigned int deststride)
{ {
FAR const uint8_t *sline; FAR const uint8_t *sline;
FAR uint8_t *dline; FAR uint8_t *dline;
@@ -145,14 +149,14 @@ void NXGL_FUNCNAME(nxgl_getrectangle, NXGLIB_SUFFIX)
*/ */
leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x))); leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x)));
tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt2.x-1))); tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt2.x - 1)));
# else # else
/* Get the mask for pixels that are ordered so that they pack from the /* Get the mask for pixels that are ordered so that they pack from the
* LS byte up. * LS byte up.
*/ */
leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt1.x))); leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt1.x)));
tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x-1))); tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x - 1)));
# endif # endif
#endif #endif
+32 -27
View File
@@ -55,9 +55,11 @@
****************************************************************************/ ****************************************************************************/
#if NXGLIB_BITSPERPIXEL < 8 #if NXGLIB_BITSPERPIXEL < 8
static inline void nxgl_lowresmemcpy(FAR uint8_t *dline, FAR const uint8_t *sline, static inline void nxgl_lowresmemcpy(FAR uint8_t *dline,
FAR const uint8_t *sline,
unsigned int width, unsigned int width,
uint8_t leadmask, uint8_t tailmask) uint8_t leadmask,
uint8_t tailmask)
{ {
FAR const uint8_t *sptr; FAR const uint8_t *sptr;
FAR uint8_t *dptr; FAR uint8_t *dptr;
@@ -72,29 +74,29 @@ static inline void nxgl_lowresmemcpy(FAR uint8_t *dline, FAR const uint8_t *slin
lnlen = width; lnlen = width;
if (lnlen > 1 && mask) if (lnlen > 1 && mask)
{ {
dptr[0] = (dptr[0] & ~mask) | (sptr[0] & mask); dptr[0] = (dptr[0] & ~mask) | (sptr[0] & mask);
mask = 0xff; mask = 0xff;
dptr++; dptr++;
sptr++; sptr++;
lnlen--; lnlen--;
} }
/* Handle masking of the fractional final byte */ /* Handle masking of the fractional final byte */
mask &= tailmask; mask &= tailmask;
if (lnlen > 0 && mask) if (lnlen > 0 && mask)
{ {
dptr[lnlen-1] = (dptr[lnlen-1] & ~mask) | (sptr[lnlen-1] & mask); dptr[lnlen - 1] = (dptr[lnlen - 1] & ~mask) | (sptr[lnlen - 1] & mask);
lnlen--; lnlen--;
} }
/* Handle all of the unmasked bytes in-between */ /* Handle all of the unmasked bytes in-between */
if (lnlen > 0) if (lnlen > 0)
{ {
NXGL_MEMCPY(dptr, sptr, lnlen); NXGL_MEMCPY(dptr, sptr, lnlen);
} }
} }
#endif #endif
@@ -113,9 +115,11 @@ static inline void nxgl_lowresmemcpy(FAR uint8_t *dline, FAR const uint8_t *slin
* *
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(nxgl_moverectangle,NXGLIB_SUFFIX) void NXGL_FUNCNAME(nxgl_moverectangle, NXGLIB_SUFFIX)
(FAR struct fb_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *rect, (
FAR struct nxgl_point_s *offset) FAR struct fb_planeinfo_s *pinfo,
FAR const struct nxgl_rect_s *rect,
FAR struct nxgl_point_s *offset)
{ {
FAR const uint8_t *sline; FAR const uint8_t *sline;
FAR uint8_t *dline; FAR uint8_t *dline;
@@ -147,14 +151,14 @@ void NXGL_FUNCNAME(nxgl_moverectangle,NXGLIB_SUFFIX)
*/ */
leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x))); leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x)));
tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt2.x-1))); tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt2.x - 1)));
# else # else
/* Get the mask for pixels that are ordered so that they pack from the /* Get the mask for pixels that are ordered so that they pack from the
* LS byte up. * LS byte up.
*/ */
leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt1.x))); leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt1.x)));
tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x-1))); tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x - 1)));
# endif # endif
#endif #endif
@@ -181,7 +185,8 @@ void NXGL_FUNCNAME(nxgl_moverectangle,NXGLIB_SUFFIX)
(offset->y < rect->pt1.y && offset->x <= rect->pt1.x)) (offset->y < rect->pt1.y && offset->x <= rect->pt1.x))
{ {
/* Yes.. Copy the rectangle from top down (i.e., adding the stride /* Yes.. Copy the rectangle from top down (i.e., adding the stride
* to move to the next, lower row) */ * to move to the next, lower row)
*/
while (rows--) while (rows--)
{ {
+5 -4
View File
@@ -69,9 +69,10 @@
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(nxgl_setpixel, NXGLIB_SUFFIX) void NXGL_FUNCNAME(nxgl_setpixel, NXGLIB_SUFFIX)
(FAR struct fb_planeinfo_s *pinfo, (
FAR const struct nxgl_point_s *pos, FAR struct fb_planeinfo_s *pinfo,
NXGL_PIXEL_T color) FAR const struct nxgl_point_s *pos,
NXGL_PIXEL_T color)
{ {
FAR uint8_t *dest; FAR uint8_t *dest;
@@ -134,7 +135,7 @@ void NXGL_FUNCNAME(nxgl_setpixel, NXGLIB_SUFFIX)
/* Write the pixel (proper alignment assumed) */ /* Write the pixel (proper alignment assumed) */
pixel = (FAR NXGL_PIXEL_T *)dest; pixel = (FAR NXGL_PIXEL_T *)dest;
*pixel = color; *pixel = color;
#endif #endif
} }
+18 -11
View File
@@ -62,9 +62,12 @@
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(nxgl_copyrectangle, NXGLIB_SUFFIX) void NXGL_FUNCNAME(nxgl_copyrectangle, NXGLIB_SUFFIX)
(FAR struct lcd_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *dest, (
FAR const void *src, FAR const struct nxgl_point_s *origin, FAR struct lcd_planeinfo_s *pinfo,
unsigned int srcstride) FAR const struct nxgl_rect_s *dest,
FAR const void *src,
FAR const struct nxgl_point_s *origin,
unsigned int srcstride)
{ {
FAR const uint8_t *sline; FAR const uint8_t *sline;
unsigned int ncols; unsigned int ncols;
@@ -83,7 +86,8 @@ void NXGL_FUNCNAME(nxgl_copyrectangle, NXGLIB_SUFFIX)
/* Set up to copy the image */ /* Set up to copy the image */
xoffset = dest->pt1.x - origin->x; xoffset = dest->pt1.x - origin->x;
sline = (FAR const uint8_t *)src + NXGL_SCALEX(xoffset) + (dest->pt1.y - origin->y) * srcstride; sline = (FAR const uint8_t *)src + NXGL_SCALEX(xoffset) +
(dest->pt1.y - origin->y) * srcstride;
#if NXGLIB_BITSPERPIXEL < 8 #if NXGLIB_BITSPERPIXEL < 8
remainder = NXGL_REMAINDERX(xoffset); remainder = NXGL_REMAINDERX(xoffset);
#endif #endif
@@ -93,27 +97,30 @@ void NXGL_FUNCNAME(nxgl_copyrectangle, NXGLIB_SUFFIX)
for (row = dest->pt1.y; row <= dest->pt2.y; row++) for (row = dest->pt1.y; row <= dest->pt2.y; row++)
{ {
#if NXGLIB_BITSPERPIXEL < 8 #if NXGLIB_BITSPERPIXEL < 8
/* if the source pixel is not aligned with a byte boundary, then we will /* if the source pixel is not aligned with a byte boundary, then we
* need to copy the image data to the run buffer first. * will need to copy the image data to the run buffer first.
*/ */
if (remainder != 0) if (remainder != 0)
{ {
NXGL_FUNCNAME(nxgl_copyrun, NXGLIB_SUFFIX)(sline, pinfo->buffer, remainder, ncols); NXGL_FUNCNAME(nxgl_copyrun, NXGLIB_SUFFIX)(sline,
pinfo->buffer,
remainder,
ncols);
pinfo->putrun(row, dest->pt1.x, pinfo->buffer, ncols); pinfo->putrun(row, dest->pt1.x, pinfo->buffer, ncols);
} }
else else
#endif #endif
{ {
/* The pixel data is byte aligned. Copy the image data directly from /* The pixel data is byte aligned.
* the image memory. * Copy the image data directly from the image memory.
*/ */
pinfo->putrun(row, dest->pt1.x, sline, ncols); pinfo->putrun(row, dest->pt1.x, sline, ncols);
} }
/* Then adjust the source pointer to refer to the next line in the source /* Then adjust the source pointer to refer to the next line in
* image. * the source image.
*/ */
sline += srcstride; sline += srcstride;
+7 -4
View File
@@ -69,9 +69,10 @@
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(nxgl_fillrectangle, NXGLIB_SUFFIX) void NXGL_FUNCNAME(nxgl_fillrectangle, NXGLIB_SUFFIX)
(FAR struct lcd_planeinfo_s *pinfo, (
FAR const struct nxgl_rect_s *rect, FAR struct lcd_planeinfo_s *pinfo,
NXGL_PIXEL_T color) FAR const struct nxgl_rect_s *rect,
NXGL_PIXEL_T color)
{ {
unsigned int ncols; unsigned int ncols;
unsigned int row; unsigned int row;
@@ -82,7 +83,9 @@ void NXGL_FUNCNAME(nxgl_fillrectangle, NXGLIB_SUFFIX)
/* Fill the run buffer with the selected color */ /* Fill the run buffer with the selected color */
NXGL_FUNCNAME(nxgl_fillrun, NXGLIB_SUFFIX)((NXGLIB_RUNTYPE *)pinfo->buffer, color, ncols); NXGL_FUNCNAME(nxgl_fillrun, NXGLIB_SUFFIX)((NXGLIB_RUNTYPE *)pinfo->buffer,
color,
ncols);
/* Then fill the rectangle line-by-line */ /* Then fill the rectangle line-by-line */
+8 -5
View File
@@ -71,10 +71,11 @@
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(nxgl_filltrapezoid, NXGLIB_SUFFIX) void NXGL_FUNCNAME(nxgl_filltrapezoid, NXGLIB_SUFFIX)
(FAR struct lcd_planeinfo_s *pinfo, (
FAR const struct nxgl_trapezoid_s *trap, FAR struct lcd_planeinfo_s *pinfo,
FAR const struct nxgl_rect_s *bounds, FAR const struct nxgl_trapezoid_s *trap,
NXGL_PIXEL_T color) FAR const struct nxgl_rect_s *bounds,
NXGL_PIXEL_T color)
{ {
unsigned int ncols; unsigned int ncols;
unsigned int topy; unsigned int topy;
@@ -199,7 +200,9 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid, NXGLIB_SUFFIX)
ncols = botw; ncols = botw;
} }
NXGL_FUNCNAME(nxgl_fillrun, NXGLIB_SUFFIX)((NXGLIB_RUNTYPE *)pinfo->buffer, color, ncols); NXGL_FUNCNAME(nxgl_fillrun, NXGLIB_SUFFIX)((NXGLIB_RUNTYPE *)pinfo->buffer,
color,
ncols);
/* Then fill the trapezoid row-by-row */ /* Then fill the trapezoid row-by-row */
+4 -2
View File
@@ -60,8 +60,10 @@
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(nxgl_getrectangle, NXGLIB_SUFFIX) void NXGL_FUNCNAME(nxgl_getrectangle, NXGLIB_SUFFIX)
(FAR struct lcd_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *rect, (
FAR void *dest, unsigned int deststride) FAR struct lcd_planeinfo_s *pinfo,
FAR const struct nxgl_rect_s *rect,
FAR void *dest, unsigned int deststride)
{ {
FAR uint8_t *dline; FAR uint8_t *dline;
unsigned int ncols; unsigned int ncols;
+4 -2
View File
@@ -62,8 +62,10 @@
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(nxgl_moverectangle, NXGLIB_SUFFIX) void NXGL_FUNCNAME(nxgl_moverectangle, NXGLIB_SUFFIX)
(FAR struct lcd_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *rect, (
FAR struct nxgl_point_s *offset) FAR struct lcd_planeinfo_s *pinfo,
FAR const struct nxgl_rect_s *rect,
FAR struct nxgl_point_s *offset)
{ {
unsigned int ncols; unsigned int ncols;
unsigned int srcrow; unsigned int srcrow;
+9 -5
View File
@@ -70,9 +70,10 @@
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(nxgl_setpixel, NXGLIB_SUFFIX) void NXGL_FUNCNAME(nxgl_setpixel, NXGLIB_SUFFIX)
(FAR struct lcd_planeinfo_s *pinfo, (
FAR const struct nxgl_point_s *pos, FAR struct lcd_planeinfo_s *pinfo,
NXGL_PIXEL_T color) FAR const struct nxgl_point_s *pos,
NXGL_PIXEL_T color)
{ {
#if NXGLIB_BITSPERPIXEL < 8 #if NXGLIB_BITSPERPIXEL < 8
uint8_t shift; uint8_t shift;
@@ -124,11 +125,14 @@ void NXGL_FUNCNAME(nxgl_setpixel, NXGLIB_SUFFIX)
/* Handle masking of the fractional byte */ /* Handle masking of the fractional byte */
pixel = (pixel & ~mask) | (color & mask); pixel = (pixel & ~mask) | (color & mask);
/* Write the modified byte back to graphics memory */ /* Write the modified byte back to graphics memory */
pinfo->putrun(pos->y, pos->x, (FAR uint8_t *)&pixel, 8 / NXGLIB_BITSPERPIXEL); pinfo->putrun(pos->y,
pos->x,
(FAR uint8_t *)&pixel,
8 / NXGLIB_BITSPERPIXEL);
#else #else
/* Draw a single pixel at this position raster line at this row */ /* Draw a single pixel at this position raster line at this row */
+3 -3
View File
@@ -457,7 +457,7 @@ void pwfb_copyrectangle_32bpp(FAR struct nxbe_window_s *bwnd,
* Name: nxgl_cursor_draw_*bpp * Name: nxgl_cursor_draw_*bpp
* *
* Description: * Description:
* Draw the cursor image into the specified position in the graphics memory. * Draw the cursor image into the specified position in the graphics memory.
* *
****************************************************************************/ ****************************************************************************/
@@ -506,8 +506,8 @@ void nxglib_cursor_erase_32bpp(FAR struct nxbe_state_s *be,
* Name: nxgl_cursor_backup_*bpp * Name: nxgl_cursor_backup_*bpp
* *
* Description: * Description:
* Save the background image for subsequent use to erase the cursor from the * Save the background image for subsequent use to erase the cursor from the
* device graphics memory. * device graphics memory.
* *
****************************************************************************/ ****************************************************************************/
+1 -2
View File
@@ -64,7 +64,6 @@
# undef CONFIG_NX_ANTIALIASING # undef CONFIG_NX_ANTIALIASING
#endif #endif
/* Set up bit blit macros for this BPP */ /* Set up bit blit macros for this BPP */
#if NXGLIB_BITSPERPIXEL == 1 #if NXGLIB_BITSPERPIXEL == 1
@@ -239,7 +238,7 @@ extern "C"
#endif #endif
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions Definitions
****************************************************************************/ ****************************************************************************/
#undef EXTERN #undef EXTERN
+4 -4
View File
@@ -45,7 +45,7 @@
#include <string.h> #include <string.h>
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions Definitions
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
@@ -215,9 +215,9 @@ nxgl_copyrun_2bpp(FAR const uint8_t *src, FAR uint8_t *dest,
outdata |= (indata >> (8 - shift)); outdata |= (indata >> (8 - shift));
nextdata = (indata << shift); nextdata = (indata << shift);
#else #else
/* If CONFIG_NX_PACKEDMSFIRST is NOT defined, then bits 0-(2*remainder-1) /* If CONFIG_NX_PACKEDMSFIRST is NOT defined, then bits
* are carried over from that last pass through the loop. For example * 0-(2*remainder-1) are carried over from that last pass through the
* if remainder == 1: * loop. For example if remainder == 1:
* *
* nextdata = xxAA AAAA - dest = BBAA AAAA * nextdata = xxAA AAAA - dest = BBAA AAAA
* src = CCCC CCBB - nextdata = xxCC CCCC * src = CCCC CCBB - nextdata = xxCC CCCC
+23 -10
View File
@@ -57,11 +57,11 @@
#endif #endif
/**************************************************************************** /****************************************************************************
* Private Types * Public Types
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Private Data * Public Data
****************************************************************************/ ****************************************************************************/
#if NXGLIB_BITSPERPIXEL == 2 #if NXGLIB_BITSPERPIXEL == 2
@@ -72,7 +72,7 @@ static uint8_t g_wide_2bpp[4] =
#endif #endif
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions Definitions
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
@@ -145,16 +145,21 @@ static inline void nxgl_fillrun_4bpp(FAR uint8_t *run, nxgl_mxpixel_t color,
static inline void nxgl_fillrun_8bpp(FAR uint8_t *run, nxgl_mxpixel_t color, static inline void nxgl_fillrun_8bpp(FAR uint8_t *run, nxgl_mxpixel_t color,
size_t npixels) size_t npixels)
{ {
/* Fill the run with the color (it is okay to run a fractional byte overy the end */ /* Fill the run with the color (it is okay to run a fractional byte overy
* the end
*/
memset(run, color, npixels); memset(run, color, npixels);
} }
#elif NXGLIB_BITSPERPIXEL == 16 #elif NXGLIB_BITSPERPIXEL == 16
static inline void nxgl_fillrun_16bpp(FAR uint16_t *run, nxgl_mxpixel_t color, static inline void nxgl_fillrun_16bpp(FAR uint16_t *run,
nxgl_mxpixel_t color,
size_t npixels) size_t npixels)
{ {
/* Fill the run with the color (it is okay to run a fractional byte overy the end */ /* Fill the run with the color (it is okay to run a fractional byte overy
* the end
*/
while (npixels-- > 0) while (npixels-- > 0)
{ {
@@ -163,9 +168,13 @@ static inline void nxgl_fillrun_16bpp(FAR uint16_t *run, nxgl_mxpixel_t color,
} }
#elif NXGLIB_BITSPERPIXEL == 24 #elif NXGLIB_BITSPERPIXEL == 24
static inline void nxgl_fillrun_24bpp(FAR uint32_t *run, nxgl_mxpixel_t color, size_t npixels) static inline void nxgl_fillrun_24bpp(FAR uint32_t *run,
nxgl_mxpixel_t color,
size_t npixels)
{ {
/* Fill the run with the color (it is okay to run a fractional byte overy the end */ /* Fill the run with the color (it is okay to run a fractional byte overy
* the end
*/
while (npixels-- > 0) while (npixels-- > 0)
{ {
@@ -174,9 +183,13 @@ static inline void nxgl_fillrun_24bpp(FAR uint32_t *run, nxgl_mxpixel_t color, s
} }
#elif NXGLIB_BITSPERPIXEL == 32 #elif NXGLIB_BITSPERPIXEL == 32
static inline void nxgl_fillrun_32bpp(FAR uint32_t *run, nxgl_mxpixel_t color, size_t npixels) static inline void nxgl_fillrun_32bpp(FAR uint32_t *run,
nxgl_mxpixel_t color,
size_t npixels)
{ {
/* Fill the run with the color (it is okay to run a fractional byte overy the end */ /* Fill the run with the color (it is okay to run a fractional byte overy
* the end
*/
while (npixels-- > 0) while (npixels-- > 0)
{ {
+16 -12
View File
@@ -60,9 +60,12 @@
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(pwfb_copyrectangle, NXGLIB_SUFFIX) void NXGL_FUNCNAME(pwfb_copyrectangle, NXGLIB_SUFFIX)
(FAR struct nxbe_window_s *bwnd, FAR const struct nxgl_rect_s *dest, (
FAR const void *src, FAR const struct nxgl_point_s *origin, FAR struct nxbe_window_s *bwnd,
unsigned int srcstride) FAR const struct nxgl_rect_s *dest,
FAR const void *src,
FAR const struct nxgl_point_s *origin,
unsigned int srcstride)
{ {
FAR const uint8_t *sline; FAR const uint8_t *sline;
FAR uint8_t *dline; FAR uint8_t *dline;
@@ -99,14 +102,14 @@ void NXGL_FUNCNAME(pwfb_copyrectangle, NXGLIB_SUFFIX)
*/ */
leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(dest->pt1.x))); leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(dest->pt1.x)));
tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(dest->pt2.x-1))); tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(dest->pt2.x - 1)));
# else # else
/* Get the mask for pixels that are ordered so that they pack from the /* Get the mask for pixels that are ordered so that they pack from the
* LS byte up. * LS byte up.
*/ */
leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(dest->pt1.x))); leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(dest->pt1.x)));
tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(dest->pt1.x-1))); tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(dest->pt1.x - 1)));
# endif # endif
#endif #endif
@@ -121,14 +124,14 @@ void NXGL_FUNCNAME(pwfb_copyrectangle, NXGLIB_SUFFIX)
while (rows--) while (rows--)
{ {
#if NXGLIB_BITSPERPIXEL < 8 #if NXGLIB_BITSPERPIXEL < 8
/* Handle masking of the fractional initial byte */ /* Handle masking of the fractional initial byte */
mask = leadmask; mask = leadmask;
sptr = sline; sptr = sline;
dptr = dline; dptr = dline;
lnlen = width; lnlen = width;
if (lnlen > 1 && mask) if (lnlen > 1 && mask)
{ {
dptr[0] = (dptr[0] & ~mask) | (sptr[0] & mask); dptr[0] = (dptr[0] & ~mask) | (sptr[0] & mask);
mask = 0xff; mask = 0xff;
@@ -142,7 +145,8 @@ void NXGL_FUNCNAME(pwfb_copyrectangle, NXGLIB_SUFFIX)
mask &= tailmask; mask &= tailmask;
if (lnlen > 0 && mask) if (lnlen > 0 && mask)
{ {
dptr[lnlen-1] = (dptr[lnlen-1] & ~mask) | (sptr[lnlen-1] & mask); dptr[lnlen - 1] = (dptr[lnlen - 1] & ~mask) |
(sptr[lnlen - 1] & mask);
lnlen--; /* REVISIT: Is this correct? */ lnlen--; /* REVISIT: Is this correct? */
} }
+12 -11
View File
@@ -67,9 +67,10 @@
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(pwfb_fillrectangle, NXGLIB_SUFFIX) void NXGL_FUNCNAME(pwfb_fillrectangle, NXGLIB_SUFFIX)
(FAR struct nxbe_window_s *bwnd, (
FAR const struct nxgl_rect_s *rect, FAR struct nxbe_window_s *bwnd,
NXGL_PIXEL_T color) FAR const struct nxgl_rect_s *rect,
NXGL_PIXEL_T color)
{ {
FAR uint8_t *line; FAR uint8_t *line;
unsigned int width; unsigned int width;
@@ -107,14 +108,14 @@ void NXGL_FUNCNAME(pwfb_fillrectangle, NXGLIB_SUFFIX)
*/ */
leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x))); leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x)));
tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt2.x-1))); tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt2.x - 1)));
# else # else
/* Get the mask for pixels that are ordered so that they pack from the /* Get the mask for pixels that are ordered so that they pack from the
* LS byte up. * LS byte up.
*/ */
leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt1.x))); leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt1.x)));
tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x-1))); tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x - 1)));
# endif # endif
#endif #endif
@@ -123,13 +124,13 @@ void NXGL_FUNCNAME(pwfb_fillrectangle, NXGLIB_SUFFIX)
while (rows-- > 0) while (rows-- > 0)
{ {
#if NXGLIB_BITSPERPIXEL < 8 #if NXGLIB_BITSPERPIXEL < 8
/* Handle masking of the fractional initial byte */ /* Handle masking of the fractional initial byte */
mask = leadmask; mask = leadmask;
dest = line; dest = line;
lnlen = width; lnlen = width;
if (lnlen > 1 && mask) if (lnlen > 1 && mask)
{ {
dest[0] = (dest[0] & ~mask) | (mpixel & mask); dest[0] = (dest[0] & ~mask) | (mpixel & mask);
mask = 0xff; mask = 0xff;
@@ -142,7 +143,7 @@ void NXGL_FUNCNAME(pwfb_fillrectangle, NXGLIB_SUFFIX)
mask &= tailmask; mask &= tailmask;
if (lnlen > 0 && mask) if (lnlen > 0 && mask)
{ {
dest[lnlen-1] = (dest[lnlen-1] & ~mask) | (mpixel & mask); dest[lnlen - 1] = (dest[lnlen - 1] & ~mask) | (mpixel & mask);
lnlen--; lnlen--;
} }
+8 -7
View File
@@ -71,7 +71,8 @@
* *
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(pwfb_filltrapezoid, NXGLIB_SUFFIX)( void NXGL_FUNCNAME(pwfb_filltrapezoid, NXGLIB_SUFFIX)
(
FAR struct nxbe_window_s *bwnd, FAR struct nxbe_window_s *bwnd,
FAR const struct nxgl_trapezoid_s *trap, FAR const struct nxgl_trapezoid_s *trap,
FAR const struct nxgl_rect_s *bounds, FAR const struct nxgl_rect_s *bounds,
@@ -203,9 +204,9 @@ void NXGL_FUNCNAME(pwfb_filltrapezoid, NXGLIB_SUFFIX)(
if (x1 <= x2 && ix2 >= bounds->pt1.x && ix1 <= bounds->pt2.x) if (x1 <= x2 && ix2 >= bounds->pt1.x && ix1 <= bounds->pt2.x)
{ {
/* Get a clipped copies of the starting and ending X positions. This /* Get a clipped copies of the starting and ending X positions.
* clipped truncates "down" and gives the quantized pixel holding the * This clipped truncates "down" and gives the quantized pixel
* fractional X position * holding the fractional X position
*/ */
ix1 = ngl_clipl(ix1, bounds->pt1.x); ix1 = ngl_clipl(ix1, bounds->pt1.x);
@@ -243,7 +244,7 @@ void NXGL_FUNCNAME(pwfb_filltrapezoid, NXGLIB_SUFFIX)(
#endif #endif
if (lnlen > 0 && mask) if (lnlen > 0 && mask)
{ {
dest[lnlen-1] = (dest[lnlen-1] & ~mask) | (mpixel & mask); dest[lnlen - 1] = (dest[lnlen - 1] & ~mask) | (mpixel & mask);
lnlen--; lnlen--;
} }
@@ -275,12 +276,12 @@ void NXGL_FUNCNAME(pwfb_filltrapezoid, NXGLIB_SUFFIX)(
if (width > 1) if (width > 1)
{ {
NXGL_MEMSET(dest, (NXGL_PIXEL_T)color, width-1); NXGL_MEMSET(dest, (NXGL_PIXEL_T)color, width - 1);
} }
/* And blend the final pixel */ /* And blend the final pixel */
dest += NXGL_SCALEX(width-1); dest += NXGL_SCALEX(width - 1);
frac = b16frac(x2); frac = b16frac(x2);
NXGL_BLEND(dest, (NXGL_PIXEL_T)color, frac); NXGL_BLEND(dest, (NXGL_PIXEL_T)color, frac);
} }
+27 -23
View File
@@ -73,29 +73,30 @@ static inline void pwfb_lowresmemcpy(FAR uint8_t *dline,
lnlen = width; lnlen = width;
if (lnlen > 1 && mask) if (lnlen > 1 && mask)
{ {
dptr[0] = (dptr[0] & ~mask) | (sptr[0] & mask); dptr[0] = (dptr[0] & ~mask) | (sptr[0] & mask);
mask = 0xff; mask = 0xff;
dptr++; dptr++;
sptr++; sptr++;
lnlen--; lnlen--;
} }
/* Handle masking of the fractional final byte */ /* Handle masking of the fractional final byte */
mask &= tailmask; mask &= tailmask;
if (lnlen > 0 && mask) if (lnlen > 0 && mask)
{ {
dptr[lnlen-1] = (dptr[lnlen-1] & ~mask) | (sptr[lnlen-1] & mask); dptr[lnlen - 1] = (dptr[lnlen - 1] & ~mask) |
lnlen--; (sptr[lnlen - 1] & mask);
} lnlen--;
}
/* Handle all of the unmasked bytes in-between */ /* Handle all of the unmasked bytes in-between */
if (lnlen > 0) if (lnlen > 0)
{ {
NXGL_MEMCPY(dptr, sptr, lnlen); NXGL_MEMCPY(dptr, sptr, lnlen);
} }
} }
#endif #endif
@@ -113,8 +114,11 @@ static inline void pwfb_lowresmemcpy(FAR uint8_t *dline,
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(pwfb_getrectangle, NXGLIB_SUFFIX) void NXGL_FUNCNAME(pwfb_getrectangle, NXGLIB_SUFFIX)
(FAR struct nxbe_window_s *bwnd, FAR const struct nxgl_rect_s *rect, (
FAR void *dest, unsigned int deststride) FAR struct nxbe_window_s *bwnd,
FAR const struct nxgl_rect_s *rect,
FAR void *dest,
unsigned int deststride)
{ {
FAR const uint8_t *sline; FAR const uint8_t *sline;
FAR uint8_t *dline; FAR uint8_t *dline;
@@ -146,14 +150,14 @@ void NXGL_FUNCNAME(pwfb_getrectangle, NXGLIB_SUFFIX)
*/ */
leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x))); leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x)));
tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt2.x-1))); tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt2.x - 1)));
# else # else
/* Get the mask for pixels that are ordered so that they pack from the /* Get the mask for pixels that are ordered so that they pack from the
* LS byte up. * LS byte up.
*/ */
leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt1.x))); leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt1.x)));
tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x-1))); tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x - 1)));
# endif # endif
#endif #endif
+29 -25
View File
@@ -73,29 +73,30 @@ static inline void pwfb_lowresmemcpy(FAR uint8_t *dline,
lnlen = width; lnlen = width;
if (lnlen > 1 && mask) if (lnlen > 1 && mask)
{ {
dptr[0] = (dptr[0] & ~mask) | (sptr[0] & mask); dptr[0] = (dptr[0] & ~mask) | (sptr[0] & mask);
mask = 0xff; mask = 0xff;
dptr++; dptr++;
sptr++; sptr++;
lnlen--; lnlen--;
} }
/* Handle masking of the fractional final byte */ /* Handle masking of the fractional final byte */
mask &= tailmask; mask &= tailmask;
if (lnlen > 0 && mask) if (lnlen > 0 && mask)
{ {
dptr[lnlen-1] = (dptr[lnlen-1] & ~mask) | (sptr[lnlen-1] & mask); dptr[lnlen - 1] = (dptr[lnlen - 1] & ~mask) |
lnlen--; (sptr[lnlen - 1] & mask);
} lnlen--;
}
/* Handle all of the unmasked bytes in-between */ /* Handle all of the unmasked bytes in-between */
if (lnlen > 0) if (lnlen > 0)
{ {
NXGL_MEMCPY(dptr, sptr, lnlen); NXGL_MEMCPY(dptr, sptr, lnlen);
} }
} }
#endif #endif
@@ -114,9 +115,11 @@ static inline void pwfb_lowresmemcpy(FAR uint8_t *dline,
* *
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(pwfb_moverectangle,NXGLIB_SUFFIX) void NXGL_FUNCNAME(pwfb_moverectangle, NXGLIB_SUFFIX)
(FAR struct nxbe_window_s *bwnd, FAR const struct nxgl_rect_s *rect, (
FAR struct nxgl_point_s *offset) FAR struct nxbe_window_s *bwnd,
FAR const struct nxgl_rect_s *rect,
FAR struct nxgl_point_s *offset)
{ {
FAR const uint8_t *sline; FAR const uint8_t *sline;
FAR uint8_t *dline; FAR uint8_t *dline;
@@ -148,14 +151,14 @@ void NXGL_FUNCNAME(pwfb_moverectangle,NXGLIB_SUFFIX)
*/ */
leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x))); leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x)));
tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt2.x-1))); tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt2.x - 1)));
# else # else
/* Get the mask for pixels that are ordered so that they pack from the /* Get the mask for pixels that are ordered so that they pack from the
* LS byte up. * LS byte up.
*/ */
leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt1.x))); leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt1.x)));
tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x-1))); tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x - 1)));
# endif # endif
#endif #endif
@@ -184,7 +187,8 @@ void NXGL_FUNCNAME(pwfb_moverectangle,NXGLIB_SUFFIX)
(offset->y < rect->pt1.y && offset->x <= rect->pt1.x)) (offset->y < rect->pt1.y && offset->x <= rect->pt1.x))
{ {
/* Yes.. Copy the rectangle from top down (i.e., adding the stride /* Yes.. Copy the rectangle from top down (i.e., adding the stride
* to move to the next, lower row) */ * to move to the next, lower row)
*/
while (rows--) while (rows--)
{ {
+5 -4
View File
@@ -69,9 +69,10 @@
****************************************************************************/ ****************************************************************************/
void NXGL_FUNCNAME(pwfb_setpixel, NXGLIB_SUFFIX) void NXGL_FUNCNAME(pwfb_setpixel, NXGLIB_SUFFIX)
(FAR struct nxbe_window_s *bwnd, (
FAR const struct nxgl_point_s *pos, FAR struct nxbe_window_s *bwnd,
NXGL_PIXEL_T color) FAR const struct nxgl_point_s *pos,
NXGL_PIXEL_T color)
{ {
FAR uint8_t *dest; FAR uint8_t *dest;
@@ -135,7 +136,7 @@ void NXGL_FUNCNAME(pwfb_setpixel, NXGLIB_SUFFIX)
/* Write the pixel (proper alignment assumed) */ /* Write the pixel (proper alignment assumed) */
pixel = (FAR NXGL_PIXEL_T *)dest; pixel = (FAR NXGL_PIXEL_T *)dest;
*pixel = color; *pixel = color;
#endif #endif
} }
+3 -3
View File
@@ -91,7 +91,7 @@ extern "C"
#endif #endif
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions Definitions
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
@@ -177,8 +177,8 @@ void nxmu_requestbkgd(FAR struct nxmu_conn_s *conn,
* Name: nxmu_releasebkgd * Name: nxmu_releasebkgd
* *
* Description: * Description:
* Release the background window previously acquired using nxmu_openbgwindow * Release the background window previously acquired using
* and return control of the background to NX. * nxmu_openbgwindow and return control of the background to NX.
* *
* Input Parameters: * Input Parameters:
* nxmu - The NXMU state structure * nxmu - The NXMU state structure
+7 -3
View File
@@ -229,7 +229,10 @@ int nxmu_mousein(FAR struct nxmu_state_s *nxmu,
outmsg.buttons = g_mbutton; outmsg.buttons = g_mbutton;
nxgl_vectsubtract(&outmsg.pos, &g_mpos, &g_mwnd->bounds.pt1); nxgl_vectsubtract(&outmsg.pos, &g_mpos, &g_mwnd->bounds.pt1);
return nxmu_sendclientwindow(g_mwnd, &outmsg, sizeof(struct nxclimsg_mousein_s)); return nxmu_sendclientwindow(
g_mwnd,
&outmsg,
sizeof(struct nxclimsg_mousein_s));
} }
else else
{ {
@@ -246,8 +249,9 @@ int nxmu_mousein(FAR struct nxmu_state_s *nxmu,
for (wnd = nxmu->be.topwnd; wnd; wnd = wnd->below) for (wnd = nxmu->be.topwnd; wnd; wnd = wnd->below)
{ {
/* The background window normally has no callback structure (unless /* The background window normally has no callback structure
* a client has taken control of the background via nx_requestbkgd()). * (unlessa client has taken control of the background via
* nx_requestbkgd()).
*/ */
if (wnd->cb) if (wnd->cb)
+2 -1
View File
@@ -71,7 +71,8 @@
* *
****************************************************************************/ ****************************************************************************/
void nxmu_openwindow(FAR struct nxbe_state_s *be, FAR struct nxbe_window_s *wnd) void nxmu_openwindow(FAR struct nxbe_state_s *be,
FAR struct nxbe_window_s *wnd)
{ {
#ifdef CONFIG_NX_RAMBACKED #ifdef CONFIG_NX_RAMBACKED
nxgl_coord_t width; nxgl_coord_t width;
+2 -2
View File
@@ -54,8 +54,8 @@
* Name: nxmu_releasebkgd * Name: nxmu_releasebkgd
* *
* Description: * Description:
* Release the background window previously acquired using nxmu_openbgwindow * Release the background window previously acquired using
* and return control of the background to NX. * nxmu_openbgwindow and return control of the background to NX.
* *
* Input Parameters: * Input Parameters:
* nxmu - The NXMU state structure * nxmu - The NXMU state structure
+3 -1
View File
@@ -80,7 +80,9 @@ void nxmu_reportposition(FAR struct nxbe_window_s *wnd)
/* And provide this to the client */ /* And provide this to the client */
ret = nxmu_sendclientwindow(wnd, &outmsg, sizeof(struct nxclimsg_newposition_s)); ret = nxmu_sendclientwindow(wnd,
&outmsg,
sizeof(struct nxclimsg_newposition_s));
if (ret < 0) if (ret < 0)
{ {
gerr("ERROR: nxmu_sendclient failed: %d\n", errno); gerr("ERROR: nxmu_sendclient failed: %d\n", errno);
+3 -1
View File
@@ -182,7 +182,9 @@ static int nxterm_bitmap(FAR struct nxterm_state_s *priv,
* *
****************************************************************************/ ****************************************************************************/
NXTERM nx_register(NXWINDOW hwnd, FAR struct nxterm_window_s *wndo, int minor) NXTERM nx_register(NXWINDOW hwnd,
FAR struct nxterm_window_s *wndo,
int minor)
{ {
return nxterm_register((NXTERM)hwnd, wndo, &g_nxops, minor); return nxterm_register((NXTERM)hwnd, wndo, &g_nxops, minor);
} }
+3 -2
View File
@@ -288,7 +288,7 @@ static ssize_t nxterm_write(FAR struct file *filep, FAR const char *buffer,
for (i = 1; i < priv->nseq; i++) for (i = 1; i < priv->nseq; i++)
{ {
priv->seq[i-1] = priv->seq[i]; priv->seq[i - 1] = priv->seq[i];
} }
priv->nseq--; priv->nseq--;
@@ -439,7 +439,8 @@ int nxterm_ioctl_tap(int cmd, uintptr_t arg)
/* CMD: NXTERMIOC_NXTERM_RESIZE /* CMD: NXTERMIOC_NXTERM_RESIZE
* DESCRIPTION: Inform NxTerm keyboard the the size of the window has * DESCRIPTION: Inform NxTerm keyboard the the size of the window has
* changed * changed
* ARG: A reference readable instance of struct nxtermioc_resize_s * ARG: A reference readable instance of struct
* nxtermioc_resize_s
* CONFIGURATION: CONFIG_NXTERM * CONFIGURATION: CONFIG_NXTERM
*/ */
+3 -1
View File
@@ -171,7 +171,9 @@ FAR const struct nxterm_bitmap_s *
glyph = nxf_cache_getglyph(priv->fcache, ch); glyph = nxf_cache_getglyph(priv->fcache, ch);
if (!glyph) if (!glyph)
{ {
/* No, there is no font for this code. Just mark this as a space. */ /* No, there is no font for this code.
* Just mark this as a space.
*/
bm->flags |= BMFLAGS_NOGLYPH; bm->flags |= BMFLAGS_NOGLYPH;
+3 -1
View File
@@ -73,7 +73,9 @@
* *
****************************************************************************/ ****************************************************************************/
void nxterm_redraw(NXTERM handle, FAR const struct nxgl_rect_s *rect, bool more) void nxterm_redraw(NXTERM handle,
FAR const struct nxgl_rect_s *rect,
bool more)
{ {
FAR struct nxterm_state_s *priv; FAR struct nxterm_state_s *priv;
int ret; int ret;
+7 -6
View File
@@ -77,10 +77,10 @@ static inline void nxterm_movedisplay(FAR struct nxterm_state_s *priv,
int ret; int ret;
int i; int i;
/* Move each row, one at a time. They could all be moved at once (by calling /* Move each row, one at a time. They could all be moved at once (by
* nxterm_redraw), but the since the region is cleared, then re-written, the * calling nxterm_redraw), but the since the region is cleared, then
* effect would not be good. Below the region is also cleared and re-written, * re-written, the effect would not be good. Below the region is also
* however, in much smaller chunks. * cleared and re-written, however, in much smaller chunks.
*/ */
rect.pt1.x = 0; rect.pt1.x = 0;
@@ -204,8 +204,9 @@ void nxterm_scroll(FAR struct nxterm_state_s *priv, int scrollheight)
sizeof(struct nxterm_bitmap_s)); sizeof(struct nxterm_bitmap_s));
} }
/* Decrement the number of cached characters ('i' is not incremented /* Decrement the number of cached characters ('i' is not
* in this case because it already points to the next character) * incremented in this case because it already points to the next
* character)
*/ */
priv->nchars--; priv->nchars--;
+3 -1
View File
@@ -77,7 +77,9 @@ int nxterm_semwait(FAR struct nxterm_state_s *priv)
me = getpid(); me = getpid();
if (priv->holder != me) if (priv->holder != me)
{ {
/* No.. then wait until the thread that does hold it is finished with it */ /* No..
* then wait until the thread that does hold it is finished with it
*/
ret = nxsem_wait(&priv->exclsem); ret = nxsem_wait(&priv->exclsem);
if (ret == OK) if (ret == OK)
+7 -3
View File
@@ -151,6 +151,7 @@ nxterm_vt100part(FAR struct nxterm_state_s *priv, int seqsize)
} }
} }
} }
return NULL; return NULL;
} }
@@ -170,8 +171,9 @@ nxterm_vt100part(FAR struct nxterm_state_s *priv, int seqsize)
* *
****************************************************************************/ ****************************************************************************/
static enum nxterm_vt100state_e nxterm_vt100seq(FAR struct nxterm_state_s *priv, static enum nxterm_vt100state_e nxterm_vt100seq(
int seqsize) FAR struct nxterm_state_s *priv,
int seqsize)
{ {
FAR const struct vt100_sequence_s *seq; FAR const struct vt100_sequence_s *seq;
enum nxterm_vt100state_e ret; enum nxterm_vt100state_e ret;
@@ -233,7 +235,8 @@ static enum nxterm_vt100state_e nxterm_vt100seq(FAR struct nxterm_state_s *priv,
* *
****************************************************************************/ ****************************************************************************/
enum nxterm_vt100state_e nxterm_vt100(FAR struct nxterm_state_s *priv, char ch) enum nxterm_vt100state_e nxterm_vt100(FAR struct nxterm_state_s *priv,
char ch)
{ {
enum nxterm_vt100state_e ret; enum nxterm_vt100state_e ret;
int seqsize; int seqsize;
@@ -281,5 +284,6 @@ enum nxterm_vt100state_e nxterm_vt100(FAR struct nxterm_state_s *priv, char ch)
priv->nseq = seqsize; priv->nseq = seqsize;
} }
return ret; return ret;
} }
+5 -3
View File
@@ -157,7 +157,8 @@ static int nxtkcon_bitmap(FAR struct nxterm_state_s *priv,
FAR const struct nxgl_point_s *origin, FAR const struct nxgl_point_s *origin,
unsigned int stride) unsigned int stride)
{ {
return nxtk_bitmapwindow((NXTKWINDOW)priv->handle, dest, src, origin, stride); return nxtk_bitmapwindow((NXTKWINDOW)priv->handle,
dest, src, origin, stride);
} }
/**************************************************************************** /****************************************************************************
@@ -172,8 +173,9 @@ static int nxtkcon_bitmap(FAR struct nxterm_state_s *priv,
* registered at /dev/nxtkN where N is the provided minor number. * registered at /dev/nxtkN where N is the provided minor number.
* *
* Input Parameters: * Input Parameters:
* hfwnd - A handle that will be used to access the window. The window must * hfwnd - A handle that will be used to access the window.
* persist and this handle must be valid for the life of the NX console. * The window must persist and this handle must be valid for the
* life of the NX console.
* wndo - Describes the window and font to be used * wndo - Describes the window and font to be used
* minor - The device minor number * minor - The device minor number
* *
+5 -2
View File
@@ -157,7 +157,8 @@ static int nxtool_bitmap(FAR struct nxterm_state_s *priv,
FAR const struct nxgl_point_s *origin, FAR const struct nxgl_point_s *origin,
unsigned int stride) unsigned int stride)
{ {
return nxtk_bitmaptoolbar((NXTKWINDOW)priv->handle, dest, src, origin, stride); return nxtk_bitmaptoolbar((NXTKWINDOW)priv->handle,
dest, src, origin, stride);
} }
/**************************************************************************** /****************************************************************************
@@ -184,7 +185,9 @@ static int nxtool_bitmap(FAR struct nxterm_state_s *priv,
* *
****************************************************************************/ ****************************************************************************/
NXTERM nxtool_register(NXTKWINDOW hfwnd, FAR struct nxterm_window_s *wndo, int minor) NXTERM nxtool_register(NXTKWINDOW hfwnd,
FAR struct nxterm_window_s *wndo,
int minor)
{ {
return nxterm_register((NXTERM)hfwnd, wndo, &g_nxtoolops, minor); return nxterm_register((NXTERM)hfwnd, wndo, &g_nxtoolops, minor);
} }
+17 -9
View File
@@ -78,7 +78,7 @@ uint8_t vnc_convert_rgb8_222(lfb_color_t rgb)
return (uint8_t)(((rgb >> 2) & 0x30) | return (uint8_t)(((rgb >> 2) & 0x30) |
((rgb >> 1) & 0x0c) | ((rgb >> 1) & 0x0c) |
( rgb & 0x03)); (rgb & 0x03));
} }
uint8_t vnc_convert_rgb8_332(lfb_color_t rgb) uint8_t vnc_convert_rgb8_332(lfb_color_t rgb)
@@ -206,7 +206,7 @@ uint8_t vnc_convert_rgb8_222(lfb_color_t rgb)
return (uint8_t)(((rgb >> 18) & 0x00000030) | return (uint8_t)(((rgb >> 18) & 0x00000030) |
((rgb >> 12) & 0x0000000c) | ((rgb >> 12) & 0x0000000c) |
(rgb >> 6) & 0x00000003)); ((rgb >> 6) & 0x00000003));
} }
uint8_t vnc_convert_rgb8_332(lfb_color_t rgb) uint8_t vnc_convert_rgb8_332(lfb_color_t rgb)
@@ -220,7 +220,7 @@ uint8_t vnc_convert_rgb8_332(lfb_color_t rgb)
return (uint8_t)(((rgb >> 16) & 0x00000070) | return (uint8_t)(((rgb >> 16) & 0x00000070) |
((rgb >> 11) & 0x0000001c) | ((rgb >> 11) & 0x0000001c) |
(rgb >> 6) & 0x00000003)); ((rgb >> 6) & 0x00000003));
} }
uint16_t vnc_convert_rgb16_555(lfb_color_t rgb) uint16_t vnc_convert_rgb16_555(lfb_color_t rgb)
@@ -289,26 +289,33 @@ uint32_t vnc_convert_rgb32_888(lfb_color_t rgb)
* *
****************************************************************************/ ****************************************************************************/
int vnc_colors(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect, int vnc_colors(FAR struct vnc_session_s *session,
unsigned int maxcolors, FAR lfb_color_t *colors) FAR struct nxgl_rect_s *rect,
unsigned int maxcolors,
FAR lfb_color_t *colors)
{ {
FAR const lfb_color_t *rowstart; FAR const lfb_color_t *rowstart;
FAR const lfb_color_t *pixptr; FAR const lfb_color_t *pixptr;
lfb_color_t pixel; lfb_color_t pixel;
unsigned int counts[8] = {0, 0, 0, 0, 0, 0, 0, 0};
nxgl_coord_t x; nxgl_coord_t x;
nxgl_coord_t y; nxgl_coord_t y;
int ncolors = 0; int ncolors = 0;
int pixndx; int pixndx;
int maxndx; int maxndx;
int cmpndx; int cmpndx;
unsigned int counts[8] =
{
0, 0, 0, 0, 0, 0, 0, 0
};
DEBUGASSERT(session != NULL && rect != NULL && maxcolors <= 8 && colors != NULL); DEBUGASSERT(session != NULL && rect != NULL &&
maxcolors <= 8 && colors != NULL);
/* Pointer to the first pixel in the first row in the local framebuffer */ /* Pointer to the first pixel in the first row in the local framebuffer */
rowstart = (FAR lfb_color_t *) rowstart = (FAR lfb_color_t *)
(session->fb + RFB_STRIDE * rect->pt1.y + RFB_BYTESPERPIXEL * rect->pt1.x); (session->fb + RFB_STRIDE * rect->pt1.y +
RFB_BYTESPERPIXEL * rect->pt1.x);
/* Loop for each row in the rectangle */ /* Loop for each row in the rectangle */
@@ -341,7 +348,7 @@ int vnc_colors(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect,
counts[pixndx]++; counts[pixndx]++;
} }
/* Do we have space for another color? */ /* Do we have space for another color? */
else if (ncolors >= maxcolors) else if (ncolors >= maxcolors)
{ {
@@ -395,6 +402,7 @@ int vnc_colors(FAR struct vnc_session_s *session, FAR struct nxgl_rect_s *rect,
if (maxndx != pixndx) if (maxndx != pixndx)
{ {
/* Otherwise swap color N and color M */ /* Otherwise swap color N and color M */
/* Remember color N */ /* Remember color N */
lfb_color_t tmpcolor = colors[pixndx]; lfb_color_t tmpcolor = colors[pixndx];

Some files were not shown because too many files have changed in this diff Show More