summaryrefslogtreecommitdiff
path: root/nuttx/graphics/nxglib
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-10 16:25:56 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-10 16:25:56 +0000
commit68f3044b5099572850a9e81a1c63161c20809547 (patch)
tree1160b821f035a4e90a5ed6472800e6d7e03468b8 /nuttx/graphics/nxglib
parent2bfda8161a877d7e618a37353f806981c0ab4a4b (diff)
downloadpx4-nuttx-68f3044b5099572850a9e81a1c63161c20809547.tar.gz
px4-nuttx-68f3044b5099572850a9e81a1c63161c20809547.tar.bz2
px4-nuttx-68f3044b5099572850a9e81a1c63161c20809547.zip
NX trapezoid fixes; Various NxWM fixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4720 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/graphics/nxglib')
-rw-r--r--nuttx/graphics/nxglib/fb/nxglib_filltrapezoid.c16
-rw-r--r--nuttx/graphics/nxglib/nxglib_bitblit.h36
-rw-r--r--nuttx/graphics/nxglib/nxglib_nullrect.c4
3 files changed, 30 insertions, 26 deletions
diff --git a/nuttx/graphics/nxglib/fb/nxglib_filltrapezoid.c b/nuttx/graphics/nxglib/fb/nxglib_filltrapezoid.c
index ddaa0f9bf..64554fae1 100644
--- a/nuttx/graphics/nxglib/fb/nxglib_filltrapezoid.c
+++ b/nuttx/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/nuttx/graphics/nxglib/nxglib_bitblit.h b/nuttx/graphics/nxglib/nxglib_bitblit.h
index a272b284c..a737a0647 100644
--- a/nuttx/graphics/nxglib/nxglib_bitblit.h
+++ b/nuttx/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/nuttx/graphics/nxglib/nxglib_nullrect.c b/nuttx/graphics/nxglib/nxglib_nullrect.c
index 3e3355a45..26fc9e8d7 100644
--- a/nuttx/graphics/nxglib/nxglib_nullrect.c
+++ b/nuttx/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 <spudmonkey@racsa.co.cr>
+ * Copyright (C) 2008-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions