From ad3e58a69a2a27bb92fd6c3a9f4fd9e7166b5b5c Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 25 Oct 2011 15:21:01 +0000 Subject: [PATCH] Fix some errors in 8-bit color conversion macros; Fix tools/incdir.sh when g++ is used; Fix bad cast that caused problems with the background window is released git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4064 7fd9a85b-ad96-42d3-883c-3090e2eb8679 --- nuttx/ChangeLog | 6 ++++++ nuttx/configs/sim/nsh/defconfig | 2 ++ nuttx/configs/sim/nx/defconfig | 2 ++ nuttx/graphics/nxmu/nx_releasebkgd.c | 2 +- nuttx/graphics/nxsu/nx_releasebkgd.c | 13 ++++++------- nuttx/include/nuttx/rgbcolors.h | 2 +- nuttx/tools/incdir.sh | 16 +++++++++------- 7 files changed, 27 insertions(+), 16 deletions(-) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index fad579bf5..efa9d15d7 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -2172,3 +2172,9 @@ interfaces to read from graphics memory * graphics/nxbe/nxbe_bitmap.c: Fix an error in the error handling that can cause valid bitmaps to fail to render. + * include/nuttx/rgbcolors.h: Fix errors in some 16- and 8-bit color + conversion macros. + * tools/incdir.sh: Fix issues when g++ is used as the compiler. It was + not being recognized and handled properly. + * graphics/nxsu/nx_releasebkgdg.c: Fix a bad cast that was causing + problems with the backgournd window was released. diff --git a/nuttx/configs/sim/nsh/defconfig b/nuttx/configs/sim/nsh/defconfig index a64830e7e..010e08c26 100644 --- a/nuttx/configs/sim/nsh/defconfig +++ b/nuttx/configs/sim/nsh/defconfig @@ -58,6 +58,7 @@ CONFIG_ARCH_BOARD_SIM=y # CONFIG_DEBUG_VERBOSE - enables verbose debug output # CONFIG_DEBUG_SYMBOLS - build without optimization and with # debug symbols (needed for use with a debugger). +# CONFIG_HAVE_CXX - Enable support for C++ # CONFIG_MM_REGIONS - If the architecture includes multiple # regions of memory to allocate from, this specifies the # number of memory regions that the memory manager must @@ -118,6 +119,7 @@ CONFIG_ARCH_BOARD_SIM=y CONFIG_DEBUG=y CONFIG_DEBUG_VERBOSE=y CONFIG_DEBUG_SYMBOLS=n +CONFIG_HAVE_CXX=n CONFIG_MM_REGIONS=1 CONFIG_ARCH_LOWPUTC=y CONFIG_RR_INTERVAL=0 diff --git a/nuttx/configs/sim/nx/defconfig b/nuttx/configs/sim/nx/defconfig index 3dfd3e820..e70163be7 100644 --- a/nuttx/configs/sim/nx/defconfig +++ b/nuttx/configs/sim/nx/defconfig @@ -65,6 +65,7 @@ CONFIG_SIM_FBBPP=8 # CONFIG_DEBUG_VERBOSE - enables verbose debug output # CONFIG_DEBUG_SYMBOLS - build without optimization and with # debug symbols (needed for use with a debugger). +# CONFIG_HAVE_CXX - Enable support for C++ # CONFIG_MM_REGIONS - If the architecture includes multiple # regions of memory to allocate from, this specifies the # number of memory regions that the memory manager must @@ -126,6 +127,7 @@ CONFIG_DEBUG=y CONFIG_DEBUG_VERBOSE=y CONFIG_DEBUG_SYMBOLS=n CONFIG_DEBUG_GRAPHICS=y +CONFIG_HAVE_CXX=n CONFIG_MM_REGIONS=1 CONFIG_ARCH_LOWPUTC=y CONFIG_RR_INTERVAL=0 diff --git a/nuttx/graphics/nxmu/nx_releasebkgd.c b/nuttx/graphics/nxmu/nx_releasebkgd.c index 1326e951e..4e8a75679 100644 --- a/nuttx/graphics/nxmu/nx_releasebkgd.c +++ b/nuttx/graphics/nxmu/nx_releasebkgd.c @@ -2,7 +2,7 @@ * graphics/nxmu/nx_releasebkgd.c * * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * 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/nuttx/graphics/nxsu/nx_releasebkgd.c b/nuttx/graphics/nxsu/nx_releasebkgd.c index a19b85ac4..b0cbbf5c1 100644 --- a/nuttx/graphics/nxsu/nx_releasebkgd.c +++ b/nuttx/graphics/nxsu/nx_releasebkgd.c @@ -2,7 +2,7 @@ * graphics/nxsu/nx_releasebkgd.c * * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -86,11 +86,10 @@ int nx_releasebkgd(NXWINDOW hwnd) { - FAR struct nxfe_state_s *fe = (FAR struct nxfe_state_s *)hwnd; - FAR struct nxbe_state_s *be = &fe->be; + FAR struct nxbe_window_s *bkgd = (FAR struct nxbe_window_s *)hwnd; #ifdef CONFIG_DEBUG - if (!fe) + if (!bkgd) { errno = EINVAL; return ERROR; @@ -99,12 +98,12 @@ int nx_releasebkgd(NXWINDOW hwnd) /* Restore the NX background window callbacks */ - be->bkgd.cb = &g_bkgdcb; - be->bkgd.arg = NULL; + bkgd->cb = &g_bkgdcb; + bkgd->arg = NULL; /* Redraw the background window */ - nxfe_redrawreq(&be->bkgd, &be->bkgd.bounds); + nxfe_redrawreq(bkgd, &bkgd->bounds); return OK; } diff --git a/nuttx/include/nuttx/rgbcolors.h b/nuttx/include/nuttx/rgbcolors.h index d2fcba8f1..93212f6e1 100644 --- a/nuttx/include/nuttx/rgbcolors.h +++ b/nuttx/include/nuttx/rgbcolors.h @@ -70,7 +70,7 @@ /* This macro creates RGB8 (3:3:2) from 8:8:8 RGB */ #define RGBTO8(r,g,b) \ - ((((uint8_t)(r) << 5) & 0xe0) | (((uint8_t)(r) << 2) & 0x1c) | ((uint8_t)(r) & 0x03)) + ((((uint8_t)(r) << 5) & 0xe0) | (((uint8_t)(g) << 2) & 0x1c) | ((uint8_t)(b) & 0x03)) /* And these macros perform the inverse transformation */ diff --git a/nuttx/tools/incdir.sh b/nuttx/tools/incdir.sh index 76f767e83..be6a1d07a 100755 --- a/nuttx/tools/incdir.sh +++ b/nuttx/tools/incdir.sh @@ -2,7 +2,7 @@ # tools/incdir.sh # # Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt +# Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -111,27 +111,29 @@ fi os=`uname -o 2>/dev/null || echo "Other"` -# Let's assume that all GCC compiler paths contain the string gcc and -# no non-GCC compiler pathes include this substring +# Let's assume that all GCC compiler paths contain the string gcc or +# g++ and no non-GCC compiler pathes include these substrings gcc=`echo $ccpath | grep gcc` +if [ -z "${gcc}" ]; then + gcc=`echo $ccpath | grep g++` +fi + sdcc=`echo $ccpath | grep sdcc` if [ "X$os" = "XCygwin" ]; then # We can treat Cygwin native toolchains just like Linux native # toolchains in the Linux. Let's assume: # 1. GCC or SDCC are the only possible Cygwin native compilers - # 2. If this is a Window native GCC version, then -w provided - # on the command line (wintool=y) + # 2. If this is a Window native GCC version, then -w must be + # provided on the command line (wintool=y) if [ -z "$gcc" -a -z "$sdcc" ]; then - # Not GCC or SDCC, must be Windows native windows=yes compiler=`cygpath -u "$ccpath"` else if [ "X$wintool" == "Xy" ]; then - # It is a native GCC or SDCC compiler windows=yes compiler=`cygpath -u "$ccpath"`