diff --git a/ChangeLog b/ChangeLog index 4f2e737a5c..3d1324759e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2724,5 +2724,7 @@ the STMPE11 I/O expander on the STM3240G-EVAL board. Verfied that the STM3240G-EVAL touchscreen is now fully functional. * include/cxx/cfcntl: Added std:: header file. + * graphics/nxbe/nxbe_filltrapezoid.c and graphics/nxglib/fb/nxglib_filltrapezoid.c: + Fix several errors in the trapezoid fill logic. diff --git a/configs/sim/nxwm/defconfig b/configs/sim/nxwm/defconfig index 01b152122d..75afe862a9 100644 --- a/configs/sim/nxwm/defconfig +++ b/configs/sim/nxwm/defconfig @@ -316,7 +316,7 @@ CONFIG_STDIO_BUFFER_SIZE=256 CONFIG_STDIO_LINEBUFFER=y CONFIG_NUNGET_CHARS=2 CONFIG_PREALLOC_MQ_MSGS=32 -CONFIG_MQ_MAXMSGSIZE=32 +CONFIG_MQ_MAXMSGSIZE=48 CONFIG_MAX_WDOGPARMS=4 CONFIG_PREALLOC_WDOGS=32 CONFIG_PREALLOC_TIMERS=8 diff --git a/configs/stm3240g-eval/nsh/defconfig b/configs/stm3240g-eval/nsh/defconfig index 9aa23b036c..5f89450756 100644 --- a/configs/stm3240g-eval/nsh/defconfig +++ b/configs/stm3240g-eval/nsh/defconfig @@ -1323,7 +1323,7 @@ CONFIG_LCD_RPORTRAIT=y # STM3240G-EVAL specific LCD settings # CONFIG_STM32_ILI9320_DISABLE=n -CONFIG_STM32_ILI9325_DISABLE=y +CONFIG_STM32_ILI9325_DISABLE=n # # Settings for examples/uip diff --git a/configs/stm3240g-eval/nxwm/defconfig b/configs/stm3240g-eval/nxwm/defconfig index c3d2062e7a..10ffa08795 100644 --- a/configs/stm3240g-eval/nxwm/defconfig +++ b/configs/stm3240g-eval/nxwm/defconfig @@ -709,7 +709,7 @@ CONFIG_STDIO_BUFFER_SIZE=64 CONFIG_STDIO_LINEBUFFER=y CONFIG_NUNGET_CHARS=2 CONFIG_PREALLOC_MQ_MSGS=8 -CONFIG_MQ_MAXMSGSIZE=32 +CONFIG_MQ_MAXMSGSIZE=48 CONFIG_MAX_WDOGPARMS=2 CONFIG_PREALLOC_WDOGS=8 CONFIG_PREALLOC_TIMERS=4 @@ -1347,7 +1347,7 @@ CONFIG_LCD_RPORTRAIT=n # STM3240G-EVAL specific LCD settings # CONFIG_STM32_ILI9320_DISABLE=n -CONFIG_STM32_ILI9325_DISABLE=y +CONFIG_STM32_ILI9325_DISABLE=n # # Settings for examples/uip diff --git a/graphics/nxbe/nxbe_filltrapezoid.c b/graphics/nxbe/nxbe_filltrapezoid.c index c3c95d22bf..68dad838cd 100644 --- a/graphics/nxbe/nxbe_filltrapezoid.c +++ b/graphics/nxbe/nxbe_filltrapezoid.c @@ -1,8 +1,8 @@ /**************************************************************************** * graphics/nxbe/nxbe_filltrapezoid.c * - * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -140,7 +140,7 @@ void nxbe_filltrapezoid(FAR struct nxbe_window_s *wnd, /* Clip to any user specified clipping window */ - if (clip && !nxgl_nullrect(clip)) + if (clip) { struct nxgl_rect_s tmp; nxgl_rectoffset(&tmp, clip, wnd->bounds.pt1.x, wnd->bounds.pt1.y); @@ -157,8 +157,6 @@ void nxbe_filltrapezoid(FAR struct nxbe_window_s *wnd, info.cops.visible = nxbe_clipfilltrapezoid; info.cops.obscured = nxbe_clipnull; - nxgl_trapcopy(&info.trap, trap); - /* Then process each color plane */ #if CONFIG_NX_NPLANES > 1 diff --git a/graphics/nxglib/fb/nxglib_filltrapezoid.c b/graphics/nxglib/fb/nxglib_filltrapezoid.c index ddaa0f9bfd..64554fae1c 100644 --- a/graphics/nxglib/fb/nxglib_filltrapezoid.c +++ b/graphics/nxglib/fb/nxglib_filltrapezoid.c @@ -93,6 +93,7 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)( { unsigned int stride; unsigned int width; + FAR uint8_t *dest; FAR uint8_t *line; int nrows; b16_t x1; @@ -103,7 +104,6 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)( b16_t dx2dy; #if NXGLIB_BITSPERPIXEL < 8 - FAR uint8_t *dest; uint8_t mpixel = NXGL_MULTIPIXEL(color); uint8_t mask; int lnlen; @@ -191,11 +191,10 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)( ngl_swap(dx1dy, dx2dy, tmp); } - /* Convert the positions to integer and get the run width */ + /* Convert the positions to integer */ - ix1 = b16toi(x1); - ix2 = b16toi(x2); - width = ix2 - ix1 + 1; + ix1 = b16toi(x1); + ix2 = b16toi(x2); /* Handle some corner cases where we draw nothing. Otherwise, we will * always draw at least one pixel. @@ -211,6 +210,10 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)( ix1 = ngl_clipl(ix1, bounds->pt1.x); ix2 = ngl_clipr(ix2, bounds->pt2.x); + /* Get the run length for the clipped row */ + + width = ix2 - ix1 + 1; + #if NXGLIB_BITSPERPIXEL < 8 /* Handle masking of the fractional initial byte */ @@ -253,7 +256,8 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)( #else /* Then draw the run from (line + ix1) to (line + ix2) */ - NXGL_MEMSET(line + NXGL_SCALEX(ix1), (NXGL_PIXEL_T)color, width); + dest = line + NXGL_SCALEX(ix1); + NXGL_MEMSET(dest, (NXGL_PIXEL_T)color, width); #endif } diff --git a/graphics/nxglib/nxglib_bitblit.h b/graphics/nxglib/nxglib_bitblit.h index a272b284c2..a737a06474 100644 --- a/graphics/nxglib/nxglib_bitblit.h +++ b/graphics/nxglib/nxglib_bitblit.h @@ -111,17 +111,17 @@ # define NXGL_MEMSET(dest,value,width) \ { \ - FAR uint8_t *_ptr = (FAR uint8_t*)dest; \ + FAR uint8_t *_ptr = (FAR uint8_t*)(dest); \ int _nby = NXGL_SCALEX(width); \ while (_nby--) \ { \ - *_ptr++ = value; \ + *_ptr++ = (value); \ } \ } # define NXGL_MEMCPY(dest,src,width) \ { \ - FAR uint8_t *_dptr = (FAR uint8_t*)dest; \ - FAR uint8_t *_sptr = (FAR uint8_t*)src; \ + FAR uint8_t *_dptr = (FAR uint8_t*)(dest); \ + FAR uint8_t *_sptr = (FAR uint8_t*)(src); \ int _nby = NXGL_SCALEX(width); \ while (_nby--) \ { \ @@ -132,20 +132,20 @@ #elif NXGLIB_BITSPERPIXEL == 24 # define NXGL_MEMSET(dest,value,width) \ { \ - FAR uint8_t *_ptr = (FAR uint8_t*)dest; \ - nxgl_coord_t _npix = width; \ + FAR uint8_t *_ptr = (FAR uint8_t*)(dest); \ + nxgl_coord_t _npix = (width); \ while (_npix--) \ { \ - *_ptr++ = value; \ - *_ptr++ = value >> 8; \ - *_ptr++ = value >> 16; \ + *_ptr++ = (value); \ + *_ptr++ = (value) >> 8; \ + *_ptr++ = (value) >> 16; \ } \ } # define NXGL_MEMCPY(dest,src,width) \ { \ - FAR uint8_t *_dptr = (FAR uint8_t*)dest; \ - FAR uint8_t *_sptr = (FAR uint8_t*)src; \ - nxgl_coord_t _npix = width; \ + FAR uint8_t *_dptr = (FAR uint8_t*)(dest); \ + FAR uint8_t *_sptr = (FAR uint8_t*)(src); \ + nxgl_coord_t _npix = (width); \ while (_npix--) \ { \ *_dptr++ = *_sptr++; \ @@ -156,18 +156,18 @@ #else # define NXGL_MEMSET(dest,value,width) \ { \ - FAR NXGL_PIXEL_T *_ptr = (FAR NXGL_PIXEL_T*)dest; \ - nxgl_coord_t _npix = width; \ + FAR NXGL_PIXEL_T *_ptr = (FAR NXGL_PIXEL_T*)(dest); \ + nxgl_coord_t _npix = (width); \ while (_npix--) \ { \ - *_ptr++ = value; \ + *_ptr++ = (value); \ } \ } # define NXGL_MEMCPY(dest,src,width) \ { \ - FAR NXGL_PIXEL_T *_dptr = (FAR NXGL_PIXEL_T*)dest; \ - FAR NXGL_PIXEL_T *_sptr = (FAR NXGL_PIXEL_T*)src; \ - nxgl_coord_t _npix = width; \ + FAR NXGL_PIXEL_T *_dptr = (FAR NXGL_PIXEL_T*)(dest); \ + FAR NXGL_PIXEL_T *_sptr = (FAR NXGL_PIXEL_T*)(src); \ + nxgl_coord_t _npix = (width); \ while (_npix--) \ { \ *_dptr++ = *_sptr++; \ diff --git a/graphics/nxglib/nxglib_nullrect.c b/graphics/nxglib/nxglib_nullrect.c index 3e3355a45f..26fc9e8d72 100644 --- a/graphics/nxglib/nxglib_nullrect.c +++ b/graphics/nxglib/nxglib_nullrect.c @@ -1,8 +1,8 @@ /**************************************************************************** * graphics/nxglib/nxsglib_nullrect.c * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Copyright (C) 2008-2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/graphics/nxmu/nx_filltrapezoid.c b/graphics/nxmu/nx_filltrapezoid.c index 8708225d36..f0a55fc622 100644 --- a/graphics/nxmu/nx_filltrapezoid.c +++ b/graphics/nxmu/nx_filltrapezoid.c @@ -1,8 +1,8 @@ /**************************************************************************** * graphics/nxmu/nx_filltrapezoid.c * - * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -98,6 +98,8 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip, int ret; int i; + /* Some debug-only sanity checks */ + #ifdef CONFIG_DEBUG if (!wnd || !wnd->conn || !trap || !color) { @@ -111,22 +113,31 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip, outmsg.msgid = NX_SVRMSG_FILLTRAP; outmsg.wnd = wnd; + /* If no clipping window was provided, then use the size of the entire window */ + if (clip) { nxgl_rectcopy(&outmsg.clip, clip); } else { - memset(&outmsg.clip, 0, sizeof(struct nxgl_rect_s)); + nxgl_rectcopy(&outmsg.clip, &wnd->bounds); } + + /* Copy the trapezod and the color into the message */ + nxgl_trapcopy(&outmsg.trap, trap); +#if CONFIG_NX_NPLANES > 1 for (i = 0; i < CONFIG_NX_NPLANES; i++) +#else + i = 0; +#endif { outmsg.color[i] = color[i]; } - /* Forward the fill command to the server */ + /* Forward the trapezoid fill command to the server */ ret = mq_send(wnd->conn->cwrmq, &outmsg, sizeof(struct nxsvrmsg_filltrapezoid_s), NX_SVRMSG_PRIO);