diff options
author | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-06-06 18:07:49 +0000 |
---|---|---|
committer | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-06-06 18:07:49 +0000 |
commit | 84feda595c505e8a0d559558b06d06725d0cba34 (patch) | |
tree | 6a2af7b265afcc60bdab2d22ebc23649e424056e /nuttx | |
parent | b2365bb86749f8add88a98c46013574bd6ad07ba (diff) | |
download | px4-firmware-84feda595c505e8a0d559558b06d06725d0cba34.tar.gz px4-firmware-84feda595c505e8a0d559558b06d06725d0cba34.tar.bz2 px4-firmware-84feda595c505e8a0d559558b06d06725d0cba34.zip |
Fix a divide-by-zero error in the trapezoid drawing logic
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4807 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/ChangeLog | 4 | ||||
-rw-r--r-- | nuttx/Documentation/NuttX.html | 2 | ||||
-rw-r--r-- | nuttx/configs/pic32mx7mmb/nsh/appconfig | 2 | ||||
-rw-r--r-- | nuttx/graphics/nxglib/fb/nxglib_filltrapezoid.c | 20 | ||||
-rw-r--r-- | nuttx/graphics/nxglib/lcd/nxglib_filltrapezoid.c | 24 |
5 files changed, 41 insertions, 11 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 5b3063c30..7b32ae20f 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -2896,4 +2896,8 @@ when the work queue is enabled. This is partially because some interrupt related logic is not built in that case. Simply disabling then re- enabling interrupts restores the proper state. + * graphics/nxglib/lcd/nxglib_filltrapezoid.c and fb/nxglib_filltrapezoid.c: + Fix an error when the trapezoid is only 1 line high. In this case, a + divide by zero error would occur. The fix is to draw the 1 line high + trapezoid as a run. diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index a467917f0..8a4489ff6 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -2275,7 +2275,7 @@ <p> <b>STATUS:</b> Two verified configurations are available: - (1) The basic OS test configuration that verfies the correctnexx port of Nuttx, and (2) an extensive <a href="NuttShell.html">NuttShell (NSH)</a> configuration. + (1) The basic OS test configuration that verfies the correctness port of Nuttx, and (2) an extensive <a href="NuttShell.html">NuttShell (NSH)</a> configuration. The NSH configuration includes: (1) Full network support, (2) Verified SPI driver, diff --git a/nuttx/configs/pic32mx7mmb/nsh/appconfig b/nuttx/configs/pic32mx7mmb/nsh/appconfig index 99292fc2b..faa1f49ce 100644 --- a/nuttx/configs/pic32mx7mmb/nsh/appconfig +++ b/nuttx/configs/pic32mx7mmb/nsh/appconfig @@ -65,7 +65,7 @@ ifeq ($(CONFIG_CDCACM),y) CONFIGURED_APPS += examples/cdcacm # Uncomment the following to enable the examples/usbterm built-in # CONFIGURED_APPS += examples/usbterm -#else +else # Prolifics PL2303 emulation configurations diff --git a/nuttx/graphics/nxglib/fb/nxglib_filltrapezoid.c b/nuttx/graphics/nxglib/fb/nxglib_filltrapezoid.c index 64554fae1..7623bf84f 100644 --- a/nuttx/graphics/nxglib/fb/nxglib_filltrapezoid.c +++ b/nuttx/graphics/nxglib/fb/nxglib_filltrapezoid.c @@ -1,8 +1,8 @@ /**************************************************************************** * graphics/nxglib/fb/nxglib_filltrapezoid.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 @@ -126,8 +126,20 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)( /* Calculate the slope of the left and right side of the trapezoid */ - dx1dy = b16divi((trap->bot.x1 - x1), nrows - 1); - dx2dy = b16divi((trap->bot.x2 - x2), nrows - 1); + if (nrows > 1) + { + dx1dy = b16divi((trap->bot.x1 - x1), nrows - 1); + dx2dy = b16divi((trap->bot.x2 - x2), nrows - 1); + } + else + { + /* The trapezoid is a run! Use the average width. */ + + x1 = (x1 + trap->bot.x1) >> 1; + x2 = (x2 + trap->bot.x2) >> 1; + dx1dy = 0; + dx2dy = 0; + } /* Perform vertical clipping */ diff --git a/nuttx/graphics/nxglib/lcd/nxglib_filltrapezoid.c b/nuttx/graphics/nxglib/lcd/nxglib_filltrapezoid.c index 0653da413..3ba44b34a 100644 --- a/nuttx/graphics/nxglib/lcd/nxglib_filltrapezoid.c +++ b/nuttx/graphics/nxglib/lcd/nxglib_filltrapezoid.c @@ -1,8 +1,8 @@ /**************************************************************************** * graphics/nxglib/lcd/nxglib_filltrapezoid.c * - * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * Copyright (C) 2010-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 @@ -124,9 +124,23 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX) /* Calculate the slope of the left and right side of the trapezoid */ - dy = boty - topy; - dx1dy = b16divi((botx1 - topx1), dy); - dx2dy = b16divi((botx2 - topx2), dy); + dy = boty - topy; + if (dy > 0) + { + dx1dy = b16divi((botx1 - topx1), dy); + dx2dy = b16divi((botx2 - topx2), dy); + } + else + { + /* The trapezoid is a run! Use the average width. */ + + topx1 = (topx1 + botx1) >> 1; + topx2 = (topx2 + botx2) >> 1; + botx1 = topx1; + botx2 = topx2; + dx1dy = 0; + dx2dy = 0; + } /* Perform vertical clipping */ |