summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nuttx/examples/nx/nx_internal.h4
-rw-r--r--nuttx/examples/nx/nx_kbdin.c68
-rw-r--r--nuttx/examples/nx/nx_main.c4
-rw-r--r--nuttx/graphics/nxbe/nxbe_clipper.c2
-rw-r--r--nuttx/graphics/nxglib/nxglib_copyrectangle.c10
-rw-r--r--nuttx/graphics/nxtk/nxtk_bitmaptoolbar.c4
-rw-r--r--nuttx/graphics/nxtk/nxtk_bitmapwindow.c4
-rw-r--r--nuttx/include/nuttx/nx.h3
-rw-r--r--nuttx/include/nuttx/nxglib.h1
-rw-r--r--nuttx/include/nuttx/nxtk.h14
10 files changed, 42 insertions, 72 deletions
diff --git a/nuttx/examples/nx/nx_internal.h b/nuttx/examples/nx/nx_internal.h
index 5c98e9af1..af3f34ba3 100644
--- a/nuttx/examples/nx/nx_internal.h
+++ b/nuttx/examples/nx/nx_internal.h
@@ -228,7 +228,7 @@ struct nxeg_state_s
ubyte wnum; /* Window number */
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]; /* Window color */
-#if !defined(CONFIG_EXAMPLES_NX_RAWWINDOWS) && defined(CONFIG_NX_KBD)
+#ifdef CONFIG_NX_KBD
ubyte height; /* Max height of a font in pixels */
ubyte width; /* Max width of a font in pixels */
@@ -287,9 +287,9 @@ extern FAR void *nx_listenerthread(FAR void *arg);
extern void nxeg_kbdin(NXWINDOW hwnd, ubyte nch, const ubyte *ch, FAR void *arg);
#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
extern void nxeg_tbkbdin(NXWINDOW hwnd, ubyte nch, const ubyte *ch, FAR void *arg);
+#endif
extern void nxeg_filltext(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
FAR struct nxeg_state_s *st);
#endif
-#endif
#endif /* __EXAMPLES_NX_NX_INTERNAL_H */
diff --git a/nuttx/examples/nx/nx_kbdin.c b/nuttx/examples/nx/nx_kbdin.c
index 04d4e6aa1..3c5b3fb33 100644
--- a/nuttx/examples/nx/nx_kbdin.c
+++ b/nuttx/examples/nx/nx_kbdin.c
@@ -61,7 +61,6 @@
* pixel depths that are not directly addressable (1,2,4, and 24).
*/
-#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
#if CONFIG_EXAMPLES_NX_BPP == 8
# define RENDERER nxf_convert_8bpp
#elif CONFIG_EXAMPLES_NX_BPP == 16
@@ -71,7 +70,6 @@
#else
# error "Unsupported CONFIG_EXAMPLES_NX_BPP"
#endif
-#endif
/****************************************************************************
* Private Types
@@ -97,7 +95,6 @@
* Name: nxeg_fillchar
****************************************************************************/
-#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
static void nxeg_fillchar(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
FAR const struct nxeg_bitmap_s *bm)
{
@@ -110,41 +107,23 @@ static void nxeg_fillchar(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
if (!nxgl_nullrect(&intersection))
{
FAR void *src = (FAR void *)bm->glyph->bitmap;
- ret = nxtk_bitmapwindow((NXTKWINDOW)hwnd, &intersection, src,
+#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
+ ret = nxtk_bitmapwindow((NXTKWINDOW)hwnd, &intersection, &src,
&bm->bounds.pt1,
(unsigned int)bm->glyph->stride);
-#if 0
-EXTERN int nxtk_bitmapwindow(NXTKWINDOW hfwnd,
- FAR const struct nxgl_rect_s *dest,
- FAR const void *src[CONFIG_NX_NPLANES],
- FAR const struct nxgl_point_s *origin,
- unsigned int stride);
-#endif
if (ret < 0)
{
message("nxeg_fillchar: nxtk_bitmapwindow failed: %d\n", errno);
}
- }
-}
-#endif
-
-/****************************************************************************
- * Name: nxeg_kbdinfo
- ****************************************************************************/
-
-static void nxeg_kbdinfo(ubyte nch, const ubyte *ch)
-{
- int i;
- for (i = 0; i < nch; i++)
- {
- if (isprint(ch[i]))
- {
- message(" ch[%d]=%c (%02x)\n", i, ch[i], ch[i]);
- }
- else
+#else
+ ret = nx_bitmap((NXWINDOW)hwnd, &intersection, &src,
+ &bm->bounds.pt1,
+ (unsigned int)bm->glyph->stride);
+ if (ret < 0)
{
- message(" ch[%d]= (%02x)\n", i, ch[i]);
+ message("nxeg_fillchar: nx_bitmapwindow failed: %d\n", errno);
}
+#endif
}
}
@@ -152,13 +131,11 @@ static void nxeg_kbdinfo(ubyte nch, const ubyte *ch)
* Name: nxeg_renderglyph
****************************************************************************/
-#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
static inline FAR const struct nxeg_glyph_s *
nxeg_renderglyph(FAR struct nxeg_state_s *st, ubyte ch)
{
FAR struct nxeg_glyph_s *glyph = NULL;
FAR nxgl_mxpixel_t *ptr;
- int bmstride;
int bmsize;
int row;
int col;
@@ -170,13 +147,15 @@ nxeg_renderglyph(FAR struct nxeg_state_s *st, ubyte ch)
{
/* Allocate the glyph */
- glyph = &st->glyph[st->nglyphs];
+ glyph = &st->glyph[st->nglyphs];
+ glyph->code = ch;
/* Allocate the maximum size for the bitmap */
glyph->stride = (st->width * CONFIG_EXAMPLES_NX_BPP + 4) / 8;
bmsize = glyph->stride * st->height;
glyph->bitmap = (FAR ubyte *)malloc(bmsize);
+
if (glyph->bitmap)
{
/* Initialize the glyph memory to the background color */
@@ -196,7 +175,7 @@ nxeg_renderglyph(FAR struct nxeg_state_s *st, ubyte ch)
/* Then render the glyph into the allocated memory */
glyph->width = RENDERER((FAR nxgl_mxpixel_t*)glyph->bitmap,
- st->height, st->width, bmstride,
+ st->height, st->width, glyph->stride,
ch, CONFIG_EXAMPLES_NX_FONTCOLOR);
if (glyph->width <= 0)
{
@@ -216,13 +195,11 @@ nxeg_renderglyph(FAR struct nxeg_state_s *st, ubyte ch)
return glyph;
}
-#endif
/****************************************************************************
* Name: nxeg_getglyph
****************************************************************************/
-#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
static FAR const struct nxeg_glyph_s *
nxeg_getglyph(FAR struct nxeg_state_s *st, ubyte ch)
{
@@ -230,8 +207,7 @@ nxeg_getglyph(FAR struct nxeg_state_s *st, ubyte ch)
/* First, try to find the glyph in the cache of pre-rendered glyphs */
- message("nxeg_getglyph: ch=%02x\n", ch);
- for (i = 0; i < st->nglyphs; i++)
+ for (i = 0; i < st->nglyphs; i++)
{
if (st->glyph[i].code == ch)
{
@@ -243,13 +219,11 @@ nxeg_getglyph(FAR struct nxeg_state_s *st, ubyte ch)
return nxeg_renderglyph(st, ch);
}
-#endif
/****************************************************************************
* Name: nxeg_addchar
****************************************************************************/
-#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
static FAR const struct nxeg_bitmap_s *
nxeg_addchar(FAR struct nxeg_state_s *st, ubyte ch)
{
@@ -260,12 +234,11 @@ nxeg_addchar(FAR struct nxeg_state_s *st, ubyte ch)
/* Is there space for another character on the display? */
- message("nxeg_addchar: ch=%02x\n", ch);
if (st->nchars < NXTK_MAXKBDCHARS)
{
/* Yes, setup the bitmap */
- bm = &st->bm[st->nchars];
+ bm = &st->bm[st->nchars];
/* Find the matching glyph */
@@ -295,19 +268,17 @@ nxeg_addchar(FAR struct nxeg_state_s *st, ubyte ch)
bm->bounds.pt1.x = leftx;
bm->bounds.pt1.y = 2;
bm->bounds.pt2.x = leftx + bm->glyph->width - 1;
- bm->bounds.pt2.x = 2 + st->height - 1;
+ bm->bounds.pt2.y = 2 + st->height - 1;
st->nchars++;
}
return bm;
}
-#endif
/****************************************************************************
* Name: nxeg_addchars
****************************************************************************/
-#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
static inline void nxeg_addchars(NXWINDOW hwnd, FAR struct nxeg_state_s *st,
ubyte nch, FAR const ubyte *ch)
{
@@ -319,7 +290,6 @@ static inline void nxeg_addchars(NXWINDOW hwnd, FAR struct nxeg_state_s *st,
nxeg_fillchar(hwnd, &bm->bounds, bm);
}
}
-#endif
/****************************************************************************
* Public Functions
@@ -333,11 +303,7 @@ void nxeg_kbdin(NXWINDOW hwnd, ubyte nch, FAR const ubyte *ch, FAR void *arg)
{
FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg;
message("nxeg_kbdin%d: hwnd=%p nch=%d\n", st->wnum, hwnd, nch);
-#ifdef CONFIG_EXAMPLES_NX_RAWWINDOWS
- nxeg_kbdinfo(nch, ch);
-#else
nxeg_addchars(hwnd, st, nch, ch);
-#endif
}
/****************************************************************************
@@ -358,7 +324,6 @@ void nxeg_tbkbdin(NXWINDOW hwnd, ubyte nch, const ubyte *ch, FAR void *arg)
* Name: nxeg_tbkbdin
****************************************************************************/
-#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
void nxeg_filltext(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
FAR struct nxeg_state_s *st)
{
@@ -368,6 +333,5 @@ void nxeg_filltext(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
nxeg_fillchar(hwnd, rect, &st->bm[i]);
}
}
-#endif
#endif /* CONFIG_NX_KBD */
diff --git a/nuttx/examples/nx/nx_main.c b/nuttx/examples/nx/nx_main.c
index ca6c43e85..cccc133a7 100644
--- a/nuttx/examples/nx/nx_main.c
+++ b/nuttx/examples/nx/nx_main.c
@@ -143,7 +143,7 @@ static void nxeg_drivemouse(void)
static void nxeg_initstate(FAR struct nxeg_state_s *st, int wnum,
nxgl_mxpixel_t color)
{
-#if !defined(CONFIG_EXAMPLES_NX_RAWWINDOWS) && defined(CONFIG_NX_KBD)
+#ifdef CONFIG_NX_KBD
FAR const struct nx_font_s *fontset;
#endif
@@ -158,7 +158,7 @@ static void nxeg_initstate(FAR struct nxeg_state_s *st, int wnum,
* state structure
*/
-#if !defined(CONFIG_EXAMPLES_NX_RAWWINDOWS) && defined(CONFIG_NX_KBD)
+#ifdef CONFIG_NX_KBD
fontset = nxf_getfontset();
st->nchars = 0;
st->nglyphs = 0;
diff --git a/nuttx/graphics/nxbe/nxbe_clipper.c b/nuttx/graphics/nxbe/nxbe_clipper.c
index f0ccff71e..c66f74c7b 100644
--- a/nuttx/graphics/nxbe/nxbe_clipper.c
+++ b/nuttx/graphics/nxbe/nxbe_clipper.c
@@ -179,7 +179,7 @@ void nxbe_clipper(FAR struct nxbe_window_s *wnd,
FAR struct nxbe_clipops_s *cops,
FAR struct nxbe_plane_s *plane)
{
- struct nxbe_clipstack_s stack;
+ struct nxbe_clipstack_s stack;
FAR struct nxbe_window_s *currw;
struct nxgl_rect_s rect;
struct nxgl_rect_s obscuredrect;
diff --git a/nuttx/graphics/nxglib/nxglib_copyrectangle.c b/nuttx/graphics/nxglib/nxglib_copyrectangle.c
index 8a13260c6..500b92184 100644
--- a/nuttx/graphics/nxglib/nxglib_copyrectangle.c
+++ b/nuttx/graphics/nxglib/nxglib_copyrectangle.c
@@ -102,10 +102,12 @@ void NXGL_FUNCNAME(nxgl_copyrectangle,NXGLIB_SUFFIX)
deststride = pinfo->stride;
- /* Get the dimensions of the rectange to fill: height in rows and width in bytes */
+ /* Get the dimensions of the rectange to fill: width in pixels,
+ * height in rows
+ */
- width = NXGL_SCALEX(dest->pt2.x - dest->pt1.x + 1);
- rows = dest->pt2.y - dest->pt1.y + 1;
+ width = dest->pt2.x - dest->pt1.x + 1;
+ rows = dest->pt2.y - dest->pt1.y + 1;
#if NXGLIB_BITSPERPIXEL < 8
# ifdef CONFIG_NXGL_PACKEDMSFIRST
@@ -168,7 +170,7 @@ void NXGL_FUNCNAME(nxgl_copyrectangle,NXGLIB_SUFFIX)
#else
/* Copy the whole line */
- NXGL_MEMCPY((NXGL_PIXEL_T*)dest, (NXGL_PIXEL_T*)sline, width);
+ NXGL_MEMCPY((NXGL_PIXEL_T*)dline, (NXGL_PIXEL_T*)sline, width);
#endif
dline += deststride;
sline += srcstride;
diff --git a/nuttx/graphics/nxtk/nxtk_bitmaptoolbar.c b/nuttx/graphics/nxtk/nxtk_bitmaptoolbar.c
index dde83d9ef..98b99bb47 100644
--- a/nuttx/graphics/nxtk/nxtk_bitmaptoolbar.c
+++ b/nuttx/graphics/nxtk/nxtk_bitmaptoolbar.c
@@ -85,8 +85,8 @@
* will receive the bit map.
* src - The start of the source image.
* origin - The origin of the upper, left-most corner of the full bitmap.
- * Both dest and origin are in window coordinates, however, origin
- * may lie outside of the display.
+ * Both dest and origin are in sub-window coordinates, however, the
+ * origin may lie outside of the sub-window display.
* stride - The width of the full source image in pixels.
*
* Return:
diff --git a/nuttx/graphics/nxtk/nxtk_bitmapwindow.c b/nuttx/graphics/nxtk/nxtk_bitmapwindow.c
index 1410e8c6d..954282eb3 100644
--- a/nuttx/graphics/nxtk/nxtk_bitmapwindow.c
+++ b/nuttx/graphics/nxtk/nxtk_bitmapwindow.c
@@ -85,8 +85,8 @@
* will receive the bit map.
* src - The start of the source image.
* origin - The origin of the upper, left-most corner of the full bitmap.
- * Both dest and origin are in window coordinates, however, origin
- * may lie outside of the display.
+ * Both dest and origin are in sub-window coordinates, however, the
+ * origin may lie outside of the sub-window display.
* stride - The width of the full source image in pixels.
*
* Return:
diff --git a/nuttx/include/nuttx/nx.h b/nuttx/include/nuttx/nx.h
index 79abbdd76..13866f2f5 100644
--- a/nuttx/include/nuttx/nx.h
+++ b/nuttx/include/nuttx/nx.h
@@ -659,7 +659,8 @@ EXTERN int nx_move(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
* hwnd - The window that will receive the bitmap image
* dest - Describes the rectangular on the display that will receive the
* the bit map.
- * src - The start of the source image.
+ * src - The start of the source image. This is an array source
+ * images of size CONFIG_NX_NPLANES.
* origin - The origin of the upper, left-most corner of the full bitmap.
* Both dest and origin are in window coordinates, however, origin
* may lie outside of the display.
diff --git a/nuttx/include/nuttx/nxglib.h b/nuttx/include/nuttx/nxglib.h
index 7b9e95f84..34bd0bd10 100644
--- a/nuttx/include/nuttx/nxglib.h
+++ b/nuttx/include/nuttx/nxglib.h
@@ -43,6 +43,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <fixedmath.h>
+#include <nuttx/fb.h>
/****************************************************************************
* Pre-processor definitions
diff --git a/nuttx/include/nuttx/nxtk.h b/nuttx/include/nuttx/nxtk.h
index 21410f76b..d9466b9dc 100644
--- a/nuttx/include/nuttx/nxtk.h
+++ b/nuttx/include/nuttx/nxtk.h
@@ -273,10 +273,11 @@ EXTERN int nxtk_movewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
* hfwnd The client sub0window that will receive the bitmap image
* dest - Describes the rectangular region on in the client sub-window
* will receive the bit map.
- * src - The start of the source image.
+ * src - The start of the source image(s). This is an array source
+ * images of size CONFIG_NX_NPLANES.
* origin - The origin of the upper, left-most corner of the full bitmap.
- * Both dest and origin are in window coordinates, however, origin
- * may lie outside of the display.
+ * Both dest and origin are in sub-window coordinates, however, the
+ * origin may lie outside of the sub-window display.
* stride - The width of the full source image in pixels.
*
* Return:
@@ -286,7 +287,7 @@ EXTERN int nxtk_movewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
EXTERN int nxtk_bitmapwindow(NXTKWINDOW hfwnd,
FAR const struct nxgl_rect_s *dest,
- FAR const void **src,
+ FAR const void *src[CONFIG_NX_NPLANES],
FAR const struct nxgl_point_s *origin,
unsigned int stride);
@@ -364,6 +365,7 @@ EXTERN int nxtk_filltoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect
EXTERN int nxtk_filltraptoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_trapezoid_s *trap,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
+
/****************************************************************************
* Name: nxtk_movetoolbar
*
@@ -399,8 +401,8 @@ EXTERN int nxtk_movetoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect
* will receive the bit map.
* src - The start of the source image.
* origin - The origin of the upper, left-most corner of the full bitmap.
- * Both dest and origin are in window coordinates, however, origin
- * may lie outside of the display.
+ * Both dest and origin are in sub-window coordinates, however, the
+ * origin may lie outside of the sub-window display.
* stride - The width of the full source image in pixels.
*
* Return: