diff --git a/Documentation/NXGraphicsSubsystem.html b/Documentation/NXGraphicsSubsystem.html
index 57c24097e1e..1cfa3a63c94 100644
--- a/Documentation/NXGraphicsSubsystem.html
+++ b/Documentation/NXGraphicsSubsystem.html
@@ -12,7 +12,7 @@
NX Graphics Subsystem
- Last Updated: March 10, 2019
+ Last Updated: March 13, 2019
@@ -1348,7 +1348,7 @@ int nx_eventnotify(NXHANDLE handle, int signo);
#include <nuttx/nx/nxglib.h>
#include <nuttx/nx/nx.h>
-NXWINDOW nx_openwindow(NXHANDLE handle,
+NXWINDOW nx_openwindow(NXHANDLE handle, uint8_t flags,
FAR const struct nx_callback_s *cb,
FAR void *arg);
@@ -1360,6 +1360,10 @@ NXWINDOW nx_openwindow(NXHANDLE handle,
handle
- The handle returned by
nx_connect().
+ flags
+ - Optional flags.
+ Must be zero unless
CONFIG_NX_RAMBACKED is enabled.
+ In that case, it may be zero or NXBE_WINDOW_RAMBACKED.
cb
- Callbacks used to process window events
arg
@@ -2073,7 +2077,7 @@ typedef FAR void *NXTKWINDOW;
#include <nuttx/nx/nx.h>
#include <nuttx/nx/nxtk.h>
-NXTKWINDOW nxtk_openwindow(NXHANDLE handle,
+NXTKWINDOW nxtk_openwindow(NXHANDLE handle, uint8_t flags,
FAR const struct nx_callback_s *cb,
FAR void *arg);
@@ -2085,6 +2089,10 @@ NXTKWINDOW nxtk_openwindow(NXHANDLE handle,
handle
- The handle returned by
nx_connect().
+ flags
+ - Optional flags.
+ Must be zero unless
CONFIG_NX_RAMBACKED is enabled.
+ In that case, it may be zero or NXBE_WINDOW_RAMBACKED.
cb
- Callbacks used to process window events
arg
@@ -3243,7 +3251,20 @@ int nxf_convert_32bpp(FAR uint32_t *dest, uint16_t height,
CONFIG_NX
- Enables overall support for graphics library and NX
+ - Enables overall support for graphics library and NX
+
CONFIG_NX_RAMBACKED
+ - Enables RAM backed window support.
+ If this option is selected, then windows may be optionally created with a RAM frambuffer backing up the window content.
+ Rending into the window will result in rending into the backup framebuffer, then updating the physical display from the framebuffer.
+
+ The advantage of this option is that the application that manages window will no longer receive redraw() callbacks.
+ Those calls normally occur, for example, when a window "above" moves exposing a portion of the window below.
+ If this option is selected, then the system will redraw the exposed portion of the window from the backup framebuffer without intervention of the window applications.
+ This greatly reduces the complexity of the application and performance of the window at the expense of increased memory usage.
+
+
+ Redraw requests in other cases are also suppressed: Changes to window position, size, etc.
+
diff --git a/graphics/Kconfig b/graphics/Kconfig
index cbb3fc9ac59..1221d89fa5e 100644
--- a/graphics/Kconfig
+++ b/graphics/Kconfig
@@ -42,6 +42,28 @@ config NX_NPLANES
are willing to debug a lot of untested logic), this value should be
set to 1.
+config NX_RAMBACKED
+ bool "RAM backed windows"
+ default n
+ depends on EXPERIMENTAL
+ ---help---
+ If this option is selected, then windows may be optionally created
+ with a RAM frambuffer backing up the window content. Rending into
+ the window will result in rending into the backup framebuffer, then
+ updating the physical display from the framebuffer.
+
+ The advantage of this option is that the application that manages
+ window will no longer receive redraw() callbacks. Those calls
+ normally occur when a window "above" moves exposing a portion of the
+ window below. If this option is selected, then the system will
+ redraw the exposed portion of the window from the backup framebuffer
+ without intervention of the window applications. This greatly
+ reduces the complexity of the application and performance of the
+ window at the expense of increased memory usage.
+
+ Redraw requests in other cases are also suppressed: Changes to window
+ position, size, etc.
+
config NX_BGCOLOR
hex "Initial background color"
default 0x0
diff --git a/graphics/nxmu/nxmu_openwindow.c b/graphics/nxmu/nxmu_openwindow.c
index 780732d1264..fae62d7e6b6 100644
--- a/graphics/nxmu/nxmu_openwindow.c
+++ b/graphics/nxmu/nxmu_openwindow.c
@@ -1,7 +1,7 @@
/****************************************************************************
* graphics/nxmu/nxmu_openwindow.c
*
- * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2011, 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -42,26 +42,6 @@
#include
#include "nxmu.h"
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -84,12 +64,13 @@
void nxmu_openwindow(FAR struct nxbe_state_s *be, FAR struct nxbe_window_s *wnd)
{
/* The window structure was allocated in nx_openwindow and all fields have
- * been set to zero cb and conn which were initialized on the client side.
- * On the server side, we need only initialize a few more the non zero fields
- * and insert the new window at the top of the display.
+ * been set to zero; conn, flags, cb, and arg which were initialized on
+ * the client side. On the server side, we need only initialize a few
+ * more the non zero fields and insert the new window at the top of the
+ * display.
*/
- wnd->be = be;
+ wnd->be = be;
/* Now, insert the new window at the top on the display. topwind is
* never NULL (it may point only at the background window, however)
@@ -105,9 +86,9 @@ void nxmu_openwindow(FAR struct nxbe_state_s *be, FAR struct nxbe_window_s *wnd)
nxmu_reportposition(wnd);
+#ifdef CONFIG_NX_XYINPUT
/* Provide the initial mouse settings to the client */
-#ifdef CONFIG_NX_XYINPUT
nxmu_mousereport(wnd);
#endif
}
diff --git a/include/nuttx/nx/nx.h b/include/nuttx/nx/nx.h
index a2469f01237..de2fbfae925 100644
--- a/include/nuttx/nx/nx.h
+++ b/include/nuttx/nx/nx.h
@@ -1,7 +1,8 @@
/****************************************************************************
* include/nuttx/nx/nx.h
*
- * Copyright (C) 2008-2011, 2015, 2017 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2011, 2015, 2017, 2019 Gregory Nutt. All rights
+ * reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -379,6 +380,9 @@ int nx_eventnotify(NXHANDLE handle, int signo);
*
* Input Parameters:
* handle - The handle returned by nx_connect()
+ * flags - Optional flags. Must be zero unless CONFIG_NX_RAMBACKED is
+ * enabled. In that case, it may be zero or
+ * NXBE_WINDOW_RAMBACKED
* cb - Callbacks used to process window events
* arg - User provided value that will be returned with NX callbacks.
*
@@ -388,8 +392,8 @@ int nx_eventnotify(NXHANDLE handle, int signo);
*
****************************************************************************/
-NXWINDOW nx_openwindow(NXHANDLE handle, FAR const struct nx_callback_s *cb,
- FAR void *arg);
+NXWINDOW nx_openwindow(NXHANDLE handle, uint8_t flags,
+ FAR const struct nx_callback_s *cb, FAR void *arg);
/****************************************************************************
* Name: nx_closewindow
@@ -908,6 +912,9 @@ void nx_redrawreq(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect);
* Input Parameters:
* handle - The handle returned by nx_connect
* hwnd - The pre-allocated window structure.
+ * flags - Optional flags. Must be zero unless CONFIG_NX_RAMBACKED is
+ * enabled. In that case, it may be zero or
+ * NXBE_WINDOW_RAMBACKED
* cb - Callbacks used to process window events
* arg - User provided value that will be returned with NX callbacks.
*
@@ -917,7 +924,7 @@ void nx_redrawreq(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect);
*
****************************************************************************/
-int nx_constructwindow(NXHANDLE handle, NXWINDOW hwnd,
+int nx_constructwindow(NXHANDLE handle, NXWINDOW hwnd, uint8_t flags,
FAR const struct nx_callback_s *cb, FAR void *arg);
#undef EXTERN
diff --git a/include/nuttx/nx/nxbe.h b/include/nuttx/nx/nxbe.h
index 13c8e6122f1..9e00fd3246c 100644
--- a/include/nuttx/nx/nxbe.h
+++ b/include/nuttx/nx/nxbe.h
@@ -1,7 +1,8 @@
/****************************************************************************
* include/nuttx/nx/nxbe.h
*
- * Copyright (C) 2008-2011, 2013, 2017 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2011, 2013, 2017, 2019 Gregory Nutt. All rights
+ * reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -62,13 +63,32 @@
#endif
/* NXBE Definitions *********************************************************/
-/* Window flags and helper macros */
-#define NXBE_WINDOW_BLOCKED (1 << 0) /* The window is blocked and will not
- * receive further input. */
+/* Window flags and helper macros:
+ *
+ * NXBE_WINDOW_BLOCKED - Window input is blocked (internal use only)
+ * NXBE_WINDOW_RAMBACKED - Window is backed by a framebuffer
+ */
-#define NXBE_ISBLOCKED(wnd) (((wnd)->flags & NXBE_WINDOW_BLOCKED) != 0)
-#define NXBE_SETBLOCKED(wnd) do { (wnd)->flags |= NXBE_WINDOW_BLOCKED; } while (0)
+#define NXBE_WINDOW_BLOCKED (1 << 0) /* The window is blocked and will not
+ * receive further input. */
+#define NXBE_WINDOW_RAMBACKED (1 << 1) /* Window is backed by a framebuffer */
+
+#ifdef CONFIG_NX_RAMBACKED
+# define NXBE_WINDOW_USER NXBE_WINDOW_RAMBACKED
+#else
+# define NXBE_WINDOW_USER 0
+#endif
+
+#define NXBE_ISBLOCKED(wnd) \
+ (((wnd)->flags & NXBE_WINDOW_BLOCKED) != 0)
+#define NXBE_SETBLOCKED(wnd) \
+ do { (wnd)->flags |= NXBE_WINDOW_BLOCKED; } while (0)
+
+#define NXBE_ISRAMBACKED(wnd) \
+ (((wnd)->flags & NXBE_WINDOW_RAMBACKED) != 0)
+#define NXBE_SETRAMBACKED(wnd) \
+ do { (wnd)->flags |= NXBE_WINDOW_RAMBACKED; } while (0)
/****************************************************************************
* Public Types
diff --git a/include/nuttx/nx/nxmu.h b/include/nuttx/nx/nxmu.h
index ca7f845623b..bdf81cd5da3 100644
--- a/include/nuttx/nx/nxmu.h
+++ b/include/nuttx/nx/nxmu.h
@@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/nx/nxmu.h
*
- * Copyright (C) 2008-2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2013, 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
diff --git a/include/nuttx/nx/nxtk.h b/include/nuttx/nx/nxtk.h
index 75b31c21640..14625b7dd82 100644
--- a/include/nuttx/nx/nxtk.h
+++ b/include/nuttx/nx/nxtk.h
@@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/nx/nxtk.h
*
- * Copyright (C) 2008-2012, 2015 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2012, 2015, 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -122,6 +122,9 @@ extern "C"
*
* Input Parameters:
* handle - The handle returned by nx_connect
+ * flags - Optional flags. Must be zero unless CONFIG_NX_RAMBACKED is
+ * enabled. In that case, it may be zero or
+ * NXBE_WINDOW_RAMBACKED
* cb - Callbacks used to process window events
* arg - User provided value that will be returned with NXTK callbacks.
*
@@ -131,8 +134,9 @@ extern "C"
*
****************************************************************************/
-NXTKWINDOW nxtk_openwindow(NXHANDLE handle,
- FAR const struct nx_callback_s *cb, FAR void *arg);
+NXTKWINDOW nxtk_openwindow(NXHANDLE handle, uint8_t flags,
+ FAR const struct nx_callback_s *cb,
+ FAR void *arg);
/****************************************************************************
* Name: nxtk_closewindow
diff --git a/libs/libnx/nx/nx_drawcircle.c b/libs/libnx/nx/nx_drawcircle.c
index 08a4bc35ce5..53d482960af 100644
--- a/libs/libnx/nx/nx_drawcircle.c
+++ b/libs/libnx/nx/nx_drawcircle.c
@@ -49,6 +49,7 @@
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
+
/* Named indices into the 16 circle points generated by nxgl_circlepts */
#define POINT_0p0 0
@@ -69,22 +70,6 @@
#define POINT_337p5 15
#define NCIRCLE_POINTS 16
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
/****************************************************************************
* Public Functions
****************************************************************************/
diff --git a/libs/libnx/nx/nx_drawline.c b/libs/libnx/nx/nx_drawline.c
index 01e2b4bfcae..762957e3e7e 100644
--- a/libs/libnx/nx/nx_drawline.c
+++ b/libs/libnx/nx/nx_drawline.c
@@ -46,26 +46,6 @@
#include
#include
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
/****************************************************************************
* Public Functions
****************************************************************************/
diff --git a/libs/libnx/nx/nx_fillcircle.c b/libs/libnx/nx/nx_fillcircle.c
index c8c0eb8e1c7..e72d7591082 100644
--- a/libs/libnx/nx/nx_fillcircle.c
+++ b/libs/libnx/nx/nx_fillcircle.c
@@ -52,22 +52,6 @@
#define NCIRCLE_TRAPS 8
-/****************************************************************************
- * Private Types
- ****************************************************************************/
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
/****************************************************************************
* Public Functions
****************************************************************************/
diff --git a/libs/libnx/nxmu/nx_constructwindow.c b/libs/libnx/nxmu/nx_constructwindow.c
index 5d9220f60e2..5de9ff2e699 100644
--- a/libs/libnx/nxmu/nx_constructwindow.c
+++ b/libs/libnx/nxmu/nx_constructwindow.c
@@ -1,7 +1,7 @@
/****************************************************************************
* libs/libnx/nxmu/nx_constsructwindow.c
*
- * Copyright (C) 2008, 2011-2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008, 2011-2013, 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -72,6 +72,9 @@
* Input Parameters:
* handle - The handle returned by nx_connect
* hwnd - The pre-allocated window structure.
+ * flags - Optional flags. Must be zero unless CONFIG_NX_RAMBACKED is
+ * enabled. In that case, it may be zero or
+ * NXBE_WINDOW_RAMBACKED
* cb - Callbacks used to process window events
* arg - User provided value that will be returned with NX callbacks.
*
@@ -81,7 +84,7 @@
*
****************************************************************************/
-int nx_constructwindow(NXHANDLE handle, NXWINDOW hwnd,
+int nx_constructwindow(NXHANDLE handle, NXWINDOW hwnd, uint8_t flags,
FAR const struct nx_callback_s *cb, FAR void *arg)
{
FAR struct nxmu_conn_s *conn = (FAR struct nxmu_conn_s *)handle;
@@ -89,13 +92,13 @@ int nx_constructwindow(NXHANDLE handle, NXWINDOW hwnd,
struct nxsvrmsg_openwindow_s outmsg;
#ifdef CONFIG_DEBUG_FEATURES
- if (!wnd)
+ if (wnd == NULL)
{
set_errno(EINVAL);
return ERROR;
}
- if (!conn || !cb)
+ if (conn == NULL || cb == NULL || (flags & ~NXBE_WINDOW_USER) != 0)
{
lib_ufree(wnd);
set_errno(EINVAL);
@@ -103,11 +106,12 @@ int nx_constructwindow(NXHANDLE handle, NXWINDOW hwnd,
}
#endif
- /* Setup only the connection structure, callbacks and client private data
- * reference. The server will set everything else up.
+ /* Setup only the connection structure, user flags, callbacks and client
+ * private data reference. The server will set everything else up.
*/
wnd->conn = conn;
+ wnd->flags = flags;
wnd->cb = cb;
wnd->arg = arg;
diff --git a/libs/libnx/nxmu/nx_openwindow.c b/libs/libnx/nxmu/nx_openwindow.c
index c6e341f2e6a..1b16265d572 100644
--- a/libs/libnx/nxmu/nx_openwindow.c
+++ b/libs/libnx/nxmu/nx_openwindow.c
@@ -1,7 +1,8 @@
/****************************************************************************
* libs/libnx/nxmu/nx_openwindow.c
*
- * Copyright (C) 2008-2009, 2011-2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009, 2011-2013, 2019 Gregory Nutt. All rights
+ * reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -60,6 +61,9 @@
*
* Input Parameters:
* handle - The handle returned by nx_connect
+ * flags - Optional flags. Must be zero unless CONFIG_NX_RAMBACKED is
+ * enabled. In that case, it may be zero or
+ * NXBE_WINDOW_RAMBACKED
* cb - Callbacks used to process window events
* arg - User provided value that will be returned with NX callbacks.
*
@@ -69,8 +73,8 @@
*
****************************************************************************/
-NXWINDOW nx_openwindow(NXHANDLE handle, FAR const struct nx_callback_s *cb,
- FAR void *arg)
+NXWINDOW nx_openwindow(NXHANDLE handle, uint8_t flags,
+ FAR const struct nx_callback_s *cb, FAR void *arg)
{
FAR struct nxbe_window_s *wnd;
int ret;
@@ -94,7 +98,7 @@ NXWINDOW nx_openwindow(NXHANDLE handle, FAR const struct nx_callback_s *cb,
/* Then let nx_constructwindow do the rest */
- ret = nx_constructwindow(handle, (NXWINDOW)wnd, cb, arg);
+ ret = nx_constructwindow(handle, (NXWINDOW)wnd, flags, cb, arg);
if (ret < 0)
{
/* An error occurred, the window has been freed */
@@ -109,4 +113,3 @@ NXWINDOW nx_openwindow(NXHANDLE handle, FAR const struct nx_callback_s *cb,
return (NXWINDOW)wnd;
}
-
diff --git a/libs/libnx/nxtk/nxtk_openwindow.c b/libs/libnx/nxtk/nxtk_openwindow.c
index e3450c2fff4..1be1ee38e16 100644
--- a/libs/libnx/nxtk/nxtk_openwindow.c
+++ b/libs/libnx/nxtk/nxtk_openwindow.c
@@ -1,7 +1,8 @@
/****************************************************************************
* libs/libnx/nxtk/nxtk_openwindow.c
*
- * Copyright (C) 2008-2009, 2012-2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009, 2012-2013, 2019 Gregory Nutt. All rights
+ * reserved.
* Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
@@ -88,6 +89,9 @@ nxgl_mxpixel_t g_bordercolor3[CONFIG_NX_NPLANES] =
*
* Input Parameters:
* handle - The handle returned by nx_connect
+ * flags - Optional flags. Must be zero unless CONFIG_NX_RAMBACKED is
+ * enabled. In that case, it may be zero or
+ * NXBE_WINDOW_RAMBACKED
* cb - Callbacks used to process window events
* arg - User provided value that will be returned with NXTK callbacks.
*
@@ -97,7 +101,7 @@ nxgl_mxpixel_t g_bordercolor3[CONFIG_NX_NPLANES] =
*
****************************************************************************/
-NXTKWINDOW nxtk_openwindow(NXHANDLE handle,
+NXTKWINDOW nxtk_openwindow(NXHANDLE handle, uint8_t flags,
FAR const struct nx_callback_s *cb,
FAR void *arg)
{
@@ -105,7 +109,7 @@ NXTKWINDOW nxtk_openwindow(NXHANDLE handle,
int ret;
#ifdef CONFIG_DEBUG_FEATURES
- if (!handle || !cb)
+ if (handle == NULL || cb == NULL)
{
set_errno(EINVAL);
return NULL;
@@ -117,7 +121,7 @@ NXTKWINDOW nxtk_openwindow(NXHANDLE handle,
fwnd = (FAR struct nxtk_framedwindow_s *)
lib_uzalloc(sizeof(struct nxtk_framedwindow_s));
- if (!fwnd)
+ if (fwnd == NULL)
{
set_errno(ENOMEM);
return NULL;
@@ -130,7 +134,8 @@ NXTKWINDOW nxtk_openwindow(NXHANDLE handle,
/* Then let nx_constructwindow do the rest */
- ret = nx_constructwindow(handle, (NXWINDOW)&fwnd->wnd, &g_nxtkcb, NULL);
+ ret = nx_constructwindow(handle, (NXWINDOW)&fwnd->wnd, flags, &g_nxtkcb,
+ NULL);
if (ret < 0)
{
/* An error occurred, the window has been freed */