Adds support for cursors with differing pixel depths on multiple displays

Squashed commit of the following:

    Update .gitignore
    Fix some compile-related issues.
    Add support for cursors of differing pixeldepth.
    Various compile-related fixes.
    graphics/nxglib:  Separate cursor rendering routines in nxglib/ (like all other rendering logic).  graphics/nxbe:  Flesh out remaining cursor methods.
This commit is contained in:
Gregory Nutt
2019-04-09 11:32:42 -06:00
parent 95340ebfda
commit 4aadcc8c28
15 changed files with 991 additions and 318 deletions
+16 -1
View File
@@ -1,7 +1,8 @@
############################################################################ ############################################################################
# graphics/Makefile # graphics/Makefile
# #
# Copyright (C) 2008-2009, 2011-2012, 2016 Gregory Nutt. All rights reserved. # Copyright (C) 2008-2009, 2011-2012, 2016, 2019 Gregory Nutt. All
# rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org> # 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
@@ -87,24 +88,36 @@ gen8bppsource:
ifeq ($(CONFIG_NX_RAMBACKED),y) ifeq ($(CONFIG_NX_RAMBACKED),y)
$(Q) $(MAKE) -C nxglib -f Makefile.pwfb TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=8 EXTRADEFINES=$(EXTRADEFINES) $(Q) $(MAKE) -C nxglib -f Makefile.pwfb TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=8 EXTRADEFINES=$(EXTRADEFINES)
endif endif
ifeq ($(CONFIG_NX_SWCURSOR),y)
$(Q) $(MAKE) -C nxglib -f Makefile.cursor TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=8 EXTRADEFINES=$(EXTRADEFINES)
endif
gen16bppsource: gen16bppsource:
$(Q) $(MAKE) -C nxglib -f Makefile.devblit TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=16 EXTRADEFINES=$(EXTRADEFINES) $(Q) $(MAKE) -C nxglib -f Makefile.devblit TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=16 EXTRADEFINES=$(EXTRADEFINES)
ifeq ($(CONFIG_NX_RAMBACKED),y) ifeq ($(CONFIG_NX_RAMBACKED),y)
$(Q) $(MAKE) -C nxglib -f Makefile.pwfb TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=16 EXTRADEFINES=$(EXTRADEFINES) $(Q) $(MAKE) -C nxglib -f Makefile.pwfb TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=16 EXTRADEFINES=$(EXTRADEFINES)
endif endif
ifeq ($(CONFIG_NX_SWCURSOR),y)
$(Q) $(MAKE) -C nxglib -f Makefile.cursor TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=16 EXTRADEFINES=$(EXTRADEFINES)
endif
gen24bppsource: gen24bppsource:
$(Q) $(MAKE) -C nxglib -f Makefile.devblit TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=24 EXTRADEFINES=$(EXTRADEFINES) $(Q) $(MAKE) -C nxglib -f Makefile.devblit TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=24 EXTRADEFINES=$(EXTRADEFINES)
ifeq ($(CONFIG_NX_RAMBACKED),y) ifeq ($(CONFIG_NX_RAMBACKED),y)
$(Q) $(MAKE) -C nxglib -f Makefile.pwfb TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=24 EXTRADEFINES=$(EXTRADEFINES) $(Q) $(MAKE) -C nxglib -f Makefile.pwfb TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=24 EXTRADEFINES=$(EXTRADEFINES)
endif endif
ifeq ($(CONFIG_NX_SWCURSOR),y)
$(Q) $(MAKE) -C nxglib -f Makefile.cursor TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=24 EXTRADEFINES=$(EXTRADEFINES)
endif
gen32bppsources: gen32bppsources:
$(Q) $(MAKE) -C nxglib -f Makefile.devblit TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=32 EXTRADEFINES=$(EXTRADEFINES) $(Q) $(MAKE) -C nxglib -f Makefile.devblit TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=32 EXTRADEFINES=$(EXTRADEFINES)
ifeq ($(CONFIG_NX_RAMBACKED),y) ifeq ($(CONFIG_NX_RAMBACKED),y)
$(Q) $(MAKE) -C nxglib -f Makefile.pwfb TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=32 EXTRADEFINES=$(EXTRADEFINES) $(Q) $(MAKE) -C nxglib -f Makefile.pwfb TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=32 EXTRADEFINES=$(EXTRADEFINES)
endif endif
ifeq ($(CONFIG_NX_SWCURSOR),y)
$(Q) $(MAKE) -C nxglib -f Makefile.cursor TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=32 EXTRADEFINES=$(EXTRADEFINES)
endif
gensources: gen1bppsources gen2bppsource gen4bppsource gen8bppsource gen16bppsource gen24bppsource gen32bppsources gensources: gen1bppsources gen2bppsource gen4bppsource gen8bppsource gen16bppsource gen24bppsource gen32bppsources
@@ -130,12 +143,14 @@ context: gensources
clean: clean:
$(Q) $(MAKE) -C nxglib -f Makefile.devblit clean TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES) $(Q) $(MAKE) -C nxglib -f Makefile.devblit clean TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES)
$(Q) $(MAKE) -C nxglib -f Makefile.pwfb clean TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES) $(Q) $(MAKE) -C nxglib -f Makefile.pwfb clean TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES)
$(Q) $(MAKE) -C nxglib -f Makefile.cursor clean TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES)
$(call DELFILE, $(BIN)) $(call DELFILE, $(BIN))
$(call CLEAN) $(call CLEAN)
distclean: clean distclean: clean
$(Q) $(MAKE) -C nxglib -f Makefile.devblit distclean TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES) $(Q) $(MAKE) -C nxglib -f Makefile.devblit distclean TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES)
$(Q) $(MAKE) -C nxglib -f Makefile.pwfb distclean TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES) $(Q) $(MAKE) -C nxglib -f Makefile.pwfb distclean TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES)
$(Q) $(MAKE) -C nxglib -f Makefile.cursor distclean TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES)
$(call DELFILE, Make.dep) $(call DELFILE, Make.dep)
$(call DELFILE, .depend) $(call DELFILE, .depend)
+40 -13
View File
@@ -48,6 +48,7 @@
#include <nuttx/nx/nx.h> #include <nuttx/nx/nx.h>
#include <nuttx/nx/nxglib.h> #include <nuttx/nx/nxglib.h>
#include <nuttx/nx/nxcursor.h>
#include <nuttx/nx/nxbe.h> #include <nuttx/nx/nxbe.h>
/**************************************************************************** /****************************************************************************
@@ -146,20 +147,40 @@ struct nxbe_pwfb_vtable_s
}; };
#endif #endif
#ifdef CONFIG_NX_SWCURSOR
/* A vtable of raster operation function pointers. The types of the
* function points must match the cursor rasterizer types exported by
* nxglib.
*/
struct nxbe_cursorops_s
{
CODE void (*draw)(FAR struct nxbe_state_s *be, int planeno);
CODE void (*erase)(FAR struct nxbe_state_s *be, int planeno);
CODE void (*backup)(FAR struct nxbe_state_s *be, int planeno);
};
#endif
/* Encapsulates everything needed support window rasterization commands. */ /* Encapsulates everything needed support window rasterization commands. */
struct nxbe_plane_s struct nxbe_plane_s
{ {
/* Raster device operation callbacks */ /* Raster device operations */
struct nxbe_dev_vtable_s dev; struct nxbe_dev_vtable_s dev;
#ifdef CONFIG_NX_RAMBACKED #ifdef CONFIG_NX_RAMBACKED
/* Raster per-window framebuffer operation callbacks */ /* Raster per-window framebuffer operations */
struct nxbe_pwfb_vtable_s pwfb; struct nxbe_pwfb_vtable_s pwfb;
#endif #endif
#ifdef CONFIG_NX_SWCURSOR
/* Cursor device operations */
struct nxbe_cursorops_s cursor;
#endif
/* Framebuffer plane info describing destination video plane */ /* Framebuffer plane info describing destination video plane */
NX_PLANEINFOTYPE pinfo; NX_PLANEINFOTYPE pinfo;
@@ -173,24 +194,30 @@ struct nxbe_plane_s
struct nxbe_clipops_s struct nxbe_clipops_s
{ {
void (*visible)(FAR struct nxbe_clipops_s *cops, CODE void (*visible)(FAR struct nxbe_clipops_s *cops,
FAR struct nxbe_plane_s *plane, FAR struct nxbe_plane_s *plane,
FAR const struct nxgl_rect_s *rect); FAR const struct nxgl_rect_s *rect);
void (*obscured)(FAR struct nxbe_clipops_s *cops, CODE void (*obscured)(FAR struct nxbe_clipops_s *cops,
FAR struct nxbe_plane_s *plane, FAR struct nxbe_plane_s *plane,
FAR const struct nxgl_rect_s *rect); FAR const struct nxgl_rect_s *rect);
}; };
/* Cursor *******************************************************************/ /* Cursor *******************************************************************/
/* Cursor state structure */
#if defined(CONFIG_NX_SWCURSOR) #if defined(CONFIG_NX_SWCURSOR)
struct nxbe_cursor_s struct nxbe_cursor_s
{ {
bool visible; /* True: the cursor is visible */ bool visible; /* True: the cursor is visible */
struct nxgl_rect_s bounds; /* Cursor image bounding box */ struct nxgl_rect_s bounds; /* Cursor image bounding box */
FAR uint8_t *cimage; /* Cursor image at 2-bits/pixel */ nxgl_mxpixel_t color1[CONFIG_NX_NPLANES]; /* Color1 is main color of the cursor */
FAR nxgl_mxpixel_t *backgd; /* Cursor background in device pixels */ nxgl_mxpixel_t color2[CONFIG_NX_NPLANES]; /* Color2 is color of any border */
nxgl_mxpixel_t color3[CONFIG_NX_NPLANES]; /* Color3 is the blended color */
size_t allocsize; /* Size of the background allocation */
FAR const uint8_t *image; /* Cursor image at 2-bits/pixel */
FAR nxgl_mxpixel_t *bkgd; /* Cursor background in device pixels */
}; };
#elif defined(CONFIG_NX_HWCURSOR) #elif defined(CONFIG_NX_HWCURSOR)
struct nxbe_cursor_s struct nxbe_cursor_s
@@ -325,7 +352,7 @@ void nxbe_cursor_setimage(FAR struct nxbe_state_s *be,
#endif #endif
/**************************************************************************** /****************************************************************************
* Name: nxcursor_setposition * Name: nxbe_cursor_setposition
* *
* Description: * Description:
* Move the cursor to the specified position * Move the cursor to the specified position
@@ -339,8 +366,8 @@ void nxbe_cursor_setimage(FAR struct nxbe_state_s *be,
* *
****************************************************************************/ ****************************************************************************/
void nxcursor_setposition(FAR struct nxbe_state_s *be, void nxbe_cursor_setposition(FAR struct nxbe_state_s *be,
FAR const struct nxgl_point_s *pos); FAR const struct nxgl_point_s *pos);
#endif /* CONFIG_NX_SWCURSOR || CONFIG_NX_HWCURSOR */ #endif /* CONFIG_NX_SWCURSOR || CONFIG_NX_HWCURSOR */
/**************************************************************************** /****************************************************************************
+24
View File
@@ -213,6 +213,12 @@ int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be)
be->plane[i].pwfb.moverectangle = pwfb_moverectangle_8bpp; be->plane[i].pwfb.moverectangle = pwfb_moverectangle_8bpp;
be->plane[i].pwfb.copyrectangle = pwfb_copyrectangle_8bpp; be->plane[i].pwfb.copyrectangle = pwfb_copyrectangle_8bpp;
#endif #endif
#ifdef CONFIG_NX_SWCURSOR
be->plane[i].cursor.draw = nxglib_cursor_draw_8bpp;
be->plane[i].cursor.erase = nxglib_cursor_erase_8bpp;
be->plane[i].cursor.backup = nxglib_cursor_backup_8bpp;
#endif
} }
else else
#endif #endif
@@ -234,6 +240,12 @@ int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be)
be->plane[i].pwfb.moverectangle = pwfb_moverectangle_16bpp; be->plane[i].pwfb.moverectangle = pwfb_moverectangle_16bpp;
be->plane[i].pwfb.copyrectangle = pwfb_copyrectangle_16bpp; be->plane[i].pwfb.copyrectangle = pwfb_copyrectangle_16bpp;
#endif #endif
#ifdef CONFIG_NX_SWCURSOR
be->plane[i].cursor.draw = nxglib_cursor_draw_16bpp;
be->plane[i].cursor.erase = nxglib_cursor_erase_16bpp;
be->plane[i].cursor.backup = nxglib_cursor_backup_16bpp;
#endif
} }
else else
#endif #endif
@@ -255,6 +267,12 @@ int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be)
be->plane[i].pwfb.moverectangle = pwfb_moverectangle_24bpp; be->plane[i].pwfb.moverectangle = pwfb_moverectangle_24bpp;
be->plane[i].pwfb.copyrectangle = pwfb_copyrectangle_24bpp; be->plane[i].pwfb.copyrectangle = pwfb_copyrectangle_24bpp;
#endif #endif
#ifdef CONFIG_NX_SWCURSOR
be->plane[i].cursor.draw = nxglib_cursor_draw_24bpp;
be->plane[i].cursor.erase = nxglib_cursor_erase_24bpp;
be->plane[i].cursor.backup = nxglib_cursor_backup_24bpp;
#endif
} }
else else
#endif #endif
@@ -276,6 +294,12 @@ int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be)
be->plane[i].pwfb.moverectangle = pwfb_moverectangle_32bpp; be->plane[i].pwfb.moverectangle = pwfb_moverectangle_32bpp;
be->plane[i].pwfb.copyrectangle = pwfb_copyrectangle_32bpp; be->plane[i].pwfb.copyrectangle = pwfb_copyrectangle_32bpp;
#endif #endif
#ifdef CONFIG_NX_SWCURSOR
be->plane[i].cursor.draw = nxglib_cursor_draw_32bpp;
be->plane[i].cursor.erase = nxglib_cursor_erase_32bpp;
be->plane[i].cursor.backup = nxglib_cursor_backup_32bpp;
#endif
} }
else else
#endif #endif
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -10,4 +10,6 @@
/pwfb_filltrapezoid_*bpp.c /pwfb_filltrapezoid_*bpp.c
/pwfb_moverectangle_*bpp.c /pwfb_moverectangle_*bpp.c
/pwfb_copyrectangle_*bpp.c /pwfb_copyrectangle_*bpp.c
/nxglib_cursor_draw_*bpp.c
/nxglib_cursor_erase_*bpp.c
/nxglib_cursor_backup_*bpp.c
+13
View File
@@ -97,6 +97,19 @@ CSRCS += pwfb_copyrectangle_32bpp.c
endif endif
ifeq ($(CONFIG_NX_SWCURSOR),y)
CSRCS += nxglib_cursor_draw_8bpp.c nxglib_cursor_draw_16bpp.c
CSRCS += nxglib_cursor_draw_24bpp.c nxglib_cursor_draw_32bpp.c
CSRCS += nxglib_cursor_erase_8bpp.c nxglib_cursor_erase_16bpp.c
CSRCS += nxglib_cursor_erase_24bpp.c nxglib_cursor_erase_32bpp.c
CSRCS += nxglib_cursor_backup_8bpp.c nxglib_cursor_backup_16bpp.c
CSRCS += nxglib_cursor_backup_24bpp.c nxglib_cursor_backup_32bpp.c
endif
DEPPATH += --dep-path nxglib DEPPATH += --dep-path nxglib
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxglib} CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)/graphics/nxglib}
#VPATH += :nxglib #VPATH += :nxglib
+105
View File
@@ -0,0 +1,105 @@
############################################################################
# graphics/nxglib/Makefile.cursor
#
# Copyright (C) 2019 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 nor the names of its contributors may 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.
#
############################################################################
-include $(TOPDIR)/Make.defs
ifeq ($(NXGLIB_BITSPERPIXEL),8)
NXGLIB_SUFFIX := _8bpp
DRAW_CSRC := nxglib_cursor_draw_8bpp.c
ERASE_CSRC := nxglib_cursor_erase_8bpp.c
BACKUP_CSRC := nxglib_cursor_backup_8bpp.c
endif
ifeq ($(NXGLIB_BITSPERPIXEL),16)
NXGLIB_SUFFIX := _16bpp
DRAW_CSRC := nxglib_cursor_draw_16bpp.c
ERASE_CSRC := nxglib_cursor_erase_16bpp.c
BACKUP_CSRC := nxglib_cursor_backup_16bpp.c
endif
ifeq ($(NXGLIB_BITSPERPIXEL),24)
NXGLIB_SUFFIX := _24bpp
DRAW_CSRC := nxglib_cursor_draw_24bpp.c
ERASE_CSRC := nxglib_cursor_erase_24bpp.c
BACKUP_CSRC := nxglib_cursor_backup_24bpp.c
endif
ifeq ($(NXGLIB_BITSPERPIXEL),32)
NXGLIB_SUFFIX := _32bpp
DRAW_CSRC := nxglib_cursor_draw_32bpp.c
ERASE_CSRC := nxglib_cursor_erase_32bpp.c
BACKUP_CSRC := nxglib_cursor_backup_32bpp.c
endif
CPPFLAGS += -DNXGLIB_BITSPERPIXEL=$(NXGLIB_BITSPERPIXEL)
CPPFLAGS += -DNXGLIB_SUFFIX=$(NXGLIB_SUFFIX)
DRAW_TMP = $(DRAW_CSRC:.c=.i)
ERASE_TMP = $(ERASE_CSRC:.c=.i)
BACKUP_TMP = $(BACKUP_CSRC:.c=.i)
GEN_CSRCS = $(DRAW_CSRC) $(ERASE_CSRC) $(BACKUP_CSRC)
BLITDIR = cursor
all: $(GEN_CSRCS)
.PHONY : clean distclean
$(DRAW_CSRC) : $(BLITDIR)/nxglib_cursor_draw.c nxglib_bitblit.h
ifneq ($(NXGLIB_BITSPERPIXEL),)
$(call PREPROCESS, $(BLITDIR)/nxglib_cursor_draw.c, $(DRAW_TMP))
$(Q) cat $(DRAW_TMP) | sed -e "/^#/d" >$@
$(Q) rm -f $(DRAW_TMP)
endif
$(ERASE_CSRC) : $(BLITDIR)/nxglib_cursor_erase.c nxglib_bitblit.h
ifneq ($(NXGLIB_BITSPERPIXEL),)
$(call PREPROCESS, $(BLITDIR)/nxglib_cursor_erase.c, $(ERASE_TMP))
$(Q) cat $(ERASE_TMP) | sed -e "/^#/d" >$@
$(Q) rm -f $(ERASE_TMP)
endif
$(BACKUP_CSRC) : $(BLITDIR)/nxglib_cursor_backup.c nxglib_bitblit.h
ifneq ($(NXGLIB_BITSPERPIXEL),)
$(call PREPROCESS, $(BLITDIR)/nxglib_cursor_backup.c, $(BACKUP_TMP))
$(Q) cat $(BACKUP_TMP) | sed -e "/^#/d" >$@
$(Q) rm -f $(BACKUP_TMP)
endif
clean:
$(call DELFILE, *.i)
$(call CLEAN)
distclean: clean
$(call DELFILE, nxglib_cursor_draw_*bpp.c)
$(call DELFILE, nxglib_cursor_erase_*bpp.c)
$(call DELFILE, nxglib_cursor_backup_*bpp.c)
@@ -0,0 +1,145 @@
/****************************************************************************
* graphics/nxglib/nxglib_cursor_backup.c
*
* Copyright (C) 2019 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 nor the names of its contributors may 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 <assert.h>
#include <nuttx/nx/nxglib.h>
#include "nxglib_bitblit.h"
#include "../nxbe/nxbe.h"
#include "nxglib.h"
#ifdef CONFIG_NX_SWCURSOR
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: nxglib_cursor_backup
*
* Description:
* Saved the cursor background data from the device graphics memory into an
* internal save area. This saved image will be used to "erase" the cursor
* when necessary.
*
* Input Parameters:
* be - The back-end state structure instance
* planeno - The color plane being drawn
*
* Returned Value:
* None
*
****************************************************************************/
void NXGL_FUNCNAME(nxglib_cursor_backup, NXGLIB_SUFFIX)
(FAR struct nxbe_state_s *be, int planeno)
{
struct nxgl_rect_s intersection;
struct nxgl_point_s origin;
FAR struct nxbe_plane_s *plane;
FAR uint8_t *fbmem;
FAR uint8_t *sline;
FAR uint8_t *dline;
FAR NXGL_PIXEL_T *src;
FAR NXGL_PIXEL_T *dest;
nxgl_coord_t width;
nxgl_coord_t height;
nxgl_coord_t sstride;
nxgl_coord_t dstride;
int row;
int col;
/* Handle the case some or all of the backup image is off of the display. */
nxgl_rectintersect(&intersection, &be->cursor.bounds, &be->bkgd.bounds);
if (!nxgl_nullrect(&intersection))
{
/* Get the width and the height of the images in pixels/rows */
width = be->cursor.bounds.pt2.x = be->cursor.bounds.pt1.x + 1;
height = be->cursor.bounds.pt2.y = be->cursor.bounds.pt1.y + 1;
/* Get the width of the images in bytes. */
plane = &be->plane[planeno];
sstride = plane->pinfo.stride;
dstride = NXGL_SCALEX(width);
/* Get the origin position in the background image */
nxgl_vectsubtract(&origin, &intersection.pt1, &be->cursor.bounds.pt1);
/* Get the source and destination addresses */
fbmem = (FAR uint8_t *)plane->pinfo.fbmem;
sline = (FAR uint8_t *)fbmem + sstride * be->cursor.bounds.pt1.y +
NXGL_SCALEX(be->cursor.bounds.pt1.x);
dline = (FAR uint8_t *)be->cursor.bkgd + dstride * origin.y +
NXGL_SCALEX(origin.y);
/* Save the cursor background by copying the device graphics memory */
/* Loop for each row */
for (row = 0; row < height; row++)
{
/* Reset to the beginning of the line */
src = (FAR NXGL_PIXEL_T *)sline;
dest = (FAR NXGL_PIXEL_T *)dline;
/* Loop for each column */
for (col = 0; col < width; col++)
{
*dest++ = *src++;
}
/* Update the row addresses to the next row */
sline += sstride;
dline += dstride;
}
}
}
#endif /* CONFIG_NX_SWCURSOR */
+234
View File
@@ -0,0 +1,234 @@
/****************************************************************************
* graphics/nxglib/nxglib_cursor_draw.c
*
* Copyright (C) 2019 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 nor the names of its contributors may 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 <assert.h>
#include <nuttx/nx/nxglib.h>
#include "nxglib_bitblit.h"
#include "../nxbe/nxbe.h"
#include "nxglib.h"
#ifdef CONFIG_NX_SWCURSOR
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: nxbe_map_color
*
* Description:
* Map a 2-bit cursor pixel value to a device pixel value
*
* REVISIT: If we really were to support multiple displays (or planes)
* with differing pixel depth, then the cursor.color1,2,3 would be
* insufficient: There would have to be multiple color sets for each
* plane.
*
* Input Parameters:
* be - The back-end state structure instance
* pixel - Pixel to be mapped
*
* Returned Value:
* The mapped pixel.
*
****************************************************************************/
static NXGL_PIXEL_T nxbe_map_color(FAR struct nxbe_state_s *be, int plane,
uint8_t pixel)
{
switch (pixel)
{
case 0:
default:
return 0; /* Should not happen */
case 1:
return be->cursor.color1[plane];
break;
case 2:
return be->cursor.color2[plane];
break;
case 3:
return be->cursor.color3[plane];
break;
}
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: nxglib_cursor_draw
*
* Description:
* Update the cursor region by drawing directly in device memory.
*
* Input Parameters:
* be - The back-end state structure instance
* planeno - The color plane being drawn
*
* Returned Value:
* None
*
****************************************************************************/
void NXGL_FUNCNAME(nxglib_cursor_draw, NXGLIB_SUFFIX)
(FAR struct nxbe_state_s *be, int planeno)
{
struct nxgl_rect_s intersection;
struct nxgl_point_s origin;
FAR struct nxbe_plane_s *plane;
FAR uint8_t *fbmem;
FAR uint8_t *src;
FAR uint8_t *sline;
FAR uint8_t *dline;
FAR NXGL_PIXEL_T *dest;
nxgl_coord_t width;
nxgl_coord_t height;
nxgl_coord_t sstride;
nxgl_coord_t dstride;
nxgl_coord_t sshift;
int shift;
int row;
int col;
/* Handle the case some or all of the cursor image is off of the display. */
nxgl_rectintersect(&intersection, &be->cursor.bounds, &be->bkgd.bounds);
if (!nxgl_nullrect(&intersection))
{
/* Get the width and the height of the images in pixels/rows */
width = be->cursor.bounds.pt2.x = be->cursor.bounds.pt1.x + 1;
height = be->cursor.bounds.pt2.y = be->cursor.bounds.pt1.y + 1;
/* Get the width of the images in bytes. */
sstride = (width + 3) >> 2; /* 2 bits per pixel, 4 pixels per byte */
plane = &be->plane[planeno];
dstride = plane->pinfo.stride;
/* Get the origin position in the cursor image */
nxgl_vectsubtract(&origin, &intersection.pt1, &be->cursor.bounds.pt1);
/* Update any cursor graphics on top of the device display to include
* the modified cursor.
*
* REVISIT: This will only work for a single plane and for bits per
* pixel greater than or equal to 8.
*/
fbmem = (FAR uint8_t *)plane->pinfo.fbmem;
sline = be->cursor.image + sstride * origin.y + (origin.y >> 2);
dline = (FAR uint8_t *)fbmem + dstride * be->cursor.bounds.pt1.y +
NXGL_SCALEX(be->cursor.bounds.pt1.x);
sshift = (3 - (origin.y & 3)) << 1; /* MS first {0, 2, 4, 6} */
/* Loop for each row */
for (row = 0; row < height; row++)
{
/* Reset to the beginning of the line */
src = sline;
dest = (FAR NXGL_PIXEL_T *)dline;
shift = sshift;
/* Loop for each column */
for (col = 0; col < width; col++)
{
/* Extract the 2-bit pixel. Data is always packed MS first.
* Shift for first pixel=6, shift for last pixel=0
*/
uint8_t pixel = (*src >> shift) & 3;
/* Skip over invisible pixels */
if (pixel != 0)
{
*dest = nxbe_map_color(be, 0, pixel);
}
/* Update to the next column */
col++;
dest++;
/* Was that the last pixel in the byte? */
if (shift == 0)
{
/* Update source column addresses and reset the shift
* value
*/
src++;
shift = 6;
}
else
{
/* The shift value is one of {2, 4, 6}. Update the shift
* value following this order: 6, 4, 2, 0
*/
shift = (shift - 2) & 6;
}
}
/* Update the row addresses to the next row */
sline += sstride;
dline += dstride;
}
}
}
#endif /* CONFIG_NX_SWCURSOR */
@@ -0,0 +1,145 @@
/****************************************************************************
* graphics/nxglib/nxglib_cursor_erase.c
*
* Copyright (C) 2019 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 nor the names of its contributors may 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 <assert.h>
#include <nuttx/nx/nxglib.h>
#include "nxglib_bitblit.h"
#include "../nxbe/nxbe.h"
#include "nxglib.h"
#ifdef CONFIG_NX_SWCURSOR
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: nxglib_cursor_erase
*
* Description:
* Erase the cursor region by writing the saved background to the graphics
* device memory.
*
* Input Parameters:
* be - The back-end state structure instance
* planeno - The color plane being drawn
*
* Returned Value:
* None
*
****************************************************************************/
void NXGL_FUNCNAME(nxglib_cursor_erase, NXGLIB_SUFFIX)
(FAR struct nxbe_state_s *be, int planeno)
{
struct nxgl_rect_s intersection;
struct nxgl_point_s origin;
FAR struct nxbe_plane_s *plane;
FAR uint8_t *fbmem;
FAR uint8_t *sline;
FAR uint8_t *dline;
FAR NXGL_PIXEL_T *src;
FAR NXGL_PIXEL_T *dest;
nxgl_coord_t width;
nxgl_coord_t height;
nxgl_coord_t sstride;
nxgl_coord_t dstride;
int row;
int col;
/* Handle the case some or all of the cursor image is off of the display. */
nxgl_rectintersect(&intersection, &be->cursor.bounds, &be->bkgd.bounds);
if (!nxgl_nullrect(&intersection))
{
/* Get the width and the height of the images in pixels/rows */
width = be->cursor.bounds.pt2.x = be->cursor.bounds.pt1.x + 1;
height = be->cursor.bounds.pt2.y = be->cursor.bounds.pt1.y + 1;
/* Get the width of the images in bytes. */
sstride = NXGL_SCALEX(width);
plane = &be->plane[planeno];
dstride = plane->pinfo.stride;
/* Get the origin position in the background image */
nxgl_vectsubtract(&origin, &intersection.pt1, &be->cursor.bounds.pt1);
/* Get the source and destination addresses */
fbmem = (FAR uint8_t *)plane->pinfo.fbmem;
sline = (FAR uint8_t *)be->cursor.bkgd + sstride * origin.y +
NXGL_SCALEX(origin.y);
dline = (FAR uint8_t *)fbmem + dstride * be->cursor.bounds.pt1.y +
NXGL_SCALEX(be->cursor.bounds.pt1.x);
/* Erase the old cursor position by copying the previous content */
/* Loop for each row */
for (row = 0; row < height; row++)
{
/* Reset to the beginning of the line */
src = (FAR NXGL_PIXEL_T *)sline;
dest = (FAR NXGL_PIXEL_T *)dline;
/* Loop for each column */
for (col = 0; col < width; col++)
{
*dest++ = *src++;
}
/* Update the row addresses to the next row */
sline += sstride;
dline += dstride;
}
}
}
#endif /* CONFIG_NX_SWCURSOR */
+49
View File
@@ -453,6 +453,55 @@ void pwfb_copyrectangle_32bpp(FAR struct nxbe_window_s *bwnd,
unsigned int srcstride); unsigned int srcstride);
#endif #endif
/****************************************************************************
* Name: nxgl_cursor_draw_*bpp
*
* Description:
* Draw the cursor image into the specified position in the graphics memory.
*
****************************************************************************/
struct nxbe_state_s; /* Forward reference */
#ifdef CONFIG_NX_SWCURSOR
void nxglib_cursor_draw_8bpp(FAR struct nxbe_state_s *be, int planeno);
void nxglib_cursor_draw_16bpp(FAR struct nxbe_state_s *be, int planeno);
void nxglib_cursor_draw_24bpp(FAR struct nxbe_state_s *be, int planeno);
void nxglib_cursor_draw_32bpp(FAR struct nxbe_state_s *be, int planeno);
#endif
/****************************************************************************
* Name: nxgl_cursor_erase_*bpp
*
* Description:
* Erase the cursor by copying the saved background image into the graphics
* memory.
*
****************************************************************************/
#ifdef CONFIG_NX_SWCURSOR
void nxglib_cursor_erase_8bpp(FAR struct nxbe_state_s *be, int planeno);
void nxglib_cursor_erase_16bpp(FAR struct nxbe_state_s *be, int planeno);
void nxglib_cursor_erase_24bpp(FAR struct nxbe_state_s *be, int planeno);
void nxglib_cursor_erase_32bpp(FAR struct nxbe_state_s *be, int planeno);
#endif
/****************************************************************************
* Name: nxgl_cursor_backup_*bpp
*
* Description:
* Save the backgroud image for subsequent use to erase the cursor from the
* device graphics memory.
*
****************************************************************************/
#ifdef CONFIG_NX_SWCURSOR
void nxglib_cursor_backup_8bpp(FAR struct nxbe_state_s *be, int planeno);
void nxglib_cursor_backup_16bpp(FAR struct nxbe_state_s *be, int planeno);
void nxglib_cursor_backup_24bpp(FAR struct nxbe_state_s *be, int planeno);
void nxglib_cursor_backup_32bpp(FAR struct nxbe_state_s *be, int planeno);
#endif
#undef EXTERN #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
} }
+3 -3
View File
@@ -380,7 +380,7 @@ int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev)
case NX_SVRMSG_CURSOR_ENABLE: /* Enable/disable cursor */ case NX_SVRMSG_CURSOR_ENABLE: /* Enable/disable cursor */
{ {
FAR struct nxsvrmsg_curenable_s *enabmsg = (FAR struct nxsvrmsg_curenable_s *)buffer; FAR struct nxsvrmsg_curenable_s *enabmsg = (FAR struct nxsvrmsg_curenable_s *)buffer;
nxbe_cursor_enable(&nxwm.be, enabmsg->enable); nxbe_cursor_enable(&nxmu.be, enabmsg->enable);
} }
break; break;
@@ -388,14 +388,14 @@ int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev)
case NX_SVRMSG_CURSOR_IMAGE: /* Set cursor image */ case NX_SVRMSG_CURSOR_IMAGE: /* Set cursor image */
{ {
FAR struct nxsvrmsg_curimage_s *imgmsg = (FAR struct nxsvrmsg_curimage_s *)buffer; FAR struct nxsvrmsg_curimage_s *imgmsg = (FAR struct nxsvrmsg_curimage_s *)buffer;
nxbe_cursor_setimage(&nxwm.be, imgmsg->image); nxbe_cursor_setimage(&nxmu.be, &imgmsg->image);
} }
break; break;
#endif #endif
case NX_SVRMSG_CURSOR_SETPOS: /* Set cursor position */ case NX_SVRMSG_CURSOR_SETPOS: /* Set cursor position */
{ {
FAR struct nxsvrmsg_curpos_s *posmsg = (FAR struct nxsvrmsg_curpos_s *)buffer; FAR struct nxsvrmsg_curpos_s *posmsg = (FAR struct nxsvrmsg_curpos_s *)buffer;
nxbe_cursor_setposition(&nxwm.be, &posmsg->pos); nxbe_cursor_setposition(&nxmu.be, &posmsg->pos);
} }
break; break;
#endif #endif
+30
View File
@@ -59,6 +59,36 @@ extern "C"
#define EXTERN extern #define EXTERN extern
#endif #endif
/****************************************************************************
* Public Functions
****************************************************************************/
/* The current software cursor implementation is only available under the
* following conditions:
*
* 1. Using a framebuffer hardware interface. This is because the logic to
* implement this feature on top of the LCD interface has not been
* implemented.
* 2. Pixel depth is greater then or equal to 8-bits (8-bpp, 16-bpp,
* 24/32/-bpp). This is because the logic to handle pixels smaller than
* 1-byte has not been implemented,
* 3. For FLAT and PROTECTED builds only. In those builds, the cursor
* image resides in the common application space and is assumed to pesist
* as long as needed. But with the KERNEL build, the image will lie in
* a process space and will not be generally available. In that case,
* we could keep the image in a shared memory region or perhaps copy the
* image into a kernel internal buffer. Neither of those are implemented.
*/
#if (defined(CONFIG_NX_SWCURSOR) && \
(defined(CONFIG_NX_LCDDRIVER) || !defined(CONFIG_NX_DISABLE_1BPP) || \
!defined(CONFIG_NX_DISABLE_2BPP) || !defined(CONFIG_NX_DISABLE_4BPP) || \
defined(CONFIG_BUILD_KERNEL)))
# undef CONFIG_NX_NOCURSOR
# undef CONFIG_NX_SWCURSOR
# define CONFIG_NX_NOCURSOR 1
#endif
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
+1 -1
View File
@@ -185,7 +185,7 @@ void nxgl_vectoradd(FAR struct nxgl_point_s *dest,
FAR const struct nxgl_point_s *v2); FAR const struct nxgl_point_s *v2);
/**************************************************************************** /****************************************************************************
* Name: nxgl_vectorsubtract * Name: nxgl_vectsubtract
* *
* Description: * Description:
* Add subtract vector v2 from vector v1 and return the result in vector dest * Add subtract vector v2 from vector v1 and return the result in vector dest
+17 -12
View File
@@ -40,11 +40,15 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/types.h> #include <sys/types.h>
#include <assert.h>
#include <errno.h> #include <errno.h>
#include <debug.h>
#include <nuttx/nx/nx.h>
#include <nuttx/nx/nxmu.h>
#include <nuttx/nx/nxcursor.h> #include <nuttx/nx/nxcursor.h>
#ifndef defined(CONFIG_NX_SWCURSOR) || defined(CONFIG_NX_HWCURSOR) #if defined(CONFIG_NX_SWCURSOR) || defined(CONFIG_NX_HWCURSOR)
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@@ -67,7 +71,7 @@
int nxcursor_enable(NXHANDLE hnd, bool enable) int nxcursor_enable(NXHANDLE hnd, bool enable)
{ {
FAR struct nxmu_conn_s *conn = (FAR struct nxmu_conn_s *)handle; FAR struct nxmu_conn_s *conn = (FAR struct nxmu_conn_s *)hnd;
struct nxsvrmsg_curenable_s outmsg; struct nxsvrmsg_curenable_s outmsg;
int ret; int ret;
@@ -81,7 +85,7 @@ int nxcursor_enable(NXHANDLE hnd, bool enable)
{ {
gerr("ERROR: nxmu_sendserver() returned %d\n", ret); gerr("ERROR: nxmu_sendserver() returned %d\n", ret);
set_errno(-ret); set_errno(-ret);
return ERROR return ERROR;
} }
return OK; return OK;
@@ -117,7 +121,7 @@ int nxcursor_enable(NXHANDLE hnd, bool enable)
#if defined(CONFIG_NX_HWCURSORIMAGE) || defined(CONFIG_NX_SWCURSOR) #if defined(CONFIG_NX_HWCURSORIMAGE) || defined(CONFIG_NX_SWCURSOR)
int nxcursor_setimage(NXHANDLE hnd, FAR struct nx_cursorimage_s *image) int nxcursor_setimage(NXHANDLE hnd, FAR struct nx_cursorimage_s *image)
{ {
FAR struct nxmu_conn_s *conn = (FAR struct nxmu_conn_s *)handle; FAR struct nxmu_conn_s *conn = (FAR struct nxmu_conn_s *)hnd;
struct nxsvrmsg_curimage_s outmsg; struct nxsvrmsg_curimage_s outmsg;
int ret; int ret;
@@ -126,13 +130,14 @@ int nxcursor_setimage(NXHANDLE hnd, FAR struct nx_cursorimage_s *image)
/* Send the new cursor image to the server */ /* Send the new cursor image to the server */
outmsg.msgid = NX_SVRMSG_CURSOR_IMAGE; outmsg.msgid = NX_SVRMSG_CURSOR_IMAGE;
outmsg.image.size.x = image->size.x; outmsg.image.size.w = image->size.w;
outmsg.image.size.y = image->size.y; outmsg.image.size.h = image->size.h;
outmsg.image.color1 = image->color1;
outmsg.image.color2 = image->color2;
outmsg.image.color3 = image->color3;
outmsg.image.image = image->image; /* The user pointer is sent, no data */ outmsg.image.image = image->image; /* The user pointer is sent, no data */
nxgl_colorcopy(outmsg.image.color1, image->color1);
nxgl_colorcopy(outmsg.image.color1, image->color1);
nxgl_colorcopy(outmsg.image.color1, image->color1);
/* We will finish the teardown upon receipt of the DISCONNECTED message */ /* We will finish the teardown upon receipt of the DISCONNECTED message */
ret = nxmu_sendserver(conn, &outmsg, sizeof(struct nxsvrmsg_curimage_s)); ret = nxmu_sendserver(conn, &outmsg, sizeof(struct nxsvrmsg_curimage_s));
@@ -140,7 +145,7 @@ int nxcursor_setimage(NXHANDLE hnd, FAR struct nx_cursorimage_s *image)
{ {
gerr("ERROR: nxmu_sendserver() returned %d\n", ret); gerr("ERROR: nxmu_sendserver() returned %d\n", ret);
set_errno(-ret); set_errno(-ret);
return ERROR return ERROR;
} }
return OK; return OK;
@@ -164,7 +169,7 @@ int nxcursor_setimage(NXHANDLE hnd, FAR struct nx_cursorimage_s *image)
int nxcursor_setposition(NXHANDLE hnd, FAR const struct nxgl_point_s *pos) int nxcursor_setposition(NXHANDLE hnd, FAR const struct nxgl_point_s *pos)
{ {
FAR struct nxmu_conn_s *conn = (FAR struct nxmu_conn_s *)handle; FAR struct nxmu_conn_s *conn = (FAR struct nxmu_conn_s *)hnd;
struct nxsvrmsg_curpos_s outmsg; struct nxsvrmsg_curpos_s outmsg;
int ret; int ret;
@@ -183,7 +188,7 @@ int nxcursor_setposition(NXHANDLE hnd, FAR const struct nxgl_point_s *pos)
{ {
gerr("ERROR: nxmu_sendserver() returned %d\n", ret); gerr("ERROR: nxmu_sendserver() returned %d\n", ret);
set_errno(-ret); set_errno(-ret);
return ERROR return ERROR;
} }
return OK; return OK;