diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-08-03 21:49:31 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-08-03 21:49:31 +0000 |
commit | 2dbf43396ef13cf1f6870631edbe399b12d5d07a (patch) | |
tree | 5adc239ba2ea9d6b8cbaa46aedc732c3e95a51a0 /nuttx/graphics/nxglib/lcd | |
parent | 4a934b34d9f91e136d417551111a2c06b1f5c327 (diff) | |
download | px4-nuttx-2dbf43396ef13cf1f6870631edbe399b12d5d07a.tar.gz px4-nuttx-2dbf43396ef13cf1f6870631edbe399b12d5d07a.tar.bz2 px4-nuttx-2dbf43396ef13cf1f6870631edbe399b12d5d07a.zip |
Fix numerous errors in trapezoid rendering and wide line drawing algorithms
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3841 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/graphics/nxglib/lcd')
-rw-r--r-- | nuttx/graphics/nxglib/lcd/nxglib_filltrapezoid.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/nuttx/graphics/nxglib/lcd/nxglib_filltrapezoid.c b/nuttx/graphics/nxglib/lcd/nxglib_filltrapezoid.c index 970bbf829..faeebbec7 100644 --- a/nuttx/graphics/nxglib/lcd/nxglib_filltrapezoid.c +++ b/nuttx/graphics/nxglib/lcd/nxglib_filltrapezoid.c @@ -191,12 +191,16 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX) /* Fill the run buffer for the maximum run that we will need */ - ix1 = ngl_clipl(b16toi(topx1), bounds->pt1.x); - ix2 = ngl_clipl(b16toi(topx2), bounds->pt2.x); + ix1 = b16toi(topx1); + ix1 = ngl_clipl(ix1, bounds->pt1.x); + ix2 = b16toi(topx2); + ix2 = ngl_clipr(ix2, bounds->pt2.x); ncols = ix2 - ix1 + 1; - ix1 = ngl_clipl(b16toi(botx1), bounds->pt1.x); - ix2 = ngl_clipl(b16toi(botx2), bounds->pt2.x); + ix1 = b16toi(botx1); + ix1 = ngl_clipl(ix1, bounds->pt1.x); + ix2 = b16toi(botx2); + ix2 = ngl_clipr(ix2, bounds->pt2.x); botw = ix2 - ix1 + 1; if (ncols < botw) @@ -206,7 +210,7 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX) NXGL_FUNCNAME(nxgl_fillrun,NXGLIB_SUFFIX)((NXGLIB_RUNTYPE*)pinfo->buffer, color, ncols); - /* Then fill the trapezoid line-by-line */ + /* Then fill the trapezoid row-by-row */ for (row = topy; row <= boty; row++) { @@ -219,12 +223,14 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX) ngl_swap(dx1dy, dx2dy, tmp); } - /* Convert the positions to integer and get the run width, - * clipping to fit within the bounding box. + /* Convert the positions to integer and get the run width, clipping to + * fit within the bounding box. */ - ix1 = ngl_clipl(b16toi(topx1), bounds->pt1.x); - ix2 = ngl_clipl(b16toi(topx2), bounds->pt2.x); + ix1 = b16toi(topx1); + ix1 = ngl_clipl(ix1, bounds->pt1.x); + ix2 = b16toi(topx2); + ix2 = ngl_clipr(ix2, bounds->pt2.x); /* Handle some corner cases where we draw nothing. Otherwise, we will * always draw at least one pixel. |