diff options
Diffstat (limited to 'nuttx/graphics/nxglib')
23 files changed, 120 insertions, 123 deletions
diff --git a/nuttx/graphics/nxglib/nxglib_bitblit.h b/nuttx/graphics/nxglib/nxglib_bitblit.h index b3deb66dd..27a4ee37d 100644 --- a/nuttx/graphics/nxglib/nxglib_bitblit.h +++ b/nuttx/graphics/nxglib/nxglib_bitblit.h @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxglib_bitblit.h * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,8 @@ ****************************************************************************/ #include <nuttx/config.h> -#include <sys/types.h> + +#include <stdint.h> #include <nuttx/nxglib.h> @@ -64,41 +65,41 @@ # define NXGL_PIXELSHIFT 3 # define NXGL_PIXELMASK 7 # define NXGL_MULTIPIXEL(p) ((p) ? 0xff : 0x00) -# define NXGL_PIXEL_T ubyte +# define NXGL_PIXEL_T uint8_t #elif NXGLIB_BITSPERPIXEL == 2 # define NXGL_PIXELSHIFT 2 # define NXGL_PIXELMASK 3 -# define NXGL_MULTIPIXEL(p) ((ubyte)(p) << 6 | (ubyte)(p) << 4 | (ubyte)(p) << 2 | (p)) -# define NXGL_PIXEL_T ubyte +# define NXGL_MULTIPIXEL(p) ((uint8_t)(p) << 6 | (uint8_t)(p) << 4 | (uint8_t)(p) << 2 | (p)) +# define NXGL_PIXEL_T uint8_t #elif NXGLIB_BITSPERPIXEL == 4 # define NXGL_PIXELSHIFT 1 # define NXGL_PIXELMASK 1 -# define NXGL_MULTIPIXEL(p) ((ubyte)(p) << 4 | (p)) -# define NXGL_PIXEL_T ubyte +# define NXGL_MULTIPIXEL(p) ((uint8_t)(p) << 4 | (p)) +# define NXGL_PIXEL_T uint8_t #elif NXGLIB_BITSPERPIXEL == 8 # define NXGL_SCALEX(x) (x) -# define NXGL_PIXEL_T ubyte +# define NXGL_PIXEL_T uint8_t #elif NXGLIB_BITSPERPIXEL == 16 # define NXGL_SCALEX(x) ((x) << 1) -# define NXGL_PIXEL_T uint16 +# define NXGL_PIXEL_T uint16_t #elif NXGLIB_BITSPERPIXEL == 24 # define NXGL_SCALEX(x) (((x) << 1) + (x)) -# define NXGL_PIXEL_T uint32 +# define NXGL_PIXEL_T uint32_t #elif NXGLIB_BITSPERPIXEL == 32 # define NXGL_SCALEX(x) ((x) << 2) -# define NXGL_PIXEL_T uint32 +# define NXGL_PIXEL_T uint32_t #endif @@ -110,7 +111,7 @@ # define NXGL_MEMSET(dest,value,width) \ { \ - FAR ubyte *_ptr = (FAR ubyte*)dest; \ + FAR uint8_t *_ptr = (FAR uint8_t*)dest; \ int _nby = NXGL_SCALEX(width); \ while (_nby--) \ { \ @@ -119,8 +120,8 @@ } # define NXGL_MEMCPY(dest,src,width) \ { \ - FAR ubyte *_dptr = (FAR ubyte*)dest; \ - FAR ubyte *_sptr = (FAR ubyte*)src; \ + FAR uint8_t *_dptr = (FAR uint8_t*)dest; \ + FAR uint8_t *_sptr = (FAR uint8_t*)src; \ int _nby = NXGL_SCALEX(width); \ while (_nby--) \ { \ @@ -131,7 +132,7 @@ #elif NXGLIB_BITSPERPIXEL == 24 # define NXGL_MEMSET(dest,value,width) \ { \ - FAR ubyte *_ptr = (FAR ubyte*)dest; \ + FAR uint8_t *_ptr = (FAR uint8_t*)dest; \ nxgl_coord_t _npix = width; \ while (_npix--) \ { \ @@ -142,8 +143,8 @@ } # define NXGL_MEMCPY(dest,src,width) \ { \ - FAR ubyte *_dptr = (FAR ubyte*)dest; \ - FAR ubyte *_sptr = (FAR ubyte*)src; \ + FAR uint8_t *_dptr = (FAR uint8_t*)dest; \ + FAR uint8_t *_sptr = (FAR uint8_t*)src; \ nxgl_coord_t _npix = width; \ while (_npix--) \ { \ diff --git a/nuttx/graphics/nxglib/nxglib_colorcopy.c b/nuttx/graphics/nxglib/nxglib_colorcopy.c index a466640b3..43e348969 100644 --- a/nuttx/graphics/nxglib/nxglib_colorcopy.c +++ b/nuttx/graphics/nxglib/nxglib_colorcopy.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxsglib_colorcopy.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,6 @@ #include <nuttx/config.h> -#include <sys/types.h> #include <nuttx/fb.h> #include <nuttx/nxglib.h> diff --git a/nuttx/graphics/nxglib/nxglib_copyrectangle.c b/nuttx/graphics/nxglib/nxglib_copyrectangle.c index c7026152e..4cb1e182e 100644 --- a/nuttx/graphics/nxglib/nxglib_copyrectangle.c +++ b/nuttx/graphics/nxglib/nxglib_copyrectangle.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxsglib_copyrectangle.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,8 @@ #include <nuttx/config.h> -#include <sys/types.h> +#include <stdint.h> + #include <nuttx/fb.h> #include <nuttx/nxglib.h> @@ -83,18 +84,18 @@ void NXGL_FUNCNAME(nxgl_copyrectangle,NXGLIB_SUFFIX) FAR const void *src, FAR const struct nxgl_point_s *origin, unsigned int srcstride) { - FAR const ubyte *sline; - FAR ubyte *dline; + FAR const uint8_t *sline; + FAR uint8_t *dline; unsigned int width; unsigned int deststride; unsigned int rows; #if NXGLIB_BITSPERPIXEL < 8 - FAR const ubyte *sptr; - FAR ubyte *dptr; - ubyte leadmask; - ubyte tailmask; - ubyte mask; + FAR const uint8_t *sptr; + FAR uint8_t *dptr; + uint8_t leadmask; + uint8_t tailmask; + uint8_t mask; int lnlen; #endif @@ -116,21 +117,21 @@ void NXGL_FUNCNAME(nxgl_copyrectangle,NXGLIB_SUFFIX) * MS byte down. */ - leadmask = (ubyte)(0xff >> (8 - NXGL_REMAINDERX(dest->pt1.x))); - tailmask = (ubyte)(0xff << (8 - NXGL_REMAINDERX(dest->pt2.x-1))); + leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(dest->pt1.x))); + tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(dest->pt2.x-1))); # else /* Get the mask for pixels that are ordered so that they pack from the * LS byte up. */ - leadmask = (ubyte)(0xff << (8 - NXGL_REMAINDERX(dest->pt1.x))); - tailmask = (ubyte)(0xff >> (8 - NXGL_REMAINDERX(dest->pt1.x-1))); + leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(dest->pt1.x))); + tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(dest->pt1.x-1))); # endif #endif /* Then copy the image */ - sline = (const ubyte*)src + NXGL_SCALEX(dest->pt1.x - origin->x) + (dest->pt1.y - origin->y) * srcstride; + sline = (const uint8_t*)src + NXGL_SCALEX(dest->pt1.x - origin->x) + (dest->pt1.y - origin->y) * srcstride; dline = pinfo->fbmem + dest->pt1.y * deststride + NXGL_SCALEX(dest->pt1.x); while (rows--) diff --git a/nuttx/graphics/nxglib/nxglib_fillrectangle.c b/nuttx/graphics/nxglib/nxglib_fillrectangle.c index a83025b45..3d0d13285 100644 --- a/nuttx/graphics/nxglib/nxglib_fillrectangle.c +++ b/nuttx/graphics/nxglib/nxglib_fillrectangle.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxglib_fillrectangle.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,8 @@ #include <nuttx/config.h> -#include <sys/types.h> +#include <stdint.h> + #include <nuttx/fb.h> #include <nuttx/nxglib.h> @@ -84,17 +85,17 @@ void NXGL_FUNCNAME(nxgl_fillrectangle,NXGLIB_SUFFIX) (FAR struct fb_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *rect, nxgl_mxpixel_t color) { - FAR ubyte *line; + FAR uint8_t *line; unsigned int width; unsigned int stride; int rows; #if NXGLIB_BITSPERPIXEL < 8 - FAR ubyte *dest; - ubyte mpixel = NXGL_MULTIPIXEL(color); - ubyte leadmask; - ubyte tailmask; - ubyte mask; + FAR uint8_t *dest; + uint8_t mpixel = NXGL_MULTIPIXEL(color); + uint8_t leadmask; + uint8_t tailmask; + uint8_t mask; int lnlen; #endif @@ -118,15 +119,15 @@ void NXGL_FUNCNAME(nxgl_fillrectangle,NXGLIB_SUFFIX) * MS byte down. */ - leadmask = (ubyte)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x))); - tailmask = (ubyte)(0xff << (8 - NXGL_REMAINDERX(rect->pt2.x-1))); + leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x))); + tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt2.x-1))); # else /* Get the mask for pixels that are ordered so that they pack from the * LS byte up. */ - leadmask = (ubyte)(0xff << (8 - NXGL_REMAINDERX(rect->pt1.x))); - tailmask = (ubyte)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x-1))); + leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt1.x))); + tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x-1))); # endif #endif diff --git a/nuttx/graphics/nxglib/nxglib_filltrapezoid.c b/nuttx/graphics/nxglib/nxglib_filltrapezoid.c index dde0a6036..4fd94fe82 100644 --- a/nuttx/graphics/nxglib/nxglib_filltrapezoid.c +++ b/nuttx/graphics/nxglib/nxglib_filltrapezoid.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxglib_filltrapezoid.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,8 +39,9 @@ #include <nuttx/config.h> -#include <sys/types.h> +#include <stdint.h> #include <fixedmath.h> + #include <nuttx/fb.h> #include <nuttx/nxglib.h> @@ -92,7 +93,7 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)( { unsigned int stride; unsigned int width; - FAR ubyte *line; + FAR uint8_t *line; int nrows; b16_t x1; b16_t x2; @@ -102,9 +103,9 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)( b16_t dx2dy; #if NXGLIB_BITSPERPIXEL < 8 - FAR ubyte *dest; - ubyte mpixel = NXGL_MULTIPIXEL(color); - ubyte mask; + FAR uint8_t *dest; + uint8_t mpixel = NXGL_MULTIPIXEL(color); + uint8_t mask; int lnlen; #endif @@ -196,9 +197,9 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)( /* Handle masking of the fractional initial byte */ #ifdef CONFIG_NX_PACKEDMSFIRST - mask = (ubyte)(0xff >> (8 - NXGL_REMAINDERX(ix1)); + mask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(ix1)); #else - mask = (ubyte)(0xff << (8 - NXGL_REMAINDERX(ix1))); + mask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(ix1))); #endif dest = line; lnlen = width; @@ -214,9 +215,9 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)( /* Handle masking of the fractional final byte */ #ifdef CONFIG_NX_PACKEDMSFIRST - mask &= (ubyte)(0xff << (8 - NXGL_REMAINDERX(ix2))); + mask &= (uint8_t)(0xff << (8 - NXGL_REMAINDERX(ix2))); #else - mask &= (ubyte)(0xff >> (8 - NXGL_REMAINDERX(ix2))); + mask &= (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(ix2))); #endif if (lnlen > 0 && mask) { diff --git a/nuttx/graphics/nxglib/nxglib_moverectangle.c b/nuttx/graphics/nxglib/nxglib_moverectangle.c index a13a32986..dc1ec00cd 100644 --- a/nuttx/graphics/nxglib/nxglib_moverectangle.c +++ b/nuttx/graphics/nxglib/nxglib_moverectangle.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxglib_moverectangle.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,8 @@ #include <nuttx/config.h> -#include <sys/types.h> +#include <stdint.h> + #include <nuttx/fb.h> #include <nuttx/nxglib.h> @@ -70,13 +71,13 @@ ****************************************************************************/ #if NXGLIB_BITSPERPIXEL < 8 -static inline void nxgl_lowresmemcpy(FAR ubyte *dline, FAR const ubyte *sline, +static inline void nxgl_lowresmemcpy(FAR uint8_t *dline, FAR const uint8_t *sline, unsigned int width, - ubyte leadmask, ubyte tailmask) + uint8_t leadmask, uint8_t tailmask) { - FAR const ubyte *sptr; - FAR ubyte *dptr; - ubyte mask; + FAR const uint8_t *sptr; + FAR uint8_t *dptr; + uint8_t mask; int lnlen; /* Handle masking of the fractional initial byte */ @@ -130,15 +131,15 @@ 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 const ubyte *sline; - FAR ubyte *dline; + FAR const uint8_t *sline; + FAR uint8_t *dline; unsigned int width; unsigned int stride; unsigned int rows; #if NXGLIB_BITSPERPIXEL < 8 - ubyte leadmask; - ubyte tailmask; + uint8_t leadmask; + uint8_t tailmask; #endif /* Get the width of the framebuffer in bytes */ @@ -159,15 +160,15 @@ void NXGL_FUNCNAME(nxgl_moverectangle,NXGLIB_SUFFIX) * MS byte down. */ - leadmask = (ubyte)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x))); - tailmask = (ubyte)(0xff << (8 - NXGL_REMAINDERX(rect->pt2.x-1))); + leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x))); + tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt2.x-1))); # else /* Get the mask for pixels that are ordered so that they pack from the * LS byte up. */ - leadmask = (ubyte)(0xff << (8 - NXGL_REMAINDERX(rect->pt1.x))); - tailmask = (ubyte)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x-1))); + leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt1.x))); + tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x-1))); # endif #endif diff --git a/nuttx/graphics/nxglib/nxglib_nonintersecting.c b/nuttx/graphics/nxglib/nxglib_nonintersecting.c index 1aa06c0a2..fd5cddfb3 100644 --- a/nuttx/graphics/nxglib/nxglib_nonintersecting.c +++ b/nuttx/graphics/nxglib/nxglib_nonintersecting.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxsglib_rectnonintersecting.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,6 @@ #include <nuttx/config.h> -#include <sys/types.h> #include <nuttx/fb.h> #include <nuttx/nxglib.h> diff --git a/nuttx/graphics/nxglib/nxglib_nullrect.c b/nuttx/graphics/nxglib/nxglib_nullrect.c index dad690cf0..c472dc50b 100644 --- a/nuttx/graphics/nxglib/nxglib_nullrect.c +++ b/nuttx/graphics/nxglib/nxglib_nullrect.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxsglib_nullrect.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,8 @@ #include <nuttx/config.h> -#include <sys/types.h> +#include <stdbool.h> + #include <nuttx/fb.h> #include <nuttx/nxglib.h> @@ -71,11 +72,11 @@ * Name: nxgl_nullrect * * Description: - * Return TRUE if the area of the retangle is <= 0. + * Return true if the area of the retangle is <= 0. * ****************************************************************************/ -boolean nxgl_nullrect(FAR const struct nxgl_rect_s *rect) +bool nxgl_nullrect(FAR const struct nxgl_rect_s *rect) { return (rect->pt1.x > rect->pt2.x || rect->pt1.y > rect->pt2.y); } diff --git a/nuttx/graphics/nxglib/nxglib_rectcopy.c b/nuttx/graphics/nxglib/nxglib_rectcopy.c index bf266f263..53fb18cbf 100644 --- a/nuttx/graphics/nxglib/nxglib_rectcopy.c +++ b/nuttx/graphics/nxglib/nxglib_rectcopy.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxsglib_rectcopy.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,6 @@ #include <nuttx/config.h> -#include <sys/types.h> #include <nuttx/fb.h> #include <nuttx/nxglib.h> diff --git a/nuttx/graphics/nxglib/nxglib_rectinside.c b/nuttx/graphics/nxglib/nxglib_rectinside.c index aa09eb2d7..615646e70 100644 --- a/nuttx/graphics/nxglib/nxglib_rectinside.c +++ b/nuttx/graphics/nxglib/nxglib_rectinside.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxsglib_rectinside.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,8 @@ #include <nuttx/config.h> -#include <sys/types.h> +#include <stdbool.h> + #include <nuttx/fb.h> #include <nuttx/nxglib.h> @@ -71,12 +72,12 @@ * Name: nxgl_rectinside * * Description: - * Return TRUE if the point pt lies within rect. + * Return true if the point pt lies within rect. * ****************************************************************************/ -boolean nxgl_rectinside(FAR const struct nxgl_rect_s *rect, - FAR const struct nxgl_point_s *pt) +bool nxgl_rectinside(FAR const struct nxgl_rect_s *rect, + FAR const struct nxgl_point_s *pt) { return (pt->x >= rect->pt1.x && pt->x <= rect->pt2.x && pt->y >= rect->pt1.y && pt->y <= rect->pt2.y); diff --git a/nuttx/graphics/nxglib/nxglib_rectintersect.c b/nuttx/graphics/nxglib/nxglib_rectintersect.c index b4f1bd611..1f41898c7 100644 --- a/nuttx/graphics/nxglib/nxglib_rectintersect.c +++ b/nuttx/graphics/nxglib/nxglib_rectintersect.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxsglib_rectintersect.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,6 @@ #include <nuttx/config.h> -#include <sys/types.h> #include <nuttx/fb.h> #include <nuttx/nxglib.h> diff --git a/nuttx/graphics/nxglib/nxglib_rectoffset.c b/nuttx/graphics/nxglib/nxglib_rectoffset.c index 622def5dc..e4775cdcc 100644 --- a/nuttx/graphics/nxglib/nxglib_rectoffset.c +++ b/nuttx/graphics/nxglib/nxglib_rectoffset.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxsglib_rectoffset.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,6 @@ #include <nuttx/config.h> -#include <sys/types.h> #include <nuttx/fb.h> #include <nuttx/nxglib.h> diff --git a/nuttx/graphics/nxglib/nxglib_rectoverlap.c b/nuttx/graphics/nxglib/nxglib_rectoverlap.c index 4b741e798..57414b2c8 100644 --- a/nuttx/graphics/nxglib/nxglib_rectoverlap.c +++ b/nuttx/graphics/nxglib/nxglib_rectoverlap.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxsglib_nulloverlap.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,8 @@ #include <nuttx/config.h> -#include <sys/types.h> +#include <stdbool.h> + #include <nuttx/fb.h> #include <nuttx/nxglib.h> @@ -71,20 +72,20 @@ * Name: nxgl_rectoverlap * * Description: - * Return TRUE if the two rectangles overlap + * Return true if the two rectangles overlap * ****************************************************************************/ -boolean nxgl_rectoverlap(FAR struct nxgl_rect_s *rect1, - FAR struct nxgl_rect_s *rect2) +bool nxgl_rectoverlap(FAR struct nxgl_rect_s *rect1, + FAR struct nxgl_rect_s *rect2) { /* The neither is wholly above, below, right, or left of the other, then * the two rectangles overlap in some fashion. */ - return (rect1->pt1.x <= rect2->pt2.x) && /* FALSE: rect1 is wholly to the right */ - (rect2->pt1.x <= rect1->pt2.x) && /* FALSE: rect2 is wholly to the right */ - (rect1->pt1.y <= rect2->pt2.y) && /* FALSE: rect1 is wholly below rect2 */ - (rect2->pt1.y <= rect1->pt2.y); /* FALSE: rect2 is wholly below rect1 */ + return (rect1->pt1.x <= rect2->pt2.x) && /* false: rect1 is wholly to the right */ + (rect2->pt1.x <= rect1->pt2.x) && /* false: rect2 is wholly to the right */ + (rect1->pt1.y <= rect2->pt2.y) && /* false: rect1 is wholly below rect2 */ + (rect2->pt1.y <= rect1->pt2.y); /* false: rect2 is wholly below rect1 */ } diff --git a/nuttx/graphics/nxglib/nxglib_rectsize.c b/nuttx/graphics/nxglib/nxglib_rectsize.c index f41a7b9c9..c1fb68f8e 100644 --- a/nuttx/graphics/nxglib/nxglib_rectsize.c +++ b/nuttx/graphics/nxglib/nxglib_rectsize.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxglib_rectsize.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,6 @@ #include <nuttx/config.h> -#include <sys/types.h> #include <nuttx/fb.h> #include <nuttx/nxglib.h> diff --git a/nuttx/graphics/nxglib/nxglib_rectunion.c b/nuttx/graphics/nxglib/nxglib_rectunion.c index 4f1c8177b..6f8951886 100644 --- a/nuttx/graphics/nxglib/nxglib_rectunion.c +++ b/nuttx/graphics/nxglib/nxglib_rectunion.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxsglib_rectunion.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,6 @@ #include <nuttx/config.h> -#include <sys/types.h> #include <nuttx/fb.h> #include <nuttx/nxglib.h> diff --git a/nuttx/graphics/nxglib/nxglib_rgb2yuv.c b/nuttx/graphics/nxglib/nxglib_rgb2yuv.c index 49a29ca67..055598406 100644 --- a/nuttx/graphics/nxglib/nxglib_rgb2yuv.c +++ b/nuttx/graphics/nxglib/nxglib_rgb2yuv.c @@ -39,7 +39,7 @@ #include <nuttx/config.h> -#include <sys/types.h> +#include <stdint.h> #include <debug.h> #include <fixedmath.h> @@ -87,7 +87,8 @@ * ****************************************************************************/ -void nxgl_rgb2yuv(ubyte r, ubyte g, ubyte b, ubyte *y, ubyte *u, ubyte *v) +void nxgl_rgb2yuv(uint8_t r, uint8_t g, uint8_t b, + uint8_t *y, uint8_t *u, uint8_t *v) { /* Per the JFIF specification: * @@ -96,7 +97,7 @@ void nxgl_rgb2yuv(ubyte r, ubyte g, ubyte b, ubyte *y, ubyte *u, ubyte *v) * V = 128 + (0.5000 * R) - (0.4187 * G) - (0.0813 * B); */ - *y = (ubyte)b16toi(b16muli(b16_P2990, r) + b16muli(b16_P5870, g) + b16muli(b16_P1140, b)); - *u = (ubyte)b16toi(b16_128P0 - b16muli(b16_P1687, r) - b16muli(b16_P3313, g) + b16muli(b16_P5000, b)); - *v = (ubyte)b16toi(b16_128P0 + b16muli(b16_P5000, r) - b16muli(b16_P4187, g) - b16muli(b16_P0813, b)); + *y = (uint8_t)b16toi(b16muli(b16_P2990, r) + b16muli(b16_P5870, g) + b16muli(b16_P1140, b)); + *u = (uint8_t)b16toi(b16_128P0 - b16muli(b16_P1687, r) - b16muli(b16_P3313, g) + b16muli(b16_P5000, b)); + *v = (uint8_t)b16toi(b16_128P0 + b16muli(b16_P5000, r) - b16muli(b16_P4187, g) - b16muli(b16_P0813, b)); } diff --git a/nuttx/graphics/nxglib/nxglib_runcopy.c b/nuttx/graphics/nxglib/nxglib_runcopy.c index 4d4b1abc5..70320599d 100644 --- a/nuttx/graphics/nxglib/nxglib_runcopy.c +++ b/nuttx/graphics/nxglib/nxglib_runcopy.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxsglib_runcopy.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,6 @@ #include <nuttx/config.h> -#include <sys/types.h> #include <nuttx/fb.h> #include <nuttx/nxglib.h> diff --git a/nuttx/graphics/nxglib/nxglib_runoffset.c b/nuttx/graphics/nxglib/nxglib_runoffset.c index 02aaab894..eed9b713f 100644 --- a/nuttx/graphics/nxglib/nxglib_runoffset.c +++ b/nuttx/graphics/nxglib/nxglib_runoffset.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxsglib_runoffset.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,6 @@ #include <nuttx/config.h> -#include <sys/types.h> #include <fixedmath.h> #include <nuttx/nxglib.h> diff --git a/nuttx/graphics/nxglib/nxglib_trapcopy.c b/nuttx/graphics/nxglib/nxglib_trapcopy.c index 94b8a4d28..d50f13568 100644 --- a/nuttx/graphics/nxglib/nxglib_trapcopy.c +++ b/nuttx/graphics/nxglib/nxglib_trapcopy.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxsglib_trapcopy.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,6 @@ #include <nuttx/config.h> -#include <sys/types.h> #include <nuttx/fb.h> #include <nuttx/nxglib.h> diff --git a/nuttx/graphics/nxglib/nxglib_trapoffset.c b/nuttx/graphics/nxglib/nxglib_trapoffset.c index 4c6f1cffa..4f409951d 100644 --- a/nuttx/graphics/nxglib/nxglib_trapoffset.c +++ b/nuttx/graphics/nxglib/nxglib_trapoffset.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxsglib_trapoffset.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,6 @@ #include <nuttx/config.h> -#include <sys/types.h> #include <nuttx/nxglib.h> /**************************************************************************** diff --git a/nuttx/graphics/nxglib/nxglib_vectoradd.c b/nuttx/graphics/nxglib/nxglib_vectoradd.c index fe854ece1..7259fc04f 100644 --- a/nuttx/graphics/nxglib/nxglib_vectoradd.c +++ b/nuttx/graphics/nxglib/nxglib_vectoradd.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxsglib_vectoradd.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,6 @@ #include <nuttx/config.h> -#include <sys/types.h> #include <nuttx/fb.h> #include <nuttx/nxglib.h> diff --git a/nuttx/graphics/nxglib/nxglib_vectsubtract.c b/nuttx/graphics/nxglib/nxglib_vectsubtract.c index 22ebcaa61..7cff66ef0 100644 --- a/nuttx/graphics/nxglib/nxglib_vectsubtract.c +++ b/nuttx/graphics/nxglib/nxglib_vectsubtract.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxglib/nxsglib_vectorsubtract.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,6 @@ #include <nuttx/config.h> -#include <sys/types.h> #include <nuttx/fb.h> #include <nuttx/nxglib.h> diff --git a/nuttx/graphics/nxglib/nxglib_yuv2rgb.c b/nuttx/graphics/nxglib/nxglib_yuv2rgb.c index 72002d8af..354b18bc8 100644 --- a/nuttx/graphics/nxglib/nxglib_yuv2rgb.c +++ b/nuttx/graphics/nxglib/nxglib_yuv2rgb.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/color/nxglib_yuv2rgb.c * - * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,7 @@ #include <nuttx/config.h> -#include <sys/types.h> +#include <stdint.h> #include <debug.h> #include <fixedmath.h> @@ -83,7 +83,8 @@ * ****************************************************************************/ -void nxgl_yuv2rgb(ubyte y, ubyte u, ubyte v, ubyte *r, ubyte *g, ubyte *b) +void nxgl_yuv2rgb(uint8_t y, uint8_t u, uint8_t v, + uint8_t *r, uint8_t *g, uint8_t *b) { b16_t vm128 = itob16(v) - b16_128P0; b16_t um128 = itob16(u) - b16_128P0; @@ -95,7 +96,7 @@ void nxgl_yuv2rgb(ubyte y, ubyte u, ubyte v, ubyte *r, ubyte *g, ubyte *b) * B = Y + 1.77200 * (U - 128.0) */ - *r = (ubyte)b16toi(itob16(y) + b16muli(b16_1P402, vm128)); - *g = (ubyte)b16toi(itob16(y) - b16muli(b16_P3441, um128) - b16muli(b16_P7141, vm128)); - *b = (ubyte)b16toi(itob16(y) + b16muli(b16_1P772, um128)); + *r = (uint8_t)b16toi(itob16(y) + b16muli(b16_1P402, vm128)); + *g = (uint8_t)b16toi(itob16(y) - b16muli(b16_P3441, um128) - b16muli(b16_P7141, vm128)); + *b = (uint8_t)b16toi(itob16(y) + b16muli(b16_1P772, um128)); } |