NX trapezoid fixes; Various NxWM fixes

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4720 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2012-05-10 16:25:56 +00:00
parent 6e9e0c640b
commit 23897082d9
13 changed files with 417 additions and 320 deletions

View File

@ -82,6 +82,8 @@ struct SNxWmTest
NxWM::CStartWindow *startwindow; // The start window NxWM::CStartWindow *startwindow; // The start window
#ifdef CONFIG_NXWM_TOUCHSCREEN #ifdef CONFIG_NXWM_TOUCHSCREEN
NxWM::CTouchscreen *touchscreen; // The touchscreen NxWM::CTouchscreen *touchscreen; // The touchscreen
NxWM::CCalibration *calibration; // The touchscreen calibration application
struct NxWM::SCalibrationData data; // Calibration data
#endif #endif
unsigned int mmInitial; // Initial memory usage unsigned int mmInitial; // Initial memory usage
unsigned int mmStep; // Memory Usage at beginning of test step unsigned int mmStep; // Memory Usage at beginning of test step
@ -201,7 +203,7 @@ static void initMemoryUsage(void)
// Name: cleanup // Name: cleanup
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
static void test_cleanup(void) static void testCleanUpAndExit(int exitCode)
{ {
#ifdef CONFIG_NXWM_TOUCHSCREEN #ifdef CONFIG_NXWM_TOUCHSCREEN
if (g_nxwmtest.touchscreen) if (g_nxwmtest.touchscreen)
@ -224,6 +226,310 @@ static void test_cleanup(void)
{ {
delete g_nxwmtest.startwindow; delete g_nxwmtest.startwindow;
} }
// And exit
exit(exitCode);
}
/////////////////////////////////////////////////////////////////////////////
// Name: createTaskbar
/////////////////////////////////////////////////////////////////////////////
static bool createTaskbar(void)
{
// Create an instance of the Task Bar.
//
// The general sequence for initializing the task bar is:
//
// 1. Create the CTaskbar instance,
// 2. Call the CTaskbar::connect() method to connect to the NX server (CTaskbar
// inherits the connect method from CNxServer),
// 3. Call the CTaskbar::initWindowManager() method to initialize the task bar.
// 3. Call CTaskBar::startApplication repeatedly to add applications to the task bar
// 4. Call CTaskBar::startWindowManager to start the display with applications in place
printf(MAIN_STRING "Create CTaskbar instance\n");
g_nxwmtest.taskbar = new NxWM::CTaskbar();
if (!g_nxwmtest.taskbar)
{
printf(MAIN_STRING "ERROR: Failed to instantiate CTaskbar\n");
return false;
}
showTestCaseMemory("After create taskbar");
// Connect to the NX server
printf(MAIN_STRING "Connect the CTaskbar instance to the NX server\n");
if (!g_nxwmtest.taskbar->connect())
{
printf(MAIN_STRING "ERROR: Failed to connect the CTaskbar instance to the NX server\n");
return false;
}
showTestCaseMemory("After connecting to the server");
// Initialize the task bar
//
// Taskbar::initWindowManager() prepares the task bar to receive applications.
// CTaskBar::startWindowManager() brings the window manager up with those applications
// in place.
printf(MAIN_STRING "Initialize the CTaskbar instance\n");
if (!g_nxwmtest.taskbar->initWindowManager())
{
printf(MAIN_STRING "ERROR: Failed to intialize the CTaskbar instance\n");
return false;
}
showTestCaseMemory("After initializing window manager");
return true;
}
/////////////////////////////////////////////////////////////////////////////
// Name: createStartWindow
/////////////////////////////////////////////////////////////////////////////
static bool createStartWindow(void)
{
// Create the start window. The general sequence for setting up the start window is:
//
// 1. Call CTaskBar::openApplicationWindow to create a window for the start window,
// 2. Use the window to instantiate Cstartwindow
// 3. Call Cstartwindow::addApplication numerous times to install applications
// in the start window.
// 4. Call CTaskBar::startApplication (initially minimized) to start the start
// window application.
printf(MAIN_STRING "Opening the start window application window\n");
NxWM::CApplicationWindow *window = g_nxwmtest.taskbar->openApplicationWindow();
if (!window)
{
printf(MAIN_STRING "ERROR: Failed to create CApplicationWindow for the start window\n");
return false;
}
showTestCaseMemory("After creating start window application window");
printf(MAIN_STRING "Initialize the CApplicationWindow\n");
if (!window->open())
{
printf(MAIN_STRING "ERROR: Failed to open the CApplicationWindow \n");
delete window;
return false;
}
showTestCaseMemory("After initializing the start window application window");
printf(MAIN_STRING "Creating the start window application\n");
g_nxwmtest.startwindow = new NxWM::CStartWindow(g_nxwmtest.taskbar, window);
if (!g_nxwmtest.startwindow)
{
printf(MAIN_STRING "ERROR: Failed to instantiate CStartWindow\n");
delete window;
return false;
}
// Call CTaskBar::startApplication to start the Calibration application (minimized)
printf(MAIN_STRING "Start the start window application\n");
if (!g_nxwmtest.taskbar->startApplication(g_nxwmtest.startwindow, true))
{
printf(MAIN_STRING "ERROR: Failed to start the start window application\n");
return false;
}
showTestCaseMemory("After starting the start window application");
showTestCaseMemory("After create the start window application");
return true;
}
/////////////////////////////////////////////////////////////////////////////
// Name: startWindowManager
/////////////////////////////////////////////////////////////////////////////
static bool startWindowManager(void)
{
// Start the window manager
printf(MAIN_STRING "Start the window manager\n");
if (!g_nxwmtest.taskbar->startWindowManager())
{
printf(MAIN_STRING "ERROR: Failed to start the window manager\n");
return false;
}
showTestCaseMemory("After starting the window manager");
return true;
}
/////////////////////////////////////////////////////////////////////////////
// Name: createTouchScreen
/////////////////////////////////////////////////////////////////////////////
#ifdef CONFIG_NXWM_TOUCHSCREEN
static bool createTouchScreen(void)
{
// Create the touchscreen device
printf(MAIN_STRING "Creating CTouchscreen\n");
g_nxwmtest.touchscreen = new NxWM::CTouchscreen;
if (!g_nxwmtest.touchscreen)
{
printf(MAIN_STRING "ERROR: Failed to create CTouchscreen\n");
return false;
}
printf(MAIN_STRING "Initialize the CTouchscreen\n");
if (!g_nxwmtest.touchscreen->open())
{
printf(MAIN_STRING "ERROR: Failed to open the CTouchscreen \n");
delete g_nxwmtest.touchscreen;
return false;
}
showTestCaseMemory("After initializing CTouchscreen");
return true;
}
#endif
/////////////////////////////////////////////////////////////////////////////
// Name: createCalibration
/////////////////////////////////////////////////////////////////////////////
#ifdef CONFIG_NXWM_TOUCHSCREEN
static bool createCalibration(void)
{
// 1. Call CTaskBar::FullScreenWindow to create a window for the application,
// 2. Instantiate the application, providing the window to the application's
// constructor,
// 3. Then call CStartWindow::addApplication to add the application to the
// start window.
// 4. Call CTaskBar::startApplication start the application and bring its window to
// the top.
printf(MAIN_STRING "Opening the calibration application window\n");
NxWM::CFullScreenWindow *window = g_nxwmtest.taskbar->openFullScreenWindow();
if (!window)
{
printf(MAIN_STRING "ERROR: Failed to create CFullScreenWindow for the calibration window\n");
return false;
}
showTestCaseMemory("After creating calibration full screen window");
printf(MAIN_STRING "Initialize the CFullScreenWindow\n");
if (!window->open())
{
printf(MAIN_STRING "ERROR: Failed to open the CFullScreenWindow \n");
delete window;
return false;
}
showTestCaseMemory("After initializing the calibration full screen window");
printf(MAIN_STRING "Creating the CCalibration application\n");
g_nxwmtest.calibration = new NxWM::CCalibration(window, g_nxwmtest.touchscreen);
if (!g_nxwmtest.calibration)
{
printf(MAIN_STRING "ERROR: Failed to instantiate CCalibration\n");
delete window;
return false;
}
showTestCaseMemory("After creating the CCalibration application");
printf(MAIN_STRING "Adding the CCalibration application to the start window\n");
if (!g_nxwmtest.startwindow->addApplication(g_nxwmtest.calibration))
{
printf(MAIN_STRING "ERROR: Failed to add CCalibration to the start window\n");
delete g_nxwmtest.calibration;
return false;
}
showTestCaseMemory("After adding the CCalibration application");
return true;
}
#endif
/////////////////////////////////////////////////////////////////////////////
// Name: runCalibration
/////////////////////////////////////////////////////////////////////////////
#ifdef CONFIG_NXWM_TOUCHSCREEN
static bool runCalibration(void)
{
// Call CTaskBar::startApplication to start the Calibration application
printf(MAIN_STRING "Start the calibration application\n");
if (!g_nxwmtest.taskbar->startApplication(g_nxwmtest.calibration, false))
{
printf(MAIN_STRING "ERROR: Failed to start the calibration application\n");
return false;
}
showTestCaseMemory("After starting the start window application");
// Wait for calibration data
printf(MAIN_STRING "Get calibration data\n");
if (!g_nxwmtest.calibration->waitCalibrationData(g_nxwmtest.data))
{
printf(MAIN_STRING "ERROR: Failed to get calibration data\n");
return false;
}
printf(MAIN_STRING "Stop the calibration application\n");
if (!g_nxwmtest.taskbar->stopApplication(g_nxwmtest.calibration))
{
printf(MAIN_STRING "ERROR: Failed to stop the calibration application\n");
return false;
}
showTestCaseMemory("After stopping the calibration application");
return true;
}
#endif
/////////////////////////////////////////////////////////////////////////////
// Name: createNxConsole
/////////////////////////////////////////////////////////////////////////////
static bool createNxConsole(void)
{
// Add the NxConsole application to the start window
printf(MAIN_STRING "Opening the NxConsole application window\n");
NxWM::CApplicationWindow *window = g_nxwmtest.taskbar->openApplicationWindow();
if (!window)
{
printf(MAIN_STRING "ERROR: Failed to create CApplicationWindow for the NxConsole\n");
return false;
}
showTestCaseMemory("After creating the NxConsole application window");
printf(MAIN_STRING "Initialize the CApplicationWindow\n");
if (!window->open())
{
printf(MAIN_STRING "ERROR: Failed to open the CApplicationWindow \n");
delete window;
return false;
}
showTestCaseMemory("After initializing the NxConsole application window");
printf(MAIN_STRING "Creating the NxConsole application\n");
NxWM::CNxConsole *console = new NxWM::CNxConsole(g_nxwmtest.taskbar, window);
if (!console)
{
printf(MAIN_STRING "ERROR: Failed to instantiate CNxConsole\n");
delete window;
return false;
}
showTestCaseMemory("After creating the NxConsole application");
printf(MAIN_STRING "Adding the NxConsole application to the start window\n");
if (!g_nxwmtest.startwindow->addApplication(console))
{
printf(MAIN_STRING "ERROR: Failed to add CNxConsole to the start window\n");
delete console;
return false;
}
showTestCaseMemory("After adding the NxConsole application");
return true;
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -273,308 +579,75 @@ int MAIN_NAME(int argc, char *argv[])
} }
showTestCaseMemory("After initializing the NSH library"); showTestCaseMemory("After initializing the NSH library");
// Create an instance of the Task Bar. // Create the task bar.
//
// The general sequence for initializing the task bar is:
//
// 1. Create the CTaskbar instance,
// 2. Call the CTaskbar::connect() method to connect to the NX server (CTaskbar
// inherits the connect method from CNxServer),
// 3. Call the CTaskbar::initWindowManager() method to initialize the task bar.
// 3. Call CTaskBar::startApplication repeatedly to add applications to the task bar
// 4. Call CTaskBar::startWindowManager to start the display with applications in place
printf(MAIN_STRING "Create CTaskbar instance\n"); if (!createTaskbar())
g_nxwmtest.taskbar = new NxWM::CTaskbar();
if (!g_nxwmtest.taskbar)
{ {
printf(MAIN_STRING "ERROR: Failed to instantiate CTaskbar\n"); printf(MAIN_STRING "Failed to create the task bar\n");
return EXIT_FAILURE; testCleanUpAndExit(EXIT_FAILURE);
} }
showTestCaseMemory("After create taskbar");
// Connect to the NX server // Create the start window.
printf(MAIN_STRING "Connect the CTaskbar instance to the NX server\n"); if (!createStartWindow())
if (!g_nxwmtest.taskbar->connect())
{ {
printf(MAIN_STRING "ERROR: Failed to connect the CTaskbar instance to the NX server\n"); printf(MAIN_STRING "Failed to create the start window\n");
test_cleanup(); testCleanUpAndExit(EXIT_FAILURE);
return EXIT_FAILURE;
} }
showTestCaseMemory("After connecting to the server");
// Initialize the task bar // Create the touchscreen device
//
// Taskbar::initWindowManager() prepares the task bar to receive applications.
// CTaskBar::startWindowManager() brings the window manager up with those applications
// in place.
printf(MAIN_STRING "Initialize the CTaskbar instance\n"); #ifdef CONFIG_NXWM_TOUCHSCREEN
if (!g_nxwmtest.taskbar->initWindowManager()) if (!createTouchScreen())
{ {
printf(MAIN_STRING "ERROR: Failed to intialize the CTaskbar instance\n"); printf(MAIN_STRING "Failed to create the start window\n");
test_cleanup(); testCleanUpAndExit(EXIT_FAILURE);
return EXIT_FAILURE;
} }
showTestCaseMemory("After initializing window manager"); #endif
// Create the start window. The general sequence for setting up the start window is:
//
// 1. Call CTaskBar::openApplicationWindow to create a window for the start window,
// 2. Use the window to instantiate Cstartwindow
// 3. Call Cstartwindow::addApplication numerous times to install applications
// in the start window.
// 4. Call CTaskBar::startApplication (initially minimized) to start the start
// window application.
printf(MAIN_STRING "Opening the start window application window\n");
NxWM::CApplicationWindow *window = g_nxwmtest.taskbar->openApplicationWindow();
if (!window)
{
printf(MAIN_STRING "ERROR: Failed to create CApplicationWindow for the start window\n");
test_cleanup();
return EXIT_FAILURE;
}
showTestCaseMemory("After creating start window application window");
printf(MAIN_STRING "Initialize the CApplicationWindow\n");
if (!window->open())
{
printf(MAIN_STRING "ERROR: Failed to open the CApplicationWindow \n");
delete window;
test_cleanup();
return EXIT_FAILURE;
}
showTestCaseMemory("After initializing the start window application window");
printf(MAIN_STRING "Creating the start window application\n");
g_nxwmtest.startwindow = new NxWM::CStartWindow(g_nxwmtest.taskbar, window);
if (!g_nxwmtest.startwindow)
{
printf(MAIN_STRING "ERROR: Failed to instantiate CStartWindow\n");
delete window;
test_cleanup();
return EXIT_FAILURE;
}
showTestCaseMemory("After create the start window application");
// Perform touchscreen calibration // Perform touchscreen calibration
#ifdef CONFIG_NXWM_TOUCHSCREEN #ifdef CONFIG_NXWM_TOUCHSCREEN
// Start the window manager before adding applications
printf(MAIN_STRING "Start the window manager\n");
if (!g_nxwmtest.taskbar->startWindowManager())
{
printf(MAIN_STRING "ERROR: Failed to start the window manager\n");
test_cleanup();
return EXIT_FAILURE;
}
showTestCaseMemory("After starting the window manager");
// Perform touchscreen calibration
NxWM::CCalibration *calibration = (NxWM::CCalibration *)0; // Avoid compiler complaint
NxWM::CFullScreenWindow *fullscreen = (NxWM::CFullScreenWindow *)0; // Avoid compiler complaint
// Create the touchscreen device // Create the touchscreen device
printf(MAIN_STRING "Creating CTouchscreen\n"); if (!createTouchScreen())
g_nxwmtest.touchscreen = new NxWM::CTouchscreen;
if (!g_nxwmtest.touchscreen)
{ {
printf(MAIN_STRING "ERROR: Failed to create CTouchscreen\n"); printf(MAIN_STRING "Failed to create the touchscreen\n");
goto nocalibration; testCleanUpAndExit(EXIT_FAILURE);
} }
printf(MAIN_STRING "Initialize the CTouchscreen\n"); // Create the calibration application
if (!g_nxwmtest.touchscreen->open())
if (!createCalibration())
{ {
printf(MAIN_STRING "ERROR: Failed to open the CTouchscreen \n"); printf(MAIN_STRING "Failed to create the calibration application\n");
delete g_nxwmtest.touchscreen; testCleanUpAndExit(EXIT_FAILURE);
goto nocalibration;
}
showTestCaseMemory("After initializing CTouchscreen");
// 1. Call CTaskBar::FullScreenWindow to create a window for the application,
// 2. Instantiate the application, providing the window to the application's
// constructor,
// 3. Then call CStartWindow::addApplication to add the application to the
// start window.
// 4. Call CTaskBar::startApplication start the application and bring its window to
// the top.
printf(MAIN_STRING "Opening the calibrationapplication window\n");
fullscreen = g_nxwmtest.taskbar->openFullScreenWindow();
if (!fullscreen)
{
printf(MAIN_STRING "ERROR: Failed to create CFullScreenWindow for the calibration window\n");
goto nocalibration;
}
showTestCaseMemory("After creating calibration full screen window");
printf(MAIN_STRING "Initialize the CFullScreenWindow\n");
if (!fullscreen->open())
{
printf(MAIN_STRING "ERROR: Failed to open the CFullScreenWindow \n");
delete fullscreen;
goto nocalibration;
}
showTestCaseMemory("After initializing the calibration full screen window");
printf(MAIN_STRING "Creating the CCalibration application\n");
calibration = new NxWM::CCalibration(fullscreen, g_nxwmtest.touchscreen);
if (!calibration)
{
printf(MAIN_STRING "ERROR: Failed to instantiate CCalibration\n");
delete fullscreen;
goto nocalibration;
}
showTestCaseMemory("After creating the CCalibration application");
printf(MAIN_STRING "Adding the CCalibration application to the start window\n");
if (!g_nxwmtest.startwindow->addApplication(calibration))
{
printf(MAIN_STRING "ERROR: Failed to add CCalibration to the start window\n");
delete calibration;
goto nocalibration;
}
showTestCaseMemory("After adding the CCalibration application");
// Call CTaskBar::startApplication to start the Calibration application
printf(MAIN_STRING "Start the start window application\n");
if (!g_nxwmtest.taskbar->startApplication(calibration, false))
{
printf(MAIN_STRING "ERROR: Failed to start the calibration application\n");
goto nocalibration;
}
showTestCaseMemory("After starting the start window application");
// Wait for calibration data
printf(MAIN_STRING "Get calibration data\n");
struct NxWM::SCalibrationData data;
if (!calibration->waitCalibrationData(data))
{
printf(MAIN_STRING "ERROR: Failed to get calibration data\n");
} }
nocalibration: // Run the touchscreen calibration application
if (!runCalibration())
{
printf(MAIN_STRING "Touchscreen Calibration failed\n");
testCleanUpAndExit(EXIT_FAILURE);
}
#endif #endif
// Add the NxConsole application to the start window // Add the NxConsole application to the start window
NxWM::CNxConsole *console = (NxWM::CNxConsole *)0; // Avoid compiler complaint if (!createNxConsole())
printf(MAIN_STRING "Opening the NxConsole application window\n");
window = g_nxwmtest.taskbar->openApplicationWindow();
if (!window)
{ {
printf(MAIN_STRING "ERROR: Failed to create CApplicationWindow for the NxConsole\n"); printf(MAIN_STRING "Failed to create the NxConsole application\n");
goto noconsole; testCleanUpAndExit(EXIT_FAILURE);
} }
showTestCaseMemory("After creating the NxConsole application window");
printf(MAIN_STRING "Initialize the CApplicationWindow\n");
if (!window->open())
{
printf(MAIN_STRING "ERROR: Failed to open the CApplicationWindow \n");
delete window;
goto noconsole;
}
showTestCaseMemory("After initializing the NxConsole application window");
printf(MAIN_STRING "Creating the NxConsole application\n");
console = new NxWM::CNxConsole(g_nxwmtest.taskbar, window);
if (!console)
{
printf(MAIN_STRING "ERROR: Failed to instantiate CNxConsole\n");
delete window;
goto noconsole;
}
showTestCaseMemory("After creating the NxConsole application");
printf(MAIN_STRING "Adding the NxConsole application to the start window\n");
if (!g_nxwmtest.startwindow->addApplication(console))
{
printf(MAIN_STRING "ERROR: Failed to add CNxConsole to the start window\n");
delete window;
}
showTestCaseMemory("After adding the NxConsole application");
noconsole:
// Add the calculator application to the start window
#if 0
NxWM::CCalculator *calculator = (NxWM::CCalculator *)0; // Avoid compiler complaint
printf(MAIN_STRING "Opening the calculator application window\n");
window = g_nxwmtest.taskbar->openApplicationWindow();
if (!window)
{
printf(MAIN_STRING "ERROR: Failed to create CApplicationWindow for the calculator\n");
goto nocalculator;
}
showTestCaseMemory("After creating the calculator application window");
printf(MAIN_STRING "Initialize the CApplicationWindow\n");
if (!window->open())
{
printf(MAIN_STRING "ERROR: Failed to open the CApplicationWindow \n");
delete window;
test_cleanup();
return EXIT_FAILURE;
}
showTestCaseMemory("After creating the initializing application window");
printf(MAIN_STRING "Creating the calculator application\n");
calculator = new NxWM::CCalculator(g_nxwmtest.taskbar, window);
if (!calculator)
{
printf(MAIN_STRING "ERROR: Failed to instantiate calculator\n");
delete window;
goto nocalculator;
}
showTestCaseMemory("After creating the calculator application");
printf(MAIN_STRING "Adding the calculator application to the start window\n");
if (!g_nxwmtest.startwindow->addApplication(calculator))
{
printf(MAIN_STRING "ERROR: Failed to add calculator to the start window\n");
delete window;
}
showTestCaseMemory("After adding the calculator application");
nocalculator:
#endif
// Call CTaskBar::startApplication to start the start window application. The initial
// state of the start window is minimized.
printf(MAIN_STRING "Start the start window application\n");
if (!g_nxwmtest.taskbar->startApplication(g_nxwmtest.startwindow, true))
{
printf(MAIN_STRING "ERROR: Failed to start the start window application\n");
test_cleanup();
return EXIT_FAILURE;
}
showTestCaseMemory("After starting the start window application");
// Call CTaskBar::startWindowManager to start the display with applications in place. // Call CTaskBar::startWindowManager to start the display with applications in place.
#ifndef CONFIG_NXWM_TOUCHSCREEN if (!startWindowManager())
printf(MAIN_STRING "Start the window manager\n");
if (!g_nxwmtest.taskbar->startWindowManager())
{ {
printf(MAIN_STRING "ERROR: Failed to start the window manager\n"); printf(MAIN_STRING "Failed to start the window manager\n");
test_cleanup(); testCleanUpAndExit(EXIT_FAILURE);
return EXIT_FAILURE;
} }
showTestCaseMemory("After starting the window manager");
#endif
// Wait a little bit for the display to stabilize. The simulation pressing of // Wait a little bit for the display to stabilize. The simulation pressing of
// the 'start window' icon in the task bar // the 'start window' icon in the task bar

View File

@ -102,12 +102,6 @@ namespace NxWM
void close(void); void close(void);
/**
* CNxConsole destructor
*/
~CNxConsole(void);
public: public:
/** /**
* CNxConsole constructor * CNxConsole constructor
@ -120,6 +114,12 @@ namespace NxWM
CNxConsole(CTaskbar *taskbar, CApplicationWindow *window); CNxConsole(CTaskbar *taskbar, CApplicationWindow *window);
/**
* CNxConsole destructor
*/
~CNxConsole(void);
/** /**
* Each implementation of IApplication must provide a method to recover * Each implementation of IApplication must provide a method to recover
* the contained CApplicationWindow instance. * the contained CApplicationWindow instance.

View File

@ -177,6 +177,9 @@ bool CCalibration::run(void)
void CCalibration::stop(void) void CCalibration::stop(void)
{ {
// The main thread is stuck waiting for the next touchscreen input...
// So this is probably just a waste of good FLASH space.
m_stop = true; m_stop = true;
} }

View File

@ -886,6 +886,12 @@ bool CTaskbar::redrawTaskbarWindow(void)
return false; return false;
} }
// Raise the task bar to the top of the display. This is only necessary
// after stopping a full screen application. Other applications do not
// overlap the task bar and, hence, do not interfere.
m_taskbar->raise();
// Fill the entire window with the background color // Fill the entire window with the background color
port->drawFilledRect(0, 0, windowSize.w, windowSize.h, port->drawFilledRect(0, 0, windowSize.w, windowSize.h,

View File

@ -2724,5 +2724,7 @@
the STMPE11 I/O expander on the STM3240G-EVAL board. Verfied that the the STMPE11 I/O expander on the STM3240G-EVAL board. Verfied that the
STM3240G-EVAL touchscreen is now fully functional. STM3240G-EVAL touchscreen is now fully functional.
* include/cxx/cfcntl: Added std:: header file. * include/cxx/cfcntl: Added std:: header file.
* graphics/nxbe/nxbe_filltrapezoid.c and graphics/nxglib/fb/nxglib_filltrapezoid.c:
Fix several errors in the trapezoid fill logic.

View File

@ -316,7 +316,7 @@ CONFIG_STDIO_BUFFER_SIZE=256
CONFIG_STDIO_LINEBUFFER=y CONFIG_STDIO_LINEBUFFER=y
CONFIG_NUNGET_CHARS=2 CONFIG_NUNGET_CHARS=2
CONFIG_PREALLOC_MQ_MSGS=32 CONFIG_PREALLOC_MQ_MSGS=32
CONFIG_MQ_MAXMSGSIZE=32 CONFIG_MQ_MAXMSGSIZE=48
CONFIG_MAX_WDOGPARMS=4 CONFIG_MAX_WDOGPARMS=4
CONFIG_PREALLOC_WDOGS=32 CONFIG_PREALLOC_WDOGS=32
CONFIG_PREALLOC_TIMERS=8 CONFIG_PREALLOC_TIMERS=8

View File

@ -1323,7 +1323,7 @@ CONFIG_LCD_RPORTRAIT=y
# STM3240G-EVAL specific LCD settings # STM3240G-EVAL specific LCD settings
# #
CONFIG_STM32_ILI9320_DISABLE=n CONFIG_STM32_ILI9320_DISABLE=n
CONFIG_STM32_ILI9325_DISABLE=y CONFIG_STM32_ILI9325_DISABLE=n
# #
# Settings for examples/uip # Settings for examples/uip

View File

@ -709,7 +709,7 @@ CONFIG_STDIO_BUFFER_SIZE=64
CONFIG_STDIO_LINEBUFFER=y CONFIG_STDIO_LINEBUFFER=y
CONFIG_NUNGET_CHARS=2 CONFIG_NUNGET_CHARS=2
CONFIG_PREALLOC_MQ_MSGS=8 CONFIG_PREALLOC_MQ_MSGS=8
CONFIG_MQ_MAXMSGSIZE=32 CONFIG_MQ_MAXMSGSIZE=48
CONFIG_MAX_WDOGPARMS=2 CONFIG_MAX_WDOGPARMS=2
CONFIG_PREALLOC_WDOGS=8 CONFIG_PREALLOC_WDOGS=8
CONFIG_PREALLOC_TIMERS=4 CONFIG_PREALLOC_TIMERS=4
@ -1347,7 +1347,7 @@ CONFIG_LCD_RPORTRAIT=n
# STM3240G-EVAL specific LCD settings # STM3240G-EVAL specific LCD settings
# #
CONFIG_STM32_ILI9320_DISABLE=n CONFIG_STM32_ILI9320_DISABLE=n
CONFIG_STM32_ILI9325_DISABLE=y CONFIG_STM32_ILI9325_DISABLE=n
# #
# Settings for examples/uip # Settings for examples/uip

View File

@ -1,8 +1,8 @@
/**************************************************************************** /****************************************************************************
* graphics/nxbe/nxbe_filltrapezoid.c * graphics/nxbe/nxbe_filltrapezoid.c
* *
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@ -140,7 +140,7 @@ void nxbe_filltrapezoid(FAR struct nxbe_window_s *wnd,
/* Clip to any user specified clipping window */ /* Clip to any user specified clipping window */
if (clip && !nxgl_nullrect(clip)) if (clip)
{ {
struct nxgl_rect_s tmp; struct nxgl_rect_s tmp;
nxgl_rectoffset(&tmp, clip, wnd->bounds.pt1.x, wnd->bounds.pt1.y); nxgl_rectoffset(&tmp, clip, wnd->bounds.pt1.x, wnd->bounds.pt1.y);
@ -157,8 +157,6 @@ void nxbe_filltrapezoid(FAR struct nxbe_window_s *wnd,
info.cops.visible = nxbe_clipfilltrapezoid; info.cops.visible = nxbe_clipfilltrapezoid;
info.cops.obscured = nxbe_clipnull; info.cops.obscured = nxbe_clipnull;
nxgl_trapcopy(&info.trap, trap);
/* Then process each color plane */ /* Then process each color plane */
#if CONFIG_NX_NPLANES > 1 #if CONFIG_NX_NPLANES > 1

View File

@ -93,6 +93,7 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)(
{ {
unsigned int stride; unsigned int stride;
unsigned int width; unsigned int width;
FAR uint8_t *dest;
FAR uint8_t *line; FAR uint8_t *line;
int nrows; int nrows;
b16_t x1; b16_t x1;
@ -103,7 +104,6 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)(
b16_t dx2dy; b16_t dx2dy;
#if NXGLIB_BITSPERPIXEL < 8 #if NXGLIB_BITSPERPIXEL < 8
FAR uint8_t *dest;
uint8_t mpixel = NXGL_MULTIPIXEL(color); uint8_t mpixel = NXGL_MULTIPIXEL(color);
uint8_t mask; uint8_t mask;
int lnlen; int lnlen;
@ -191,11 +191,10 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)(
ngl_swap(dx1dy, dx2dy, tmp); ngl_swap(dx1dy, dx2dy, tmp);
} }
/* Convert the positions to integer and get the run width */ /* Convert the positions to integer */
ix1 = b16toi(x1); ix1 = b16toi(x1);
ix2 = b16toi(x2); ix2 = b16toi(x2);
width = ix2 - ix1 + 1;
/* Handle some corner cases where we draw nothing. Otherwise, we will /* Handle some corner cases where we draw nothing. Otherwise, we will
* always draw at least one pixel. * always draw at least one pixel.
@ -211,6 +210,10 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)(
ix1 = ngl_clipl(ix1, bounds->pt1.x); ix1 = ngl_clipl(ix1, bounds->pt1.x);
ix2 = ngl_clipr(ix2, bounds->pt2.x); ix2 = ngl_clipr(ix2, bounds->pt2.x);
/* Get the run length for the clipped row */
width = ix2 - ix1 + 1;
#if NXGLIB_BITSPERPIXEL < 8 #if NXGLIB_BITSPERPIXEL < 8
/* Handle masking of the fractional initial byte */ /* Handle masking of the fractional initial byte */
@ -253,7 +256,8 @@ void NXGL_FUNCNAME(nxgl_filltrapezoid,NXGLIB_SUFFIX)(
#else #else
/* Then draw the run from (line + ix1) to (line + ix2) */ /* 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 #endif
} }

View File

@ -111,17 +111,17 @@
# define NXGL_MEMSET(dest,value,width) \ # 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); \ int _nby = NXGL_SCALEX(width); \
while (_nby--) \ while (_nby--) \
{ \ { \
*_ptr++ = value; \ *_ptr++ = (value); \
} \ } \
} }
# define NXGL_MEMCPY(dest,src,width) \ # define NXGL_MEMCPY(dest,src,width) \
{ \ { \
FAR uint8_t *_dptr = (FAR uint8_t*)dest; \ FAR uint8_t *_dptr = (FAR uint8_t*)(dest); \
FAR uint8_t *_sptr = (FAR uint8_t*)src; \ FAR uint8_t *_sptr = (FAR uint8_t*)(src); \
int _nby = NXGL_SCALEX(width); \ int _nby = NXGL_SCALEX(width); \
while (_nby--) \ while (_nby--) \
{ \ { \
@ -132,20 +132,20 @@
#elif NXGLIB_BITSPERPIXEL == 24 #elif NXGLIB_BITSPERPIXEL == 24
# define NXGL_MEMSET(dest,value,width) \ # define NXGL_MEMSET(dest,value,width) \
{ \ { \
FAR uint8_t *_ptr = (FAR uint8_t*)dest; \ FAR uint8_t *_ptr = (FAR uint8_t*)(dest); \
nxgl_coord_t _npix = width; \ nxgl_coord_t _npix = (width); \
while (_npix--) \ while (_npix--) \
{ \ { \
*_ptr++ = value; \ *_ptr++ = (value); \
*_ptr++ = value >> 8; \ *_ptr++ = (value) >> 8; \
*_ptr++ = value >> 16; \ *_ptr++ = (value) >> 16; \
} \ } \
} }
# define NXGL_MEMCPY(dest,src,width) \ # define NXGL_MEMCPY(dest,src,width) \
{ \ { \
FAR uint8_t *_dptr = (FAR uint8_t*)dest; \ FAR uint8_t *_dptr = (FAR uint8_t*)(dest); \
FAR uint8_t *_sptr = (FAR uint8_t*)src; \ FAR uint8_t *_sptr = (FAR uint8_t*)(src); \
nxgl_coord_t _npix = width; \ nxgl_coord_t _npix = (width); \
while (_npix--) \ while (_npix--) \
{ \ { \
*_dptr++ = *_sptr++; \ *_dptr++ = *_sptr++; \
@ -156,18 +156,18 @@
#else #else
# define NXGL_MEMSET(dest,value,width) \ # define NXGL_MEMSET(dest,value,width) \
{ \ { \
FAR NXGL_PIXEL_T *_ptr = (FAR NXGL_PIXEL_T*)dest; \ FAR NXGL_PIXEL_T *_ptr = (FAR NXGL_PIXEL_T*)(dest); \
nxgl_coord_t _npix = width; \ nxgl_coord_t _npix = (width); \
while (_npix--) \ while (_npix--) \
{ \ { \
*_ptr++ = value; \ *_ptr++ = (value); \
} \ } \
} }
# define NXGL_MEMCPY(dest,src,width) \ # define NXGL_MEMCPY(dest,src,width) \
{ \ { \
FAR NXGL_PIXEL_T *_dptr = (FAR NXGL_PIXEL_T*)dest; \ FAR NXGL_PIXEL_T *_dptr = (FAR NXGL_PIXEL_T*)(dest); \
FAR NXGL_PIXEL_T *_sptr = (FAR NXGL_PIXEL_T*)src; \ FAR NXGL_PIXEL_T *_sptr = (FAR NXGL_PIXEL_T*)(src); \
nxgl_coord_t _npix = width; \ nxgl_coord_t _npix = (width); \
while (_npix--) \ while (_npix--) \
{ \ { \
*_dptr++ = *_sptr++; \ *_dptr++ = *_sptr++; \

View File

@ -1,8 +1,8 @@
/**************************************************************************** /****************************************************************************
* graphics/nxglib/nxsglib_nullrect.c * graphics/nxglib/nxsglib_nullrect.c
* *
* Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions

View File

@ -1,8 +1,8 @@
/**************************************************************************** /****************************************************************************
* graphics/nxmu/nx_filltrapezoid.c * graphics/nxmu/nx_filltrapezoid.c
* *
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@ -98,6 +98,8 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip,
int ret; int ret;
int i; int i;
/* Some debug-only sanity checks */
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
if (!wnd || !wnd->conn || !trap || !color) if (!wnd || !wnd->conn || !trap || !color)
{ {
@ -111,22 +113,31 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip,
outmsg.msgid = NX_SVRMSG_FILLTRAP; outmsg.msgid = NX_SVRMSG_FILLTRAP;
outmsg.wnd = wnd; outmsg.wnd = wnd;
/* If no clipping window was provided, then use the size of the entire window */
if (clip) if (clip)
{ {
nxgl_rectcopy(&outmsg.clip, clip); nxgl_rectcopy(&outmsg.clip, clip);
} }
else else
{ {
memset(&outmsg.clip, 0, sizeof(struct nxgl_rect_s)); nxgl_rectcopy(&outmsg.clip, &wnd->bounds);
} }
/* Copy the trapezod and the color into the message */
nxgl_trapcopy(&outmsg.trap, trap); nxgl_trapcopy(&outmsg.trap, trap);
#if CONFIG_NX_NPLANES > 1
for (i = 0; i < CONFIG_NX_NPLANES; i++) for (i = 0; i < CONFIG_NX_NPLANES; i++)
#else
i = 0;
#endif
{ {
outmsg.color[i] = color[i]; outmsg.color[i] = color[i];
} }
/* Forward the fill command to the server */ /* Forward the trapezoid fill command to the server */
ret = mq_send(wnd->conn->cwrmq, &outmsg, ret = mq_send(wnd->conn->cwrmq, &outmsg,
sizeof(struct nxsvrmsg_filltrapezoid_s), NX_SVRMSG_PRIO); sizeof(struct nxsvrmsg_filltrapezoid_s), NX_SVRMSG_PRIO);