diff options
author | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-05-04 20:48:52 +0000 |
---|---|---|
committer | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-05-04 20:48:52 +0000 |
commit | 8e45cf0546b8a6255802a260a4a656ba7a6a979d (patch) | |
tree | a7dac5cb2ba7ff75c73f1559a3cab61495f45c76 | |
parent | 78ec88998083a9678b3494747191fd67a17584c4 (diff) | |
download | px4-firmware-8e45cf0546b8a6255802a260a4a656ba7a6a979d.tar.gz px4-firmware-8e45cf0546b8a6255802a260a4a656ba7a6a979d.tar.bz2 px4-firmware-8e45cf0546b8a6255802a260a4a656ba7a6a979d.zip |
Updated NxWM widgets, several NX, NxWidgets, and NxWM bug fixes
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4699 7fd9a85b-ad96-42d3-883c-3090e2eb8679
24 files changed, 635 insertions, 178 deletions
diff --git a/NxWidgets/ChangeLog.txt b/NxWidgets/ChangeLog.txt index 570942828..1d4c69c9e 100755 --- a/NxWidgets/ChangeLog.txt +++ b/NxWidgets/ChangeLog.txt @@ -22,6 +22,8 @@ need to "rewind" to the beginning of the image. * CRlePalettBitmap: Fixe a positioning problem. It was actually losing the last row of every image! -* CNxWidget: Removed support for "shelving" widgets. I will be removing +* CNxWidget: Removed support for "shelving" widgets. I will be removing some lesser used feature over time in order to reduce the NxWidgets footprint. +* CNxWidget: Removed support for reference constants and close types. + The goal is to ge the base widget class as small as possible.
\ No newline at end of file diff --git a/NxWidgets/libnxwidgets/include/cnxwidget.hxx b/NxWidgets/libnxwidgets/include/cnxwidget.hxx index 99e748f38..ab44b9d42 100644 --- a/NxWidgets/libnxwidgets/include/cnxwidget.hxx +++ b/NxWidgets/libnxwidgets/include/cnxwidget.hxx @@ -124,17 +124,6 @@ namespace NXWidgets public: /** - * Enum describing the way other widgets should behave when they try to - * close this widget. - */ - - enum CloseType - { - CLOSE_TYPE_CLOSE = 0, /**< Widgets should call the close() method */ - CLOSE_TYPE_HIDE = 1 /**< Widgets should call the hide() method */ - }; - - /** * Enum listing flags that can be set in the constructor's "flags" parameter. */ @@ -184,7 +173,6 @@ namespace NXWidgets protected: CWidgetControl *m_widgetControl; /**< The controlling widget for the display */ CRect m_rect; /**< Rectange bounding the widget. */ - uint32_t m_refcon; /**< Identifying number of the widget. */ // Dragging variables @@ -221,7 +209,6 @@ namespace NXWidgets // Visible regions CRectCache *m_rectCache; /**< List of the widget's visible regions. */ - CloseType m_closeType; /**< Type of close method that should be called for the widget. */ WidgetBorderSize m_borderSize; /**< Size of the widget borders. */ /** @@ -508,28 +495,6 @@ namespace NXWidgets const nxgl_coord_t getRelativeY(void) const; /** - * Get the reference constant for this widget. - * @return The reference constant. - */ - - inline const uint32_t getRefcon(void) const - { - return m_refcon; - } - - /** - * Get the type of close routine that should be called by other widgets - * interacting with this widget. - * - * @return The close type of this widget. - */ - - inline const CloseType getCloseType(void) - { - return m_closeType; - } - - /** * Is the widget active? * A value of true indicates that this widget has focus or is an ancestor * of the widget with focus. @@ -901,15 +866,6 @@ namespace NXWidgets } /** - * Sets this widget's reference constant. This should be unique, - * at least amongst this widget's siblings. - * - * @param refcon The reference constant. - */ - - uint32_t setRefcon(uint32_t refcon); - - /** * Sets this widget's border state. * * @param isBorderless The border state. @@ -1092,17 +1048,6 @@ namespace NXWidgets } /** - * Sets the close type other widgets should use when closing this widget. - * - * @param closeType The close type to use. - */ - - inline void setCloseType(const CloseType closeType) - { - m_closeType = closeType; - } - - /** * Sets the font. * * @param font A pointer to the font to use. diff --git a/NxWidgets/libnxwidgets/src/cnxwidget.cxx b/NxWidgets/libnxwidgets/src/cnxwidget.cxx index 8b5d0cb57..483309832 100644 --- a/NxWidgets/libnxwidgets/src/cnxwidget.cxx +++ b/NxWidgets/libnxwidgets/src/cnxwidget.cxx @@ -189,10 +189,6 @@ CNxWidget::CNxWidget(CWidgetControl *pWidgetControl, m_lastClickY = 0; m_doubleClickBounds = DOUBLE_CLICK_BOUNDS; - // Set other default values - - m_refcon = 0; - // Set border size to 1 line m_borderSize.top = 1; @@ -200,7 +196,6 @@ CNxWidget::CNxWidget(CWidgetControl *pWidgetControl, m_borderSize.bottom = 1; m_borderSize.left = 1; - m_closeType = CLOSE_TYPE_CLOSE; m_rectCache = new CRectCache(this); m_widgetEventHandlers = new CWidgetEventHandlerList(this); } @@ -507,20 +502,6 @@ TNxArray<CRect> *CNxWidget::getForegroundRegions(void) } /** - * Sets this widget's reference constant. This should be unique, - * at least amongst this widget's siblings. - * - * @param refcon The reference constant. - */ - -uint32_t CNxWidget::setRefcon(uint32_t refcon) -{ - uint32_t old = m_refcon; - m_refcon = refcon; - return old; -} - -/** * Sets this widget's border state. * * @param isBorderless The border state. diff --git a/NxWidgets/nxwm/Makefile b/NxWidgets/nxwm/Makefile index 4f13ca362..badc5eb21 100644 --- a/NxWidgets/nxwm/Makefile +++ b/NxWidgets/nxwm/Makefile @@ -44,7 +44,7 @@ CSRCS = # Window Manager CXXSRCS = capplicationwindow.cxx cnxconsole.cxx cstartwindow.cxx ctaskbar.cxx # Images -CXXSRCS += glyph_minimize.cxx glyph_nsh.cxx glyph_start.cxx glyph_stop.cxx +CXXSRCS += glyph_cmd.cxx glyph_minimize.cxx glyph_nsh.cxx glyph_play.cxx glyph_start.cxx glyph_stop.cxx SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) diff --git a/NxWidgets/nxwm/images/cmd.png b/NxWidgets/nxwm/images/cmd.png Binary files differnew file mode 100755 index 000000000..3e6cf667c --- /dev/null +++ b/NxWidgets/nxwm/images/cmd.png diff --git a/NxWidgets/nxwm/images/play.png b/NxWidgets/nxwm/images/play.png Binary files differnew file mode 100755 index 000000000..ab7c29249 --- /dev/null +++ b/NxWidgets/nxwm/images/play.png diff --git a/NxWidgets/nxwm/include/nxwmconfig.hxx b/NxWidgets/nxwm/include/nxwmconfig.hxx index 9387e2713..57566b2d4 100644 --- a/NxWidgets/nxwm/include/nxwmconfig.hxx +++ b/NxWidgets/nxwm/include/nxwmconfig.hxx @@ -248,6 +248,7 @@ * * CONFIG_NXWM_STARTWINDOW_VSPACING - Vertical spacing. Default: 2 pixels * CONFIG_NXWM_STARTWINDOW_HSPACING - Horizontal spacing. Default: 2 rows + * CONFIG_NXWM_STARTWINDOW_ICON - The glyph to use as the start window icon */ #ifndef CONFIG_NXWM_STARTWINDOW_VSPACING @@ -258,6 +259,14 @@ # define CONFIG_NXWM_STARTWINDOW_HSPACING (2) #endif +/** + * The start window glyph + */ + +#ifndef CONFIG_NXWM_STARTWINDOW_ICON +# define CONFIG_NXWM_STARTWINDOW_ICON NxWM::g_playBitmap +#endif + /* NxConsole Window *********************************************************/ /** * NxConsole Window Configuration @@ -275,6 +284,7 @@ * NxConsole window. Default: MKRGB(0,0,0) * CONFIG_NXWM_NXCONSOLE_FONTID - The ID of the font to use in the NxConsole * window. Default: CONFIG_NXWM_DEFAULT_FONTID + * CONFIG_NXWM_NXCONSOLE_ICON - The glyph to use as the NxConsole icon */ #ifndef CONFIG_NXWM_NXCONSOLE_PRIO @@ -302,6 +312,14 @@ # define CONFIG_NXWM_NXCONSOLE_FONTID CONFIG_NXWM_DEFAULT_FONTID #endif +/** + * The NxConsole window glyph + */ + +#ifndef CONFIG_NXWM_NXCONSOLE_ICON +# define CONFIG_NXWM_NXCONSOLE_ICON NxWM::g_cmdBitmap +#endif + /**************************************************************************** * Global Function Prototypes ****************************************************************************/ diff --git a/NxWidgets/nxwm/include/nxwmglyphs.hxx b/NxWidgets/nxwm/include/nxwmglyphs.hxx index 198fe9f26..6a850179c 100644 --- a/NxWidgets/nxwm/include/nxwmglyphs.hxx +++ b/NxWidgets/nxwm/include/nxwmglyphs.hxx @@ -57,8 +57,10 @@ namespace NxWM { - extern const struct NXWidgets::SRlePaletteBitmap g_nshBitmap; + extern const struct NXWidgets::SRlePaletteBitmap g_cmdBitmap; extern const struct NXWidgets::SRlePaletteBitmap g_minimizeBitmap; + extern const struct NXWidgets::SRlePaletteBitmap g_nshBitmap; + extern const struct NXWidgets::SRlePaletteBitmap g_playBitmap; extern const struct NXWidgets::SRlePaletteBitmap g_startBitmap; extern const struct NXWidgets::SRlePaletteBitmap g_stopBitmap; } diff --git a/NxWidgets/nxwm/src/cnxconsole.cxx b/NxWidgets/nxwm/src/cnxconsole.cxx index de44ab7f0..8898b8bcb 100644 --- a/NxWidgets/nxwm/src/cnxconsole.cxx +++ b/NxWidgets/nxwm/src/cnxconsole.cxx @@ -169,7 +169,7 @@ CApplicationWindow *CNxConsole::getWindow(void) const NXWidgets::IBitmap *CNxConsole::getIcon(void) { NXWidgets::CRlePaletteBitmap *bitmap = - new NXWidgets::CRlePaletteBitmap(&g_nshBitmap); + new NXWidgets::CRlePaletteBitmap(&CONFIG_NXWM_NXCONSOLE_ICON); return bitmap; } diff --git a/NxWidgets/nxwm/src/cstartwindow.cxx b/NxWidgets/nxwm/src/cstartwindow.cxx index f25ed8d2b..a29f1f785 100644 --- a/NxWidgets/nxwm/src/cstartwindow.cxx +++ b/NxWidgets/nxwm/src/cstartwindow.cxx @@ -120,7 +120,7 @@ CApplicationWindow *CStartWindow::getWindow(void) const NXWidgets::IBitmap *CStartWindow::getIcon(void) { NXWidgets::CRlePaletteBitmap *bitmap = - new NXWidgets::CRlePaletteBitmap(&g_startBitmap); + new NXWidgets::CRlePaletteBitmap(&CONFIG_NXWM_STARTWINDOW_ICON); return bitmap; } diff --git a/NxWidgets/nxwm/src/glyph_cmd.cxx b/NxWidgets/nxwm/src/glyph_cmd.cxx new file mode 100644 index 000000000..816c888c5 --- /dev/null +++ b/NxWidgets/nxwm/src/glyph_cmd.cxx @@ -0,0 +1,181 @@ +/******************************************************************************************** + * NxWidgets/nxwm/src/glyph_cmd.cxx + * + * Copyright (C) 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 + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors + * me be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ********************************************************************************************/ + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ + +#include <nuttx/config.h> + +#include <sys/types.h> +#include <stdint.h> +#include <stdbool.h> + +#include <nuttx/nx/nxglib.h> +#include <nuttx/fb.h> +#include <nuttx/rgbcolors.h> + +#include "crlepalettebitmap.hxx" + +#include "nxwmconfig.hxx" +#include "nxwmglyphs.hxx" + +/******************************************************************************************** + * Pre-Processor Definitions + ********************************************************************************************/ + +#define BITMAP_NROWS 22 +#define BITMAP_NCOLUMNS 25 +#define BITMAP_NLUTCODES 8 + +/******************************************************************************************** + * Private Bitmap Data + ********************************************************************************************/ + +using namespace NxWM; + +/* RGB24 (8-8-8) Colors */ + +#if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32 + +static const uint32_t g_cmdNormalLut[BITMAP_NLUTCODES] = +{ + 0x909090, 0x000000, 0xb4fcfc, 0xb4d8fc, 0x6cb4fc, 0x6c6c6c, 0xfcfcfc, 0x484848 +}; + +static const uint32_t g_cmdBrightlLut[BITMAP_NLUTCODES] = +{ + 0xababab, 0x3f3f3f, 0xc6fcfc, 0xc6e1fc, 0x90c6fc, 0x909090, 0xfcfcfc, 0x757575 +}; +/* RGB16 (565) Colors (four of the colors in this map are duplicates) */ + +#elif CONFIG_NXWIDGETS_BPP == 16 + +static const uint16_t g_cmdNormalLut[BITMAP_NLUTCODES] = +{ + 0x9492, 0x0000, 0xb7ff, 0xb6df, 0x6dbf, 0x6b6d, 0xffff, 0x4a49 +}; + +static const uint16_t g_cmdBrightlLut[BITMAP_NLUTCODES] = +{ + 0xad55, 0x39e7, 0xc7ff, 0xc71f, 0x963f, 0x9492, 0xffff, 0x73ae +}; + +/* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used + * to lookup an 8-bit value. There is no savings in that! It would be better to just put + * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these + * pointless lookups. But these p;ointless lookups do make the logic compatible with the + * 16- and 24-bit types. + */ + +#elif CONFIG_NXWIDGETS_BPP == 8 +# ifdef CONFIG_NXWIDGETS_GREYSCALE + +/* 8-bit Greyscale */ + +static const uint8_t g_cmdNormalLut[BITMAP_NLUTCODES] = +{ + 0x90, 0x00, 0xe6, 0xd1, 0xa6, 0x6c, 0xfc, 0x48 +}; + +static const uint8_t g_cmdBrightlLut[BITMAP_NLUTCODES] = +{ + 0xab, 0x3f, 0xeb, 0xdc, 0xbc, 0x90, 0xfc, 0x75 +}; + +# else /* CONFIG_NXWIDGETS_GREYSCALE */ + +/* RGB8 (332) Colors */ + +static const nxgl_mxpixel_t g_cmdNormalLut[BITMAP_NLUTCODES] = +{ + 0x92, 0x00, 0xbf, 0xbb, 0x77, 0x6d, 0xff, 0x49 +}; + +static const nxgl_mxpixel_t g_cmdBrightlLut[BITMAP_NLUTCODES] = +{ + 0xb6, 0x24, 0xdf, 0xdf, 0x9b, 0x92, 0xff, 0x6d +}; + +# endif +#else +# error "Unsupport pixel format" +#endif + +static const struct NXWidgets::SRlePaletteBitmapEntry g_cmdRleEntries[] = +{ + { 24, 0}, { 1, 1}, /* Row 0 */ + { 24, 0}, { 1, 1}, /* Row 1 */ + { 2, 0}, { 1, 2}, { 13, 3}, { 7, 4}, { 1, 0}, { 1, 1}, /* Row 2 */ + { 2, 0}, { 3, 3}, { 18, 4}, { 1, 0}, { 1, 1}, /* Row 3 */ + { 2, 0}, { 3, 3}, { 18, 4}, { 1, 0}, { 1, 1}, /* Row 4 */ + { 24, 0}, { 1, 1}, /* Row 5 */ + { 1, 0}, { 22, 1}, { 1, 0}, { 1, 1}, /* Row 6 */ + { 1, 0}, { 1, 1}, { 21, 5}, { 1, 0}, { 1, 1}, /* Row 7 */ + { 1, 0}, { 1, 1}, { 21, 5}, { 1, 0}, { 1, 1}, /* Row 8 */ + { 1, 0}, { 1, 1}, { 2, 5}, { 1, 6}, { 18, 5}, { 1, 0}, { 1, 1}, /* Row 9 */ + { 1, 0}, { 1, 1}, { 3, 5}, { 1, 6}, { 17, 5}, { 1, 0}, { 1, 1}, /* Row 10 */ + { 1, 0}, { 1, 1}, { 4, 5}, { 1, 6}, { 16, 5}, { 1, 0}, { 1, 1}, /* Row 11 */ + { 1, 0}, { 1, 1}, { 5, 5}, { 1, 6}, { 15, 5}, { 1, 0}, { 1, 1}, /* Row 12 */ + { 1, 0}, { 1, 1}, { 6, 5}, { 1, 6}, { 14, 5}, { 1, 0}, { 1, 1}, /* Row 13 */ + { 1, 0}, { 1, 1}, { 5, 5}, { 1, 6}, { 1, 7}, { 14, 5}, { 1, 0}, { 1, 1}, /* Row 14 */ + { 1, 0}, { 1, 1}, { 4, 5}, { 1, 6}, { 1, 7}, { 15, 5}, { 1, 0}, { 1, 1}, /* Row 15 */ + { 1, 0}, { 1, 1}, { 3, 5}, { 1, 6}, { 1, 7}, { 4, 5}, { 9, 6}, { 3, 5}, /* Row 16 */ + { 1, 0}, { 1, 1}, + { 1, 0}, { 1, 1}, { 2, 5}, { 1, 6}, { 1, 7}, { 6, 5}, { 9, 7}, { 2, 5}, /* Row 17 */ + { 1, 0}, { 1, 1}, + { 1, 0}, { 1, 1}, { 2, 5}, { 1, 7}, { 18, 5}, { 1, 0}, { 1, 1}, /* Row 18 */ + { 1, 0}, { 1, 1}, { 21, 5}, { 1, 0}, { 1, 1}, /* Row 19 */ + { 24, 0}, { 1, 1}, /* Row 20 */ + { 25, 1}, /* Row 21 */ +}; + +/******************************************************************************************** + * Public Bitmap Structure Defintions + ********************************************************************************************/ + +const struct NXWidgets::SRlePaletteBitmap NxWM::g_cmdBitmap = +{ + CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel + CONFIG_NXWIDGETS_FMT, // fmt - Color format + BITMAP_NLUTCODES, // nlut - Number of colors in the lLook-Up Table (LUT) + BITMAP_NCOLUMNS, // width - Width in pixels + BITMAP_NROWS, // height - Height in rows + { // lut - Pointer to the beginning of the Look-Up Table (LUT) + g_cmdNormalLut, // Index 0: Unselected LUT + g_cmdBrightlLut, // Index 1: Selected LUT + }, + g_cmdRleEntries // data - Pointer to the beginning of the RLE data +}; diff --git a/NxWidgets/nxwm/src/glyph_minimize.cxx b/NxWidgets/nxwm/src/glyph_minimize.cxx index 1f375ab13..4dd95f9f2 100644 --- a/NxWidgets/nxwm/src/glyph_minimize.cxx +++ b/NxWidgets/nxwm/src/glyph_minimize.cxx @@ -70,20 +70,30 @@ using namespace NxWM; #if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32 -static const uint32_t g_minimizeLut[BITMAP_NLUTCODES] = +static const uint32_t g_minimizeNormalLut[BITMAP_NLUTCODES] = { 0x2448b4, 0x486cd8, 0x0024b4, 0x0024d8, 0x242490, 0x0000b4, 0xfcfcfc, 0xd8fcfc /* Codes 0-7 */ }; +static const uint32_t g_minimizeBrightLut[BITMAP_NLUTCODES] = +{ + 0x5a75c6, 0x7590e1, 0x3f5ac6, 0x3f5ae1, 0x5a5aab, 0x3f3fc6, 0xfcfcfc, 0xe1fcfc /* Codes 0-7 */ +}; + /* RGB16 (565) Colors (four of the colors in this map are duplicates) */ #elif CONFIG_NXWIDGETS_BPP == 16 -static const uint16_t g_minimizeLut[BITMAP_NLUTCODES] = +static const uint16_t g_minimizeNormalLut[BITMAP_NLUTCODES] = { 0x2256, 0x4b7b, 0x0136, 0x013b, 0x2132, 0x0016, 0xffff, 0xdfff /* Codes 0-7 */ }; +static const uint16_t g_minimizeBrightLut[BITMAP_NLUTCODES] = +{ + 0x5bb8, 0x749c, 0x3ad8, 0x3adc, 0x5ad5, 0x39f8, 0xffff, 0xe7ff /* Codes 0-7 */ +}; + /* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used * to lookup an 8-bit value. There is no savings in that! It would be better to just put * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these @@ -96,20 +106,30 @@ static const uint16_t g_minimizeLut[BITMAP_NLUTCODES] = /* 8-bit Greyscale */ -static const uint8_t g_minimizeLut[BITMAP_NLUTCODES] = +static const uint8_t g_minimizeNormalLut[BITMAP_NLUTCODES] = { 0x49, 0x6d, 0x29, 0x2d, 0x30, 0x14, 0xfc, 0xf1 /* Codes 0-7 */ }; +static const uint8_t g_minimizeBrightLut[BITMAP_NLUTCODES] = +{ + 0x76, 0x91, 0x5e, 0x61, 0x63, 0x4e, 0xfc, 0xf3 /* Codes 0-7 */ +}; + # else /* CONFIG_NXWIDGETS_GREYSCALE */ /* RGB8 (332) Colors */ -static const nxgl_mxpixel_t g_minimizeLut[BITMAP_NLUTCODES] = +static const nxgl_mxpixel_t g_minimizeNormalLut[BITMAP_NLUTCODES] = { 0x2a, 0x4f, 0x06, 0x07, 0x26, 0x02, 0xff, 0xdf /* Codes 0-7 */ }; +static const uint8_t g_minimizeBrightLut[BITMAP_NLUTCODES] = +{ + 0x4f, 0x73, 0x2b, 0x2b, 0x4a, 0x27, 0xff, 0xff /* Codes 0-7 */ +}; + # endif #else # error "Unsupport pixel format" @@ -152,8 +172,8 @@ const struct NXWidgets::SRlePaletteBitmap NxWM::g_minimizeBitmap = BITMAP_NCOLUMNS, // width - Width in pixels BITMAP_NROWS, // height - Height in rows { // lut - Pointer to the beginning of the Look-Up Table (LUT) - g_minimizeLut, // Index 0: Unselected LUT - g_minimizeLut, // Index 1: Selected LUT + g_minimizeNormalLut, // Index 0: Unselected LUT + g_minimizeBrightLut, // Index 1: Selected LUT }, g_minimizeRleEntries // data - Pointer to the beginning of the RLE data }; diff --git a/NxWidgets/nxwm/src/glyph_play.cxx b/NxWidgets/nxwm/src/glyph_play.cxx new file mode 100644 index 000000000..a6970b2e0 --- /dev/null +++ b/NxWidgets/nxwm/src/glyph_play.cxx @@ -0,0 +1,210 @@ +/******************************************************************************************** + * NxWidgets/nxwm/src/glyph_play.cxx + * + * Copyright (C) 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 + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors + * me be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ********************************************************************************************/ + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ + +#include <nuttx/config.h> + +#include <sys/types.h> +#include <stdint.h> +#include <stdbool.h> + +#include <nuttx/nx/nxglib.h> +#include <nuttx/fb.h> +#include <nuttx/rgbcolors.h> + +#include "crlepalettebitmap.hxx" + +#include "nxwmconfig.hxx" +#include "nxwmglyphs.hxx" + +/******************************************************************************************** + * Pre-Processor Definitions + ********************************************************************************************/ + +#define BITMAP_NROWS 25 +#define BITMAP_NCOLUMNS 25 +#define BITMAP_NLUTCODES 6 + +/******************************************************************************************** + * Private Bitmap Data + ********************************************************************************************/ + +using namespace NxWM; + +/* RGB24 (8-8-8) Colors */ + +#if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32 + +static const uint32_t g_playNormalLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x00d800, 0x008400, 0x006800, 0x00ac00, 0x004800, /* Codes 1-5 */ +}; + +static const uint32_t g_playBrightlLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x3fe13f, 0x3fa23f, 0x3f8d3f, 0x3fc03f, 0x3f753f /* Codes 1-5 */ +}; +/* RGB16 (565) Colors (four of the colors in this map are duplicates) */ + +#elif CONFIG_NXWIDGETS_BPP == 16 + +static const uint16_t g_playNormalLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x06c0, 0x0420, 0x0340, 0x0560, 0x0240, /* Codes 0-5 */ +}; + +static const uint16_t g_playBrightlLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x3f07, 0x3d07, 0x3c67, 0x3e07, 0x3ba7, /* Codes 0-5 */ +}; + +/* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used + * to lookup an 8-bit value. There is no savings in that! It would be better to just put + * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these + * pointless lookups. But these p;ointless lookups do make the logic compatible with the + * 16- and 24-bit types. + */ + +#elif CONFIG_NXWIDGETS_BPP == 8 +# ifdef CONFIG_NXWIDGETS_GREYSCALE + +/* 8-bit Greyscale */ + +static const uint8_t g_playNormalLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x7e, 0x4d, 0x3d, 0x64, 0x2a /* Codes 1-5 */ +}; + +static const uint8_t g_playBrightlLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x9e, 0x79, 0x6c, 0x8a, 0x5e /* Codes 1-5 */ +}; + +# else /* CONFIG_NXWIDGETS_GREYSCALE */ + +/* RGB8 (332) Colors */ + +static const nxgl_mxpixel_t g_playNormalLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x18, 0x10, 0x0c, 0x14, 0x08 /* Codes 0-5 */ +}; + +static const nxgl_mxpixel_t g_playBrightlLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x3c, 0x34, 0x30, 0x38, 0x2c /* Codes 0-5 */ +}; + +# endif +#else +# error "Unsupport pixel format" +#endif + +static const struct NXWidgets::SRlePaletteBitmapEntry g_playRleEntries[] = +{ + { 25, 0}, /* Row 0 */ + { 9, 0}, { 1, 1}, { 1, 2}, { 3, 3}, { 1, 2}, { 1, 1}, { 9, 0}, /* Row 1 */ + { 7, 0}, { 1, 1}, { 1, 3}, { 2, 2}, { 3, 1}, { 1, 4}, { 1, 3}, { 1, 5}, /* Row 2 */ + { 1, 2}, { 7, 0}, + { 6, 0}, { 1, 1}, { 1, 5}, { 1, 2}, { 7, 0}, { 1, 1}, { 1, 5}, { 1, 3}, /* Row 3 */ + { 6, 0}, + { 4, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 4}, { 9, 0}, { 1, 1}, { 1, 2}, /* Row 4 */ + { 1, 5}, { 1, 3}, { 4, 0}, + { 3, 0}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 0}, { 1, 1}, { 10, 0}, /* Row 5 */ + { 1, 4}, { 1, 5}, { 1, 2}, { 3, 0}, + { 3, 0}, { 1, 3}, { 1, 5}, { 3, 0}, { 2, 1}, { 10, 0}, { 2, 3}, { 1, 4}, /* Row 6 */ + { 2, 0}, + { 2, 0}, { 1, 1}, { 1, 5}, { 1, 4}, { 3, 0}, { 1, 1}, { 1, 4}, { 2, 1}, /* Row 7 */ + { 8, 0}, { 1, 1}, { 1, 5}, { 1, 2}, { 2, 0}, + { 2, 0}, { 1, 3}, { 1, 2}, { 4, 0}, { 1, 1}, { 5, 4}, { 7, 0}, { 1, 1}, /* Row 8 */ + { 1, 5}, { 1, 2}, { 1, 0}, + { 1, 0}, { 1, 1}, { 1, 3}, { 1, 4}, { 4, 0}, { 1, 1}, { 7, 4}, { 6, 0}, /* Row 9 */ + { 1, 2}, { 1, 3}, { 1, 0}, + { 1, 1}, { 1, 3}, { 1, 5}, { 5, 0}, { 1, 1}, { 9, 4}, { 4, 0}, { 1, 4}, /* Row 10 */ + { 1, 2}, { 1, 4}, + { 1, 1}, { 1, 3}, { 1, 4}, { 5, 0}, { 1, 1}, { 11, 4}, { 2, 0}, { 1, 4}, /* Row 11 */ + { 1, 2}, { 1, 4}, + { 1, 1}, { 1, 5}, { 1, 1}, { 5, 0}, { 1, 4}, { 9, 2}, { 2, 3}, { 1, 5}, /* Row 12 */ + { 1, 0}, { 1, 4}, { 1, 2}, { 1, 4}, + { 1, 1}, { 1, 3}, { 1, 1}, { 5, 0}, { 1, 4}, { 7, 2}, { 3, 3}, { 1, 5}, /* Row 13 */ + { 2, 0}, { 1, 4}, { 1, 2}, { 1, 4}, + { 1, 1}, { 1, 3}, { 1, 4}, { 5, 0}, { 1, 4}, { 5, 2}, { 3, 3}, { 1, 5}, /* Row 14 */ + { 4, 0}, { 1, 2}, { 1, 3}, { 1, 4}, + { 1, 0}, { 1, 2}, { 1, 3}, { 5, 0}, { 1, 4}, { 3, 2}, { 3, 3}, { 1, 5}, /* Row 15 */ + { 5, 0}, { 1, 1}, { 1, 5}, { 1, 2}, { 1, 0}, + { 2, 0}, { 1, 5}, { 1, 4}, { 4, 0}, { 1, 4}, { 2, 2}, { 2, 3}, { 1, 5}, /* Row 16 */ + { 7, 0}, { 1, 2}, { 1, 5}, { 2, 0}, + { 2, 0}, { 1, 2}, { 1, 5}, { 1, 1}, { 3, 0}, { 1, 4}, { 2, 3}, { 1, 5}, /* Row 17 */ + { 8, 0}, { 1, 1}, { 1, 3}, { 1, 2}, { 2, 0}, + { 3, 0}, { 1, 2}, { 1, 3}, { 3, 0}, { 1, 3}, { 1, 5}, { 9, 0}, { 1, 1}, /* Row 18 */ + { 2, 3}, { 3, 0}, + { 3, 0}, { 1, 1}, { 1, 5}, { 1, 2}, { 2, 0}, { 1, 5}, { 9, 0}, { 1, 1}, /* Row 19 */ + { 1, 4}, { 1, 5}, { 4, 0}, + { 4, 0}, { 1, 1}, { 1, 5}, { 1, 3}, { 10, 0}, { 1, 1}, { 1, 3}, { 1, 5}, /* Row 20 */ + { 5, 0}, + { 6, 0}, { 1, 2}, { 1, 5}, { 1, 4}, { 6, 0}, { 1, 1}, { 1, 2}, { 1, 5}, /* Row 21 */ + { 1, 2}, { 6, 0}, + { 7, 0}, { 1, 3}, { 3, 5}, { 3, 3}, { 2, 5}, { 1, 3}, { 1, 2}, { 7, 0}, /* Row 22 */ + { 9, 0}, { 1, 4}, { 2, 2}, { 1, 3}, { 2, 2}, { 1, 4}, { 9, 0}, /* Row 23 */ + { 25, 0}, /* Row 24 */ +}; + +/******************************************************************************************** + * Public Bitmap Structure Defintions + ********************************************************************************************/ + +const struct NXWidgets::SRlePaletteBitmap NxWM::g_playBitmap = +{ + CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel + CONFIG_NXWIDGETS_FMT, // fmt - Color format + BITMAP_NLUTCODES, // nlut - Number of colors in the lLook-Up Table (LUT) + BITMAP_NCOLUMNS, // width - Width in pixels + BITMAP_NROWS, // height - Height in rows + { // lut - Pointer to the beginning of the Look-Up Table (LUT) + g_playNormalLut, // Index 0: Unselected LUT + g_playBrightlLut, // Index 1: Selected LUT + }, + g_playRleEntries // data - Pointer to the beginning of the RLE data +}; diff --git a/NxWidgets/nxwm/src/glyph_stop.cxx b/NxWidgets/nxwm/src/glyph_stop.cxx index 9081b48a2..a60b75ce8 100644 --- a/NxWidgets/nxwm/src/glyph_stop.cxx +++ b/NxWidgets/nxwm/src/glyph_stop.cxx @@ -70,22 +70,34 @@ using namespace NxWM; #if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32 -static const uint32_t g_stopLut[BITMAP_NLUTCODES] = +static const uint32_t g_stopNormalLut[BITMAP_NLUTCODES] = { 0xd8d8d8, 0xfc6c6c, 0xfcb4b4, 0xd80000, 0xfc0000, 0x902424, 0xfcfcfc, 0xd8fcfc, /* Codes 0-7 */ 0xb40000, 0xb40024, 0xfcd8d8 /* Codes 8-10 */ }; +static const uint32_t g_stopBrightLut[BITMAP_NLUTCODES] = +{ + 0xe1e1e1, 0xfc9090, 0xfcc6c6, 0xe13f3f, 0xfc3f3f, 0xab5a5a, 0xfcfcfc, 0xe1fcfc, /* Codes 0-7 */ + 0xc63f3f, 0xc63f5a, 0xfce1e1 /* Codes 8-10 */ +}; + /* RGB16 (565) Colors (four of the colors in this map are duplicates) */ #elif CONFIG_NXWIDGETS_BPP == 16 -static const uint16_t g_stopLut[BITMAP_NLUTCODES] = +static const uint16_t g_stopNormalLut[BITMAP_NLUTCODES] = { 0xdedb, 0xfb6d, 0xfdb6, 0xd800, 0xf800, 0x9124, 0xffff, 0xdfff, 0xb000, 0xb004, /* Codes 0-9 */ 0xfedb /* Codes 10-10 */ }; +static const uint16_t g_stopBrightLut[BITMAP_NLUTCODES] = +{ + 0xe71c, 0xfc92, 0xfe38, 0xe1e7, 0xf9e7, 0xaacb, 0xffff, 0xe7ff, 0xc1e7, 0xc1eb, /* Codes 0-9 */ + 0xff1c /* Codes 10-10 */ +}; + /* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used * to lookup an 8-bit value. There is no savings in that! It would be better to just put * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these @@ -98,21 +110,30 @@ static const uint16_t g_stopLut[BITMAP_NLUTCODES] = /* 8-bit Greyscale */ -static const uint8_t g_stopLut[BITMAP_NLUTCODES] = +static const uint8_t g_stopNormalLut[BITMAP_NLUTCODES] = { 0xd8, 0x97, 0xc9, 0x40, 0x4b, 0x44, 0xfc, 0xf1, 0x35, 0x39, 0xe2 /* Codes 0-10 */ +}; +static const uint8_t g_stopBrightLut[BITMAP_NLUTCODES] = +{ + 0xe1, 0xb0, 0xd6, 0x6f, 0x77, 0x72, 0xfc, 0xf3, 0x67, 0x6a, 0xe9 /* Codes 0-10 */ }; # else /* CONFIG_NXWIDGETS_GREYSCALE */ /* RGB8 (332) Colors */ -static const nxgl_mxpixel_t g_stopLut[BITMAP_NLUTCODES] = +static const nxgl_mxpixel_t g_stopNormalLut[BITMAP_NLUTCODES] = { 0xdb, 0xed, 0xf6, 0xc0, 0xe0, 0x84, 0xff, 0xdf, 0xa0, 0xa0, 0xfb /* Codes 0-10 */ }; +static const uint8_t g_stopBrightLut[BITMAP_NLUTCODES] = +{ + 0xff, 0xf2, 0xfb, 0xe4, 0xe4, 0xa9, 0xff, 0xff, 0xc4, 0xc5, 0xff /* Codes 0-10 */ +}; + # endif #else # error "Unsupport pixel format" @@ -166,8 +187,8 @@ const struct NXWidgets::SRlePaletteBitmap NxWM::g_stopBitmap = BITMAP_NCOLUMNS, // width - Width in pixels BITMAP_NROWS, // height - Height in rows { // lut - Pointer to the beginning of the Look-Up Table (LUT) - g_stopLut, // Index 0: Unselected LUT - g_stopLut, // Index 1: Selected LUT + g_stopNormalLut, // Index 0: Unselected LUT + g_stopBrightLut, // Index 1: Selected LUT }, g_stopRleEntries // data - Pointer to the beginning of the RLE data }; diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 84f349a46..fa2e7b162 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -2702,3 +2702,10 @@ * Various files. Fix warnings about variables that were initialized by not used. * configs/sim/*/defconfig: Changes to build a 32-bit simulation on a 32-bit platform did not make into all of the Make.defs files. + * graphics/nxmu/nx_move.c: Wrong opcode was being used in the server message; + Also there was an error in the offset calculation. + * graphics/nxglib/fb/nxglib_moverectangle.c: Offset argument is really a + position, not an offset. + * graphics/nxtk/nxtk_drawframe.c: Framed windows are now drawn in three + colors (instead of just two). + diff --git a/nuttx/Documentation/NXGraphicsSubsystem.html b/nuttx/Documentation/NXGraphicsSubsystem.html index 0eb18e54e..857fcd1a4 100644 --- a/nuttx/Documentation/NXGraphicsSubsystem.html +++ b/nuttx/Documentation/NXGraphicsSubsystem.html @@ -12,7 +12,7 @@ <h1><big><font color="#3c34ec"> <i>NX Graphics Subsystem</i> </font></big></h1> - <p>Last Updated: March 25, 2012</p> + <p>Last Updated: May 4, 2012</p> </td> </tr> </table> @@ -3277,11 +3277,13 @@ int nxf_convert_32bpp(FAR uint32_t *dest, uint16_t height, <dt><code>CONFIG_NXTK_BORDERWIDTH</code>: <dd>Specifies with with of the border (in pixels) used with framed windows. The default is 4. - <dt><code>CONFIG_NXTK_BORDERCOLOR1</code> and <code>CONFIG_NXTK_BORDERCOLOR2</code>: + <dt><code>CONFIG_NXTK_BORDERCOLOR1</code>, <code>CONFIG_NXTK_BORDERCOLOR2</code>, and <code>CONFIG_NXTK_BORDERCOLOR3</code>: <dd>Specify the colors of the border used with framed windows. - <dt><code>CONFIG_NXTK_BORDERCOLOR2</code> is the shadow side color and so - <dd>is normally darker. The default is medium and dark grey, - respectively + <dt><code>CONFIG_NXTK_BORDERCOLOR2</code> + <dd>The shadow side color and so is normally darker. + <dt><code>CONFIG_NXTK_BORDERCOLOR3</code> + <dd>The shiny side color and so is normally brighter. + The default is medium, dark, and light grey, respectively <dt><code>CONFIG_NXTK_AUTORAISE</code>: <dd>If set, a window will be raised to the top if the mouse position is over a visible portion of the window. Default: A mouse @@ -4198,6 +4200,7 @@ sudo ln -s libXext.so.6.4.0 libXext.so </tr> <tr> <td align="left" valign="top"><a href="#nxfconvertbpp"><code>nxf_convert_32bpp()</code></a></td> + <td><br></td> <td align="center" bgcolor="skyblue">YES</td> </tr> </table></center> diff --git a/nuttx/configs/sim/nxwm/defconfig b/nuttx/configs/sim/nxwm/defconfig index b5ee1f5f9..37281ec7f 100644 --- a/nuttx/configs/sim/nxwm/defconfig +++ b/nuttx/configs/sim/nxwm/defconfig @@ -454,11 +454,11 @@ CONFIG_NET_RESOLV_ENTRIES=4 # CONFIG_NXTK_BORDERWIDTH # Specifies with with of the border (in pixels) used with # framed windows. The default is 4. -# CONFIG_NXTK_BORDERCOLOR1 and CONFIG_NXTK_BORDERCOLOR2 +# CONFIG_NXTK_BORDERCOLOR1, CONFIG_NXTK_BORDERCOLOR2, CONFIG_NXTK_BORDERCOLOR3 # Specify the colors of the border used with framed windows. -# CONFIG_NXTK_BORDERCOLOR2 is the shadow side color and so -# is normally darker. The default is medium and dark grey, -# respectively +# CONFIG_NXTK_BORDERCOLOR2 is the shadow side color and so is normally darker. +# CONFIG_NXTK_BORDERCOLOR3 is the shiny side color and so is normally brighter. +# The default is mediumdark grey, and light grey, respectively # CONFIG_NXTK_AUTORAISE # If set, a window will be raised to the top if the mouse position # is over a visible portion of the window. Default: A mouse @@ -534,6 +534,7 @@ CONFIG_NX_KBD=y #CONFIG_NXTK_BORDERWIDTH=4 CONFIG_NXTK_BORDERCOLOR1=0x005a96bd CONFIG_NXTK_BORDERCOLOR2=0x00233a49 +CONFIG_NXTK_BORDERCOLOR3=0x00f8f8f8 CONFIG_NXTK_AUTORAISE=n CONFIG_NXFONT_SANS22X29=n CONFIG_NXFONT_SANS23X27=y diff --git a/nuttx/graphics/README.txt b/nuttx/graphics/README.txt index acecfe433..3cd213247 100644 --- a/nuttx/graphics/README.txt +++ b/nuttx/graphics/README.txt @@ -256,10 +256,11 @@ CONFIG_NX_KBD CONFIG_NXTK_BORDERWIDTH Specifies with with of the border (in pixels) used with framed windows. The default is 4. -CONFIG_NXTK_BORDERCOLOR1 and CONFIG_NXTK_BORDERCOLOR2 +CONFIG_NXTK_BORDERCOLOR1, CONFIG_NXTK_BORDERCOLOR2, CONFIG_NXTK_BORDERCOLOR3 Specify the colors of the border used with framed windows. CONFIG_NXTK_BORDERCOLOR2 is the shadow side color and so is normally darker. - The default is medium and dark grey, respectively + CONFIG_NXTK_BORDERCOLOR3 is the shiny side color and so is normally brighter. + The default is mediumdark grey, and light grey, respectively CONFIG_NXTK_AUTORAISE If set, a window will be raised to the top if the mouse position is over a visible portion of the window. Default: A mouse button must be clicked over diff --git a/nuttx/graphics/nxbe/nxbe_move.c b/nuttx/graphics/nxbe/nxbe_move.c index c52151421..193b174c2 100644 --- a/nuttx/graphics/nxbe/nxbe_move.c +++ b/nuttx/graphics/nxbe/nxbe_move.c @@ -1,8 +1,8 @@ /**************************************************************************** * graphics/nxbe/nxbe_move.c * - * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * Copyright (C) 2008-2009, 2011-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 @@ -93,6 +93,8 @@ static void nxbe_clipmovesrc(FAR struct nxbe_clipops_s *cops, if (info->offset.x != 0 || info->offset.y != 0) { + /* Offset is the destination position of the moved rectangle */ + offset.x = rect->pt1.x + info->offset.x; offset.y = rect->pt1.y + info->offset.y; @@ -160,8 +162,7 @@ static void nxbe_clipmovedest(FAR struct nxbe_clipops_s *cops, /* Clip to determine what is inside the bounds */ - nxgl_rectoffset(&tmprect1, rect, -offset.x, -offset.y); - nxgl_rectintersect(&src, &tmprect1, &dstdata->srcrect); + nxgl_rectintersect(&src, rect, &dstdata->srcrect); if (!nxgl_nullrect(&src)) { diff --git a/nuttx/graphics/nxglib/fb/nxglib_moverectangle.c b/nuttx/graphics/nxglib/fb/nxglib_moverectangle.c index d1bcbe7c9..d8e52250c 100644 --- a/nuttx/graphics/nxglib/fb/nxglib_moverectangle.c +++ b/nuttx/graphics/nxglib/fb/nxglib_moverectangle.c @@ -1,8 +1,8 @@ /**************************************************************************** * graphics/nxglib/fb/nxglib_moverectangle.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 @@ -185,14 +185,16 @@ void NXGL_FUNCNAME(nxgl_moverectangle,NXGLIB_SUFFIX) * source position. */ - dline = (FAR uint8_t*)sline - offset->y * stride - NXGL_SCALEX(offset->x); + dline = pinfo->fbmem + offset->y * stride + NXGL_SCALEX(offset->x); /* Case 1: Is the destination position above the displayed position? - * If the Y offset is negative, then the destination is offset to a - * postion below (or to the right) in the source in framebuffer memory. + * If the destination position is less then then the src address, then the + * destination is offset to a postion below (and or to the left) of the + * source in framebuffer memory. */ - if (offset->y < 0 || (offset->y == 0 && offset->x <= 0)) + if (offset->y < rect->pt1.y || + (offset->y < rect->pt1.y && offset->x <= rect->pt1.x)) { /* Yes.. Copy the rectangle from top down (i.e., adding the stride * to move to the next, lower row) */ diff --git a/nuttx/graphics/nxmu/nx_move.c b/nuttx/graphics/nxmu/nx_move.c index 6159ce0ca..3f4a00e2f 100644 --- a/nuttx/graphics/nxmu/nx_move.c +++ b/nuttx/graphics/nxmu/nx_move.c @@ -1,8 +1,8 @@ /**************************************************************************** * graphics/nxmu/nx_move.c * - * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * Copyright (C) 2008-2009, 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 @@ -102,7 +102,7 @@ int nx_move(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, /* Format the fill command */ - outmsg.msgid = NX_SVRMSG_FILL; + outmsg.msgid = NX_SVRMSG_MOVE; outmsg.wnd = wnd; outmsg.offset.x = offset->x; outmsg.offset.y = offset->y; diff --git a/nuttx/graphics/nxtk/nxtk_drawframe.c b/nuttx/graphics/nxtk/nxtk_drawframe.c index edf3dcac8..1ffbf689b 100644 --- a/nuttx/graphics/nxtk/nxtk_drawframe.c +++ b/nuttx/graphics/nxtk/nxtk_drawframe.c @@ -1,8 +1,8 @@ /**************************************************************************** * graphics/nxtk/nxtk_drawframe.c * - * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * Copyright (C) 2008-2009, 2011-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 @@ -114,45 +114,79 @@ int nxtk_drawframe(FAR struct nxtk_framedwindow_s *fwnd, struct nxgl_rect_s frame; struct nxgl_size_s wndsize; struct nxgl_size_s tbsize; + nxgl_coord_t thickness; + + /* Shiny edge: + * Thickness: 1 + * Color: CONFIG_NXTK_BORDERCOLOR3; + * Condition: CONFIG_NXTK_BORDERWIDTH > 2 + * Central part: + * Thickness: Varies with CONFIG_NXTK_BORDERWIDTH + * Color: CONFIG_NXTK_BORDERCOLOR1; + * Condition: CONFIG_NXTK_BORDERWIDTH > 0 + * Shadow part: + * Thickness: 1; + * Color: CONFIG_NXTK_BORDERCOLOR2; + * Condition: CONFIG_NXTK_BORDERWIDTH > 1 + */ + +#if CONFIG_NXTK_BORDERWIDTH > 2 + thickness = CONFIG_NXTK_BORDERWIDTH - 2; +#elif CONFIG_NXTK_BORDERWIDTH > 1 + thickness = CONFIG_NXTK_BORDERWIDTH - 1; +#else + thickness = CONFIG_NXTK_BORDERWIDTH; +#endif /* Get the size of the rectangle */ nxgl_rectsize(&wndsize, &fwnd->wnd.bounds); nxgl_rectsize(&tbsize, &fwnd->tbrect); - /* Draw the top. Thickness: CONFIG_NXTK_BORDERWIDTH-1, Color: - * CONFIG_NXTK_BORDERCOLOR1 - */ + /* Draw the top ***********************************************************/ +#if CONFIG_NXTK_BORDERWIDTH > 0 frame.pt1.x = 0; frame.pt2.x = wndsize.w - 1; - frame.pt1.y = 0; -#if CONFIG_NXTK_BORDERWIDTH > 1 - frame.pt2.y = CONFIG_NXTK_BORDERWIDTH - 2; -#else - frame.pt2.y = CONFIG_NXTK_BORDERWIDTH - 1; + + /* Draw the shiny edge */ + +#if CONFIG_NXTK_BORDERWIDTH > 2 + frame.pt2.y = 0; + nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor3); + frame.pt1.y = 1; #endif + + /* Draw the central part */ + + frame.pt2.y = frame.pt1.y + thickness - 1; nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1); /* Draw a single line under the toolbar, color CONFIG_NXTK_BORDERCOLOR2 */ #if CONFIG_NXTK_BORDERWIDTH > 1 - frame.pt1.y += tbsize.h + CONFIG_NXTK_BORDERWIDTH - 1; + frame.pt1.y += tbsize.h + thickness; frame.pt2.y = frame.pt1.y; nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2); #endif - /* Draw the bottom. First, thickness: CONFIG_NXTK_BORDERWIDTH-1, - * Color: CONFIG_NXTK_BORDERCOLOR1 - */ + /* Draw the bottom ********************************************************/ +#if CONFIG_NXTK_BORDERWIDTH > 0 frame.pt1.y = wndsize.h - CONFIG_NXTK_BORDERWIDTH; -#if CONFIG_NXTK_BORDERWIDTH > 1 - frame.pt2.y = wndsize.h - 2; -#else + + /* Draw the shiny edge */ + +#if CONFIG_NXTK_BORDERWIDTH > 2 frame.pt2.y = frame.pt1.y; + nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor3); + frame.pt1.y ++; #endif + + /* Draw the central part */ + + frame.pt2.y = frame.pt1.y + thickness - 1; nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1); /* Then a single line at the very bottom, Color: CONFIG_NXTK_BORDERCOLOR2 */ @@ -162,75 +196,82 @@ int nxtk_drawframe(FAR struct nxtk_framedwindow_s *fwnd, frame.pt2.y = frame.pt1.y; nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2); #endif +#endif - /* Draw the outer left side. Thickness: CONFIG_NXTK_BORDERWIDTH-1, - * Color: CONFIG_NXTK_BORDERCOLOR1 - */ + /* Draw left and right outer edges *****************************************/ - frame.pt1.y = 0; - frame.pt2.y = wndsize.h - 2; + /* Draw the shiny left out edge */ - frame.pt1.x = 0; #if CONFIG_NXTK_BORDERWIDTH > 1 - frame.pt2.x = CONFIG_NXTK_BORDERWIDTH - 2; -#else + frame.pt1.x = 0; + frame.pt1.y = 1; +#if CONFIG_NXTK_BORDERWIDTH > 2 frame.pt2.x = frame.pt1.x; + frame.pt2.y = wndsize.h - 2; + nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor3); #endif - nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1); - /* Draw the outer right side. Thickness: 1, Color: CONFIG_NXTK_BORDERCOLOR2 */ + /* Draw the shadowed right outer edge */ -#if CONFIG_NXTK_BORDERWIDTH > 1 - frame.pt1.x = wndsize.w - 1; + frame.pt1.x = wndsize.w - 2; frame.pt2.x = frame.pt1.x; nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2); #endif - /* Draw the inner left side, Thickness: 1, Color: CONFIG_NXTK_BORDERCOLOR2. - * This segment stops at the bottom of the toolbar. If there is a - * tool bar, then we have to continue this to the top of the display - * using g_bordercolor1 (see below) - */ + /* Draw left and right central regions *************************************/ -#if CONFIG_NXTK_BORDERWIDTH > 1 - frame.pt1.y = CONFIG_NXTK_BORDERWIDTH - 1 + tbsize.h; +#if CONFIG_NXTK_BORDERWIDTH > 2 + frame.pt1.x = 1; + frame.pt1.y = 1; + frame.pt2.x = frame.pt1.x + thickness - 1; + frame.pt2.y = wndsize.h - 2; #else - frame.pt1.y = CONFIG_NXTK_BORDERWIDTH + tbsize.h; -#endif - frame.pt2.y = wndsize.h - CONFIG_NXTK_BORDERWIDTH - 1; -#if CONFIG_NXTK_BORDERWIDTH > 1 - frame.pt1.x = CONFIG_NXTK_BORDERWIDTH - 1; - frame.pt2.x = frame.pt1.x; - nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2); + frame.pt1.x = 0; + frame.pt1.y = 0; + frame.pt2.x = frame.pt1.x + thickness - 1; + frame.pt2.y = wndsize.h - 1; #endif + nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1); - /* Draw the inner left side, Thickness: CONFIG_NXTK_BORDERWIDTH-1, - * Color: CONFIG_NXTK_BORDERCOLOR1 - */ - -#if CONFIG_NXTK_BORDERWIDTH > 1 - frame.pt1.x = wndsize.w - CONFIG_NXTK_BORDERWIDTH; +#if CONFIG_NXTK_BORDERWIDTH > 2 + frame.pt1.x = wndsize.w - thickness - 1; frame.pt2.x = wndsize.w - 2; #else - frame.pt1.x = wndsize.w - 1; - frame.pt2.x = frame.pt1.x; + frame.pt1.x = wndsize.w - thickness; + frame.pt2.x = wndsize.w - 1; #endif nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1); +#endif - /* When there is a toolbar, we also have to patch in this tiny - * line segment -- Is there a better way? + /* Draw left and right inner sides *****************************************/ + /* This segment stops at the bottom of the toolbar. If there is a + * tool bar, then we have to continue this to the top of the display + * using g_bordercolor1 (see below) */ + /* Draw the shadowed left inner edge */ + #if CONFIG_NXTK_BORDERWIDTH > 1 - if (tbsize.h > 0) - { - frame.pt1.y = 0; - frame.pt2.y = CONFIG_NXTK_BORDERWIDTH + tbsize.h - 2; +#if CONFIG_NXTK_BORDERWIDTH > 2 + frame.pt1.x = thickness + 1; + frame.pt1.y = tbsize.h + thickness + 1; + frame.pt2.x = frame.pt1.x; + frame.pt2.y = wndsize.h - thickness - 2; +#else + frame.pt1.x = thickness; + frame.pt1.y = tbsize.h + thickness; + frame.pt2.x = frame.pt1.x; + frame.pt2.y = wndsize.h - thickness - 1; +#endif + nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2); - frame.pt1.x = CONFIG_NXTK_BORDERWIDTH - 1; - frame.pt2.x = frame.pt1.x; - nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1); - } + /* Draw the shiny right inner edge */ + +#if CONFIG_NXTK_BORDERWIDTH > 2 + frame.pt1.x = wndsize.w - thickness - 2; + frame.pt2.x = frame.pt1.x; + nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor3); +#endif #endif return OK; diff --git a/nuttx/graphics/nxtk/nxtk_internal.h b/nuttx/graphics/nxtk/nxtk_internal.h index 5351048cf..763b1bfe8 100644 --- a/nuttx/graphics/nxtk/nxtk_internal.h +++ b/nuttx/graphics/nxtk/nxtk_internal.h @@ -80,6 +80,18 @@ # endif #endif +#ifndef CONFIG_NXTK_BORDERCOLOR3 +# if !defined(CONFIG_NX_DISABLE_32BPP) || !defined(CONFIG_NX_DISABLE_24BPP) +# define CONFIG_NXTK_BORDERCOLOR3 0x00d9d9d9 +# elif !defined(CONFIG_NX_DISABLE_16BPP) +# define CONFIG_NXTK_BORDERCOLOR3 0xdedb +# elif !defined(CONFIG_NX_DISABLE_4BPP) +# define CONFIG_NXTK_BORDERCOLOR3 8 +# else +# define CONFIG_NXTK_BORDERCOLOR3 'S' +# endif +#endif + /**************************************************************************** * Public Types ****************************************************************************/ @@ -124,6 +136,7 @@ extern FAR const struct nx_callback_s g_nxtkcb; extern nxgl_mxpixel_t g_bordercolor1[CONFIG_NX_NPLANES]; extern nxgl_mxpixel_t g_bordercolor2[CONFIG_NX_NPLANES]; +extern nxgl_mxpixel_t g_bordercolor3[CONFIG_NX_NPLANES]; /**************************************************************************** * Public Function Prototypes diff --git a/nuttx/graphics/nxtk/nxtk_openwindow.c b/nuttx/graphics/nxtk/nxtk_openwindow.c index 3716e63ca..4080b0e7a 100644 --- a/nuttx/graphics/nxtk/nxtk_openwindow.c +++ b/nuttx/graphics/nxtk/nxtk_openwindow.c @@ -68,7 +68,7 @@ nxgl_mxpixel_t g_bordercolor1[CONFIG_NX_NPLANES] = { CONFIG_NXTK_BORDERCOLOR1 #if CONFIG_NX_NPLANES > 1 -# error "Multiple corder colors not defined" +# error "Multiple plane border colors not defined" #endif }; @@ -76,7 +76,15 @@ nxgl_mxpixel_t g_bordercolor2[CONFIG_NX_NPLANES] = { CONFIG_NXTK_BORDERCOLOR2 #if CONFIG_NX_NPLANES > 1 -# error "Multiple border colors not defined" +# error "Multiple plane border colors not defined" +#endif +}; + +nxgl_mxpixel_t g_bordercolor3[CONFIG_NX_NPLANES] = +{ + CONFIG_NXTK_BORDERCOLOR3 +#if CONFIG_NX_NPLANES > 1 +# error "Multiple plane border colors not defined" #endif }; |