diff --git a/arch/arm/src/lpc17xx/lpc17_lcd.c b/arch/arm/src/lpc17xx/lpc17_lcd.c index 04a95d69c1..e7aebe109f 100644 --- a/arch/arm/src/lpc17xx/lpc17_lcd.c +++ b/arch/arm/src/lpc17xx/lpc17_lcd.c @@ -160,12 +160,12 @@ static const struct fb_planeinfo_s g_planeinfo = /* Current cursor position */ #ifdef CONFIG_FB_HWCURSOR -static struct cursor_pos_s g_cpos; +static struct fb_cursorpos_s g_cpos; /* Current cursor size */ #ifdef CONFIG_FB_HWCURSORSIZE -static struct cursor_size_s g_csize; +static struct fb_cursorsize_s g_csize; #endif #endif diff --git a/arch/arm/src/lpc54xx/lpc54_lcd.c b/arch/arm/src/lpc54xx/lpc54_lcd.c index adc0a30e21..2b8b5aa262 100644 --- a/arch/arm/src/lpc54xx/lpc54_lcd.c +++ b/arch/arm/src/lpc54xx/lpc54_lcd.c @@ -147,12 +147,12 @@ static const struct fb_planeinfo_s g_planeinfo = /* Current cursor position */ #ifdef CONFIG_FB_HWCURSOR -static struct cursor_pos_s g_cpos; +static struct fb_cursorpos_s g_cpos; /* Current cursor size */ #ifdef CONFIG_FB_HWCURSORSIZE -static struct cursor_size_s g_csize; +static struct fb_cursorsize_s g_csize; #endif #endif diff --git a/arch/arm/src/sama5/sam_lcd.c b/arch/arm/src/sama5/sam_lcd.c index 2033e45861..ed1f33c96a 100644 --- a/arch/arm/src/sama5/sam_lcd.c +++ b/arch/arm/src/sama5/sam_lcd.c @@ -645,9 +645,9 @@ struct sam_lcdc_s struct sam_layer_s layer[LCDC_NLAYERS]; #ifdef CONFIG_FB_HWCURSOR - struct cursor_pos_s cpos; /* Current cursor position */ + struct fb_cursorpos_s cpos; /* Current cursor position */ #ifdef CONFIG_FB_HWCURSORSIZE - struct cursor_size_s csize; /* Current cursor size */ + struct fb_cursorsize_s csize; /* Current cursor size */ #endif #endif diff --git a/arch/sim/src/up_framebuffer.c b/arch/sim/src/up_framebuffer.c index 4510569258..8178c3994d 100644 --- a/arch/sim/src/up_framebuffer.c +++ b/arch/sim/src/up_framebuffer.c @@ -152,12 +152,12 @@ static struct fb_planeinfo_s g_planeinfo; /* Current cursor position */ #ifdef CONFIG_FB_HWCURSOR -static struct cursor_pos_s g_cpos; +static struct fb_cursorpos_s g_cpos; /* Current cursor size */ #ifdef CONFIG_FB_HWCURSORSIZE -static struct cursor_size_s g_csize; +static struct fb_cursorsize_s g_csize; #endif #endif diff --git a/graphics/nxbe/nxbe.h b/graphics/nxbe/nxbe.h index 3035d81e47..b1c91df4a8 100644 --- a/graphics/nxbe/nxbe.h +++ b/graphics/nxbe/nxbe.h @@ -196,7 +196,7 @@ struct nxbe_cursor_s struct nxbe_cursor_s { bool visible; /* True: the cursor is visible */ - struct cursor_pos_s pos; /* The current cursor position */ + struct nxgl_point_s pos; /* The current cursor position */ }; #endif @@ -321,7 +321,7 @@ void nxbe_cursor_enable(FAR struct nxbe_state_s *be, bool enable); #if defined(CONFIG_NX_HWCURSORIMAGE) || defined(CONFIG_NX_SWCURSOR) void nxbe_cursor_setimage(FAR struct nxbe_state_s *be, - FAR struct cursor_image_s *image); + FAR struct nx_cursorimage_s *image); #endif /**************************************************************************** @@ -340,7 +340,7 @@ void nxbe_cursor_setimage(FAR struct nxbe_state_s *be, ****************************************************************************/ void nxcursor_setposition(FAR struct nxbe_state_s *be, - FAR const struct cursor_pos_s *pos); + FAR const struct nxgl_point_s *pos); #endif /* CONFIG_NX_SWCURSOR || CONFIG_NX_HWCURSOR */ /**************************************************************************** diff --git a/graphics/nxbe/nxbe_cursor.c b/graphics/nxbe/nxbe_cursor.c index b8d590423b..19ec96a3bb 100644 --- a/graphics/nxbe/nxbe_cursor.c +++ b/graphics/nxbe/nxbe_cursor.c @@ -300,7 +300,7 @@ void nxbe_cursor_enable(FAR struct nxbe_state_s *be, bool enable) #if defined(CONFIG_NX_HWCURSORIMAGE) || defined(CONFIG_NX_SWCURSOR) void nxbe_cursor_setimage(FAR struct nxbe_state_s *be, - FAR struct cursor_image_s *image); + FAR struct nx_cursorimage_s *image); { #warning Missing logic } @@ -322,7 +322,7 @@ void nxbe_cursor_setimage(FAR struct nxbe_state_s *be, ****************************************************************************/ void nxcursor_setposition(FAR struct nxbe_state_s *be, - FAR const struct cursor_pos_s *pos) + FAR const struct nxgl_point_s *pos) { #warning Missing logic } diff --git a/graphics/vnc/server/vnc_fbdev.c b/graphics/vnc/server/vnc_fbdev.c index 999b40f0b6..bfba6e0c0d 100644 --- a/graphics/vnc/server/vnc_fbdev.c +++ b/graphics/vnc/server/vnc_fbdev.c @@ -132,12 +132,12 @@ static int up_setcursor(FAR struct fb_vtable_s *vtable, /* Current cursor position */ #ifdef CONFIG_FB_HWCURSOR -static struct cursor_pos_s g_cpos; +static struct fb_cursorpos_s g_cpos; /* Current cursor size */ #ifdef CONFIG_FB_HWCURSORSIZE -static struct cursor_size_s g_csize; +static struct fb_cursorsize_s g_csize; #endif #endif diff --git a/include/nuttx/nx/nxcursor.h b/include/nuttx/nx/nxcursor.h index f3ff842bb9..52b519c985 100644 --- a/include/nuttx/nx/nxcursor.h +++ b/include/nuttx/nx/nxcursor.h @@ -46,7 +46,7 @@ #include #include -#include +#include #ifndef defined(CONFIG_NX_SWCURSOR) || defined(CONFIG_NX_HWCURSOR) @@ -59,6 +59,31 @@ extern "C" #define EXTERN extern #endif +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/* For cursor controllers that support custem cursor images, this structure + * is used to provide the cursor image. + * + * The image is provided a a 2-bits-per-pixel image. The two bit incoding + * is as followings: + * + * 00 - The transparent background + * 01 - Color1: The main color of the cursor + * 10 - Color2: The color of any border + * 11 - Color3: A blend color for better imaging (fake anti-aliasing). + */ + +struct nx_cursorimage_s +{ + struct nxgl_size_s size; /* The size of the cursor image */ + nxgl_mxpixel_t color1[CONFIG_NX_NPLANES]; /* Color1 is main color of the cursor */ + 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 */ + FAR const uint8_t *image; /* Pointer to bitmap image data */ +}; + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -108,7 +133,7 @@ int nxcursor_enable(NXHANDLE hnd, bool enable); ****************************************************************************/ #if defined(CONFIG_NX_HWCURSORIMAGE) || defined(CONFIG_NX_SWCURSOR) -int nxcursor_setimage(NXHANDLE hnd, FAR struct cursor_image_s *image); +int nxcursor_setimage(NXHANDLE hnd, FAR struct nx_cursorimage_s *image); #endif /**************************************************************************** @@ -126,7 +151,7 @@ int nxcursor_setimage(NXHANDLE hnd, FAR struct cursor_image_s *image); * ****************************************************************************/ -int nxcursor_setposition(NXHANDLE hnd, FAR const struct cursor_pos_s *pos); +int nxcursor_setposition(NXHANDLE hnd, FAR const struct nxgl_point_s *pos); /**************************************************************************** * Name: nxcursor_get_position @@ -148,7 +173,7 @@ int nxcursor_setposition(NXHANDLE hnd, FAR const struct cursor_pos_s *pos); * ****************************************************************************/ -int nxcursor_get_position(NXHANDLE hnd, FAR struct cursor_pos_s *pos); +int nxcursor_get_position(NXHANDLE hnd, FAR struct nxgl_point_s *pos); #undef EXTERN #if defined(__cplusplus) diff --git a/include/nuttx/nx/nxmu.h b/include/nuttx/nx/nxmu.h index b4bfff0668..a0091dcc3d 100644 --- a/include/nuttx/nx/nxmu.h +++ b/include/nuttx/nx/nxmu.h @@ -49,6 +49,7 @@ #include #include +#include /**************************************************************************** * Pre-processor Definitions @@ -312,8 +313,8 @@ struct nxsvrmsg_curenable_s struct nxsvrmsg_curimage_s { - uint32_t msgid; /* NX_SVRMSG_CURSOR_IMAGE */ - FAR struct cursor_image_s image /* Describes the cursor image */ + uint32_t msgid; /* NX_SVRMSG_CURSOR_IMAGE */ + FAR struct nx_cursorimage_s image /* Describes the cursor image */ }; #endif @@ -321,8 +322,8 @@ struct nxsvrmsg_curimage_s struct nxsvrmsg_curpos_s { - uint32_t msgid; /* NX_SVRMSG_CURSOR_SETPOS */ - FAR struct cursor_pos_s pos; /* The new cursor position */ + uint32_t msgid; /* NX_SVRMSG_CURSOR_SETPOS */ + FAR struct nxgl_point_s pos; /* The new cursor position */ }; #endif diff --git a/include/nuttx/video/cursor.h b/include/nuttx/video/cursor.h deleted file mode 100644 index bc54df0471..0000000000 --- a/include/nuttx/video/cursor.h +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** - * include/nuttx/video/cursor.h - * - * Copyright (C) 2008-2011, 2013, 2016-2019 Gregory Nutt. All rights - * reserved. - * Author: Gregory Nutt - * - * 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. - * - ****************************************************************************/ - -#ifndef __INCLUDE_NUTTX_VIDEO_CURSOR_H -#define __INCLUDE_NUTTX_VIDEO_CURSOR_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -#ifdef CONFIG_NX -# include -#else -# include -#endif - -/**************************************************************************** - * Pre-processor definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -#ifdef CONFIG_NX -/* If NX is defined, make types agree with NX */ - -typedef nxgl_coord_t cursor_coord_t; -typedef nxgl_mxpixel_t cursor_color_t[CONFIG_NX_NPLANES]; - -#else -/* Otherwise use framebuffer and worst case types */ - -typedef fb_coord_t cursor_coord_t; -typedef uint32_t cursor_color_t; - -#endif - -/* For cursor controllers that support custem cursor images, this structure - * is used to provide the cursor image. - * - * The image is provided a a 2-bits-per-pixel image. The two bit incoding - * is as followings: - * - * 00 - The transparent background - * 01 - Color1: The main color of the cursor - * 10 - Color2: The color of any border - * 11 - Color3: A blend color for better imaging (fake anti-aliasing). - */ - -struct cursor_image_s -{ - cursor_coord_t width; /* Width of the cursor image in pixels */ - cursor_coord_t height; /* Height of the cursor image in pixels */ - cursor_color_t color1; /* Color1 is main color of the cursor */ - cursor_color_t color2; /* Color2 is color of any border */ - cursor_color_t color3; /* Color3 is the blended color */ - FAR const uint8_t *image; /* Pointer to bitmap image data */ -}; - -/* The following structure defines the cursor position. If CONFIG_NX=y, - * this structure is equivalent to struct nxgl_pos_s. - */ - -struct cursor_pos_s -{ - cursor_coord_t x; /* X position in pixels */ - cursor_coord_t y; /* Y position in rows */ -}; - -/* If the hardware supports setting the cursor size, then this structure - * is used to provide the cursor size. If CONFIG_NX=y, this structure is - * equivalent to struct nxgl_size_s. - */ - -struct cursor_size_s -{ - cursor_coord_t h; /* Height in rows */ - cursor_coord_t w; /* Width in pixels */ -}; - -#endif /* __INCLUDE_NUTTX_VIDEO_CURSOR_H */ diff --git a/include/nuttx/video/fb.h b/include/nuttx/video/fb.h index f11f3b3c25..5bc7387e0c 100644 --- a/include/nuttx/video/fb.h +++ b/include/nuttx/video/fb.h @@ -47,7 +47,6 @@ #include #include -#include /**************************************************************************** * Pre-processor definitions @@ -412,6 +411,40 @@ struct fb_cmap_s #endif #ifdef CONFIG_FB_HWCURSOR +#ifdef CONFIG_FB_HWCURSORIMAGE +/* If the video controller hardware supports a hardware cursor and + * that hardware cursor supports user-provided images, then the + * following structure may be used to provide the cursor image + */ + +struct fb_cursorimage_s +{ + fb_coord_t width; /* Width of the cursor image in pixels */ + fb_coord_t height /* Height of the cursor image in pixels */ + const uint8_t *image; /* Pointer to image data */ +}; +#endif + +/* The following structure defines the cursor position/size */ + +struct fb_cursorpos_s +{ + fb_coord_t x; /* X position in pixels */ + fb_coord_t y; /* Y position in rows */ +}; + +/* If the hardware supports setting the cursor size, then this structure + * is used to provide the size. + */ + +#ifdef CONFIG_FB_HWCURSORSIZE +struct fb_cursorsize_s +{ + fb_coord_t h; /* Height in rows */ + fb_coord_t w; /* Width in pixels */ +}; +#endif + /* The following are used to get/get the cursor attributes via IOCTL command. */ struct fb_cursorattrib_s @@ -419,22 +452,22 @@ struct fb_cursorattrib_s #ifdef CONFIG_FB_HWCURSORIMAGE uint8_t fmt; /* Video format of cursor */ #endif - struct cursor_pos_s pos; /* Current cursor position */ + struct fb_cursorpos_s pos; /* Current cursor position */ #ifdef CONFIG_FB_HWCURSORSIZE - struct cursor_size_s mxsize; /* Maximum cursor size */ - struct cursor_size_s size; /* Current size */ + struct fb_cursorsize_s mxsize; /* Maximum cursor size */ + struct fb_cursorsize_s size; /* Current size */ #endif }; struct fb_setcursor_s { - uint8_t flags; /* See FB_CUR_* definitions */ - struct cursor_pos_s pos; /* Cursor position */ + uint8_t flags; /* See FB_CUR_* definitions */ + struct fb_cursorpos_s pos; /* Cursor position */ #ifdef CONFIG_FB_HWCURSORSIZE - struct cursor_size_s size; /* Cursor size */ + struct fb_cursorsize_s size; /* Cursor size */ #endif #ifdef CONFIG_FB_HWCURSORIMAGE - struct cursor_image_s img; /* Cursor image */ + struct fb_cursorimage_s img; /* Cursor image */ #endif }; #endif diff --git a/libs/libnx/nxmu/nx_cursor.c b/libs/libnx/nxmu/nx_cursor.c index ca9c57ec47..34f50e5913 100644 --- a/libs/libnx/nxmu/nx_cursor.c +++ b/libs/libnx/nxmu/nx_cursor.c @@ -42,7 +42,6 @@ #include #include -#include #include #ifndef defined(CONFIG_NX_SWCURSOR) || defined(CONFIG_NX_HWCURSOR) @@ -116,7 +115,7 @@ int nxcursor_enable(NXHANDLE hnd, bool enable) ****************************************************************************/ #if defined(CONFIG_NX_HWCURSORIMAGE) || defined(CONFIG_NX_SWCURSOR) -int nxcursor_setimage(NXHANDLE hnd, FAR struct cursor_image_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; struct nxsvrmsg_curimage_s outmsg; @@ -127,8 +126,8 @@ int nxcursor_setimage(NXHANDLE hnd, FAR struct cursor_image_s *image) /* Send the new cursor image to the server */ outmsg.msgid = NX_SVRMSG_CURSOR_IMAGE; - outmsg.image.width = image->width; - outmsg.image.height = image->height; + outmsg.image.size.x = image->size.x; + outmsg.image.size.y = image->size.y; outmsg.image.color1 = image->color1; outmsg.image.color2 = image->color2; outmsg.image.color3 = image->color3; @@ -163,7 +162,7 @@ int nxcursor_setimage(NXHANDLE hnd, FAR struct cursor_image_s *image) * ****************************************************************************/ -int nxcursor_setposition(NXHANDLE hnd, FAR const struct cursor_pos_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; struct nxsvrmsg_curpos_s outmsg; @@ -210,7 +209,7 @@ int nxcursor_setposition(NXHANDLE hnd, FAR const struct cursor_pos_s *pos) * ****************************************************************************/ -int nxcursor_get_position(NXHANDLE hnd, FAR struct cursor_pos_s *pos) +int nxcursor_get_position(NXHANDLE hnd, FAR struct nxgl_point_s *pos) { /* REVISIT: The cursor position is not accessible from here. It is in hnd, * be we don't have the definitions exposed to get it.