NX: Add configurable callout to external logic to handle display update events
This commit is contained in:
parent
aa64214877
commit
52b308cbe1
@ -56,6 +56,30 @@ config NX_WRITEONLY
|
|||||||
Automatically defined if NX_LCDDRIVER and LCD_NOGETRUN are
|
Automatically defined if NX_LCDDRIVER and LCD_NOGETRUN are
|
||||||
defined.
|
defined.
|
||||||
|
|
||||||
|
config NX_UPDATE
|
||||||
|
bool "Display update hooks'
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enable a callout to inform some external module that the display has
|
||||||
|
been updated. This would be useful in a couple for cases.
|
||||||
|
|
||||||
|
- When a serial LCD is used, but a framebuffer is used to access the
|
||||||
|
LCD. In this case, the update callout can be used to refresh the
|
||||||
|
affected region of the display.
|
||||||
|
|
||||||
|
- When VNC is enabled. This is case, this callout is necessary to
|
||||||
|
update the remote frame buffer to match the local framebuffer.
|
||||||
|
|
||||||
|
When this feature is enabled, some external logic must provide this
|
||||||
|
interface:
|
||||||
|
|
||||||
|
void nx_notify_rectangle(FAR NX_PLANEINFOTYPE *pinfo,
|
||||||
|
FAR const struct nxgl_rect_s *rect);
|
||||||
|
|
||||||
|
That is the function that will handle the notification. It
|
||||||
|
receives the rectangular region that was updated in the provided
|
||||||
|
plane.
|
||||||
|
|
||||||
menu "Supported Pixel Depths"
|
menu "Supported Pixel Depths"
|
||||||
|
|
||||||
config NX_DISABLE_1BPP
|
config NX_DISABLE_1BPP
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* graphics/nxbe/nxbe_bitmap.c
|
* graphics/nxbe/nxbe_bitmap.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2008-2009, 2012, 2016 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
|
||||||
@ -75,8 +75,17 @@ static void nxs_clipcopy(FAR struct nxbe_clipops_s *cops,
|
|||||||
FAR const struct nxgl_rect_s *rect)
|
FAR const struct nxgl_rect_s *rect)
|
||||||
{
|
{
|
||||||
struct nx_bitmap_s *bminfo = (struct nx_bitmap_s *)cops;
|
struct nx_bitmap_s *bminfo = (struct nx_bitmap_s *)cops;
|
||||||
|
|
||||||
|
/* Copy the rectangular region */
|
||||||
|
|
||||||
plane->copyrectangle(&plane->pinfo, rect, bminfo->src,
|
plane->copyrectangle(&plane->pinfo, rect, bminfo->src,
|
||||||
&bminfo->origin, bminfo->stride);
|
&bminfo->origin, bminfo->stride);
|
||||||
|
|
||||||
|
#ifdef CONFIG_NX_UPDATE
|
||||||
|
/* Notify external logic that the display has been updated */
|
||||||
|
|
||||||
|
nx_notify_rectangle(&plane->pinfo, rect);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -153,6 +162,7 @@ void nxbe_bitmap(FAR struct nxbe_window_s *wnd, FAR const struct nxgl_rect_s *de
|
|||||||
|
|
||||||
nxgl_rectintersect(&remaining, &bounds, &wnd->bounds);
|
nxgl_rectintersect(&remaining, &bounds, &wnd->bounds);
|
||||||
nxgl_rectintersect(&remaining, &remaining, &wnd->be->bkgd.bounds);
|
nxgl_rectintersect(&remaining, &remaining, &wnd->be->bkgd.bounds);
|
||||||
|
|
||||||
if (nxgl_nullrect(&remaining))
|
if (nxgl_nullrect(&remaining))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -177,4 +187,3 @@ void nxbe_bitmap(FAR struct nxbe_window_s *wnd, FAR const struct nxgl_rect_s *de
|
|||||||
&info.cops, &wnd->be->plane[i]);
|
&info.cops, &wnd->be->plane[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* graphics/nxbe/nxbe_fill.c
|
* graphics/nxbe/nxbe_fill.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2008-2009, 2011, 2016 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
|
||||||
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <nuttx/nx/nxglib.h>
|
#include <nuttx/nx/nxglib.h>
|
||||||
|
#include <nuttx/nx/nx.h>
|
||||||
|
|
||||||
#include "nxbe.h"
|
#include "nxbe.h"
|
||||||
|
|
||||||
@ -71,7 +72,16 @@ static void nxbe_clipfill(FAR struct nxbe_clipops_s *cops,
|
|||||||
FAR const struct nxgl_rect_s *rect)
|
FAR const struct nxgl_rect_s *rect)
|
||||||
{
|
{
|
||||||
struct nxbe_fill_s *fillinfo = (struct nxbe_fill_s *)cops;
|
struct nxbe_fill_s *fillinfo = (struct nxbe_fill_s *)cops;
|
||||||
|
|
||||||
|
/* Draw the rectangle */
|
||||||
|
|
||||||
plane->fillrectangle(&plane->pinfo, rect, fillinfo->color);
|
plane->fillrectangle(&plane->pinfo, rect, fillinfo->color);
|
||||||
|
|
||||||
|
#ifdef CONFIG_NX_UPDATE
|
||||||
|
/* Notify external logic that the display has been updated */
|
||||||
|
|
||||||
|
nx_notify_rectangle(&plane->pinfo, rect);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* graphics/nxbe/nxbe_filltrapezoid.c
|
* graphics/nxbe/nxbe_filltrapezoid.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2008-2009, 2012, 2016 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
|
||||||
@ -44,6 +44,18 @@
|
|||||||
|
|
||||||
#include "nxbe.h"
|
#include "nxbe.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef MIN
|
||||||
|
# define MIN(a,b) (((a) < (b)) ? (a) : (b)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MAX
|
||||||
|
# define MAX(a,b) (((a) > (b)) ? (a) : (b)
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Types
|
* Private Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -73,7 +85,26 @@ static void nxbe_clipfilltrapezoid(FAR struct nxbe_clipops_s *cops,
|
|||||||
FAR const struct nxgl_rect_s *rect)
|
FAR const struct nxgl_rect_s *rect)
|
||||||
{
|
{
|
||||||
struct nxbe_filltrap_s *fillinfo = (struct nxbe_filltrap_s *)cops;
|
struct nxbe_filltrap_s *fillinfo = (struct nxbe_filltrap_s *)cops;
|
||||||
|
#ifdef CONFIG_NX_UPDATE
|
||||||
|
FAR const struct nxgl_rect_s *update;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Draw the trapezond */
|
||||||
|
|
||||||
plane->filltrapezoid(&plane->pinfo, &fillinfo->trap, rect, fillinfo->color);
|
plane->filltrapezoid(&plane->pinfo, &fillinfo->trap, rect, fillinfo->color);
|
||||||
|
|
||||||
|
#ifdef CONFIG_NX_UPDATE
|
||||||
|
/* Notify external logic that the display has been updated */
|
||||||
|
|
||||||
|
update.pt1.x = MIN(MAX(fillinfo->trap.top.x1, rect->pt1.x),
|
||||||
|
MAX(fillinfo->trap.bot.x1, rect->pt1.x));
|
||||||
|
update.pt1.y = MAX(fillinfo->trap.top.y, rect->pt1.y);
|
||||||
|
update.pt2.x = MAX(MIN(fillinfo->trap.top.x2, rect->pt2.x),
|
||||||
|
MIN(fillinfo->trap.bot.x2, rect->pt2.x));
|
||||||
|
update.pt2.y = MIN(fillinfo->trap.bot.y, rect->pt2.y);
|
||||||
|
|
||||||
|
nx_notify_rectangle(&plane->pinfo, &update);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* graphics/nxbe/nxbe_move.c
|
* graphics/nxbe/nxbe_move.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2008-2009, 2011-2012, 2016 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
|
||||||
@ -78,6 +78,9 @@ static void nxbe_clipmovesrc(FAR struct nxbe_clipops_s *cops,
|
|||||||
{
|
{
|
||||||
struct nxbe_move_s *info = (struct nxbe_move_s *)cops;
|
struct nxbe_move_s *info = (struct nxbe_move_s *)cops;
|
||||||
struct nxgl_point_s offset;
|
struct nxgl_point_s offset;
|
||||||
|
#ifdef CONFIG_NX_UPDATE
|
||||||
|
FAR const struct nxgl_rect_s *update;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (info->offset.x != 0 || info->offset.y != 0)
|
if (info->offset.x != 0 || info->offset.y != 0)
|
||||||
{
|
{
|
||||||
@ -86,7 +89,20 @@ static void nxbe_clipmovesrc(FAR struct nxbe_clipops_s *cops,
|
|||||||
offset.x = rect->pt1.x + info->offset.x;
|
offset.x = rect->pt1.x + info->offset.x;
|
||||||
offset.y = rect->pt1.y + info->offset.y;
|
offset.y = rect->pt1.y + info->offset.y;
|
||||||
|
|
||||||
|
/* Move the source rectangle to the destination position */
|
||||||
|
|
||||||
plane->moverectangle(&plane->pinfo, rect, &offset);
|
plane->moverectangle(&plane->pinfo, rect, &offset);
|
||||||
|
|
||||||
|
#ifdef CONFIG_NX_UPDATE
|
||||||
|
/* Notify external logic that the display has been updated */
|
||||||
|
|
||||||
|
update.pt1.x = offset.x;
|
||||||
|
update.pt1.y = offset.y;
|
||||||
|
update.pt2.x = rect->pt2.x + info->offset.x;
|
||||||
|
update.pt2.y = rect->pt2.y + info->offset.y;
|
||||||
|
|
||||||
|
nx_notify_rectangle(&plane->pinfo, &update);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* graphics/nxbe/nxbe_setpixel.c
|
* graphics/nxbe/nxbe_setpixel.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011, 2016 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
|
||||||
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <nuttx/nx/nxglib.h>
|
#include <nuttx/nx/nxglib.h>
|
||||||
|
#include <nuttx/nx/nx.h>
|
||||||
|
|
||||||
#include "nxbe.h"
|
#include "nxbe.h"
|
||||||
|
|
||||||
@ -71,7 +72,16 @@ static void nxbe_clipfill(FAR struct nxbe_clipops_s *cops,
|
|||||||
FAR const struct nxgl_rect_s *rect)
|
FAR const struct nxgl_rect_s *rect)
|
||||||
{
|
{
|
||||||
struct nxbe_setpixel_s *fillinfo = (struct nxbe_setpixel_s *)cops;
|
struct nxbe_setpixel_s *fillinfo = (struct nxbe_setpixel_s *)cops;
|
||||||
|
|
||||||
|
/* Set the pixel */
|
||||||
|
|
||||||
plane->setpixel(&plane->pinfo, &rect->pt1, fillinfo->color);
|
plane->setpixel(&plane->pinfo, &rect->pt1, fillinfo->color);
|
||||||
|
|
||||||
|
#ifdef CONFIG_NX_UPDATE
|
||||||
|
/* Notify external logic that the display has been updated */
|
||||||
|
|
||||||
|
nx_notify_rectangle(&plane->pinfo, rect);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -79,7 +89,7 @@ static void nxbe_clipfill(FAR struct nxbe_clipops_s *cops,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nxbe_fill
|
* Name: nxbe_setpixel
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Fill the specified rectangle in the window with the specified color
|
* Fill the specified rectangle in the window with the specified color
|
||||||
|
@ -901,6 +901,32 @@ int nx_bitmap(NXWINDOW hwnd, FAR const struct nxgl_rect_s *dest,
|
|||||||
FAR const void *src[CONFIG_NX_NPLANES],
|
FAR const void *src[CONFIG_NX_NPLANES],
|
||||||
FAR const struct nxgl_point_s *origin, unsigned int stride);
|
FAR const struct nxgl_point_s *origin, unsigned int stride);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: nx_notify_rectangle
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* When CONFIG_NX_UPDATE=y, then the graphics system will callout to
|
||||||
|
* inform some external module that the display has been updated. This
|
||||||
|
* would be useful in a couple for cases.
|
||||||
|
*
|
||||||
|
* - When a serial LCD is used, but a framebuffer is used to access the
|
||||||
|
* LCD. In this case, the update callout can be used to refresh the
|
||||||
|
* affected region of the display.
|
||||||
|
*
|
||||||
|
* - When VNC is enabled. This is case, this callout is necessary to
|
||||||
|
* update the remote frame buffer to match the local framebuffer.
|
||||||
|
*
|
||||||
|
* When this feature is enabled, some external logic must provide this
|
||||||
|
* interface. This is the function that will handle the notification. It
|
||||||
|
* receives the rectangular region that was updated on the provided plane.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_NX_UPDATE
|
||||||
|
void nx_notify_rectangle(FAR NX_PLANEINFOTYPE *pinfo,
|
||||||
|
FAR const struct nxgl_rect_s *rect);
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: nx_kbdin
|
* Name: nx_kbdin
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user