2019-04-13 18:13:00 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* graphics/nxbe/nxbe_cursor_backupdraw.c
|
|
|
|
*
|
2024-09-10 09:30:58 +02:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
2021-02-05 11:12:53 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2019-04-13 18:13:00 +02:00
|
|
|
*
|
2021-02-05 11:12:53 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2019-04-13 18:13:00 +02:00
|
|
|
*
|
2021-02-05 11:12:53 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2019-04-13 18:13:00 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
#include "nxglib.h"
|
|
|
|
#include "nxbe.h"
|
|
|
|
|
|
|
|
#ifdef CONFIG_NX_SWCURSOR
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Private Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: _nxbe_cursor_backupdraw_dev
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Called after any modification to the display to backup and redraw one
|
|
|
|
* color plane
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* be - The back-end state structure instance
|
|
|
|
* rect - The modified region of the display, in device coordinates
|
|
|
|
* plane - The plane number to use.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-02-05 09:05:48 +01:00
|
|
|
static inline void _nxbe_cursor_backupdraw_dev(
|
|
|
|
FAR struct nxbe_state_s *be,
|
|
|
|
FAR const struct nxgl_rect_s *rect,
|
|
|
|
int plane)
|
2019-04-13 18:13:00 +02:00
|
|
|
{
|
|
|
|
/* Save the modified cursor background region. */
|
|
|
|
|
|
|
|
be->plane[plane].cursor.backup(be, rect, plane);
|
|
|
|
|
|
|
|
/* Restore the software cursor in the region that was modified. */
|
|
|
|
|
|
|
|
be->plane[plane].cursor.draw(be, rect, plane);
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxbe_cursor_backupdraw
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Called after any modification to the display (in window coordinate
|
|
|
|
* frame) to perform the backup-draw operation on one color plane.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* be - The back-end state structure instance, or
|
|
|
|
* wnd - Window state structure
|
|
|
|
* rect - The modified region of the window, in windows coordinates
|
|
|
|
* plane - The plane number to use.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void nxbe_cursor_backupdraw_dev(FAR struct nxbe_state_s *be,
|
|
|
|
FAR const struct nxgl_rect_s *rect,
|
|
|
|
int plane)
|
|
|
|
{
|
|
|
|
struct nxgl_rect_s bounds;
|
|
|
|
|
|
|
|
/* Update the software cursor if it is visible */
|
|
|
|
|
|
|
|
if (be->cursor.visible)
|
|
|
|
{
|
|
|
|
/* Clip to the limits of the display */
|
|
|
|
|
2019-04-13 23:08:32 +02:00
|
|
|
nxgl_rectintersect(&bounds, rect, &be->bkgd.bounds);
|
2019-04-13 18:13:00 +02:00
|
|
|
if (!nxgl_nullrect(&bounds))
|
|
|
|
{
|
|
|
|
_nxbe_cursor_backupdraw_dev(be, &bounds, plane);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void nxbe_cursor_backupdraw(FAR struct nxbe_window_s *wnd,
|
|
|
|
FAR const struct nxgl_rect_s *rect,
|
|
|
|
int plane)
|
|
|
|
{
|
|
|
|
struct nxgl_rect_s bounds;
|
|
|
|
|
|
|
|
/* Update the software cursor if it is visible */
|
|
|
|
|
|
|
|
if (wnd->be->cursor.visible)
|
|
|
|
{
|
|
|
|
/* Offset the rectangle to convert to device coordinates */
|
|
|
|
|
|
|
|
nxgl_rectoffset(&bounds, rect, wnd->bounds.pt1.x, wnd->bounds.pt1.y);
|
|
|
|
|
|
|
|
/* Clip to the limits of the window */
|
|
|
|
|
|
|
|
nxgl_rectintersect(&bounds, &bounds, &wnd->bounds);
|
|
|
|
|
|
|
|
/* Let nxbe_cursor_backupdraw_dev() do the rest */
|
|
|
|
|
|
|
|
nxbe_cursor_backupdraw_dev(wnd->be, &bounds, plane);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxbe_cursor_backupdraw_all and nxbe_cursor_backupdraw_devall
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Called after any modification to the display to perform the backup-draw
|
|
|
|
* operation on all color planes.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* be - The back-end state structure instance, or
|
|
|
|
* wnd - Window state structure
|
|
|
|
* rect - The modified region of the window. In windows coordinates for
|
2020-02-23 09:50:23 +01:00
|
|
|
* nxbe_cursor_backupdraw(); in graphics device coordinates for
|
2019-04-13 18:13:00 +02:00
|
|
|
* nxbe_cursor_backupdraw_dev().
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void nxbe_cursor_backupdraw_devall(FAR struct nxbe_state_s *be,
|
|
|
|
FAR const struct nxgl_rect_s *rect)
|
|
|
|
{
|
|
|
|
#if CONFIG_NX_NPLANES > 1
|
|
|
|
struct nxgl_rect_s bounds;
|
|
|
|
int plane;
|
|
|
|
|
|
|
|
/* Update the software cursor if it is visible */
|
|
|
|
|
|
|
|
if (be->cursor.visible)
|
|
|
|
{
|
|
|
|
/* Clip to the limits of the display */
|
|
|
|
|
|
|
|
nxgl_rectintersect(&bounds, &bounds, &be->bkgd.bounds);
|
|
|
|
if (!nxgl_nullrect(&bounds))
|
|
|
|
{
|
|
|
|
/* Perform the backup-draw operation on all color planes */
|
|
|
|
|
|
|
|
for (plane = 0; plane < CONFIG_NX_NPLANES; plane++)
|
|
|
|
{
|
|
|
|
_nxbe_cursor_backupdraw_dev(be, &bounds, plane);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
nxbe_cursor_backupdraw_dev(be, rect, 0);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void nxbe_cursor_backupdraw_all(FAR struct nxbe_window_s *wnd,
|
|
|
|
FAR const struct nxgl_rect_s *rect)
|
|
|
|
{
|
|
|
|
#if CONFIG_NX_NPLANES > 1
|
|
|
|
struct nxgl_rect_s bounds;
|
|
|
|
|
|
|
|
/* Update the software cursor if it is visible */
|
|
|
|
|
|
|
|
if (wnd->be->cursor.visible)
|
|
|
|
{
|
|
|
|
/* Offset the rectangle to convert it to device coordinates */
|
|
|
|
|
|
|
|
nxgl_rectoffset(&bounds, rect, wnd->bounds.pt1.x, wnd->bounds.pt1.y);
|
|
|
|
|
|
|
|
/* Clip to the limits of the window */
|
|
|
|
|
|
|
|
nxgl_rectintersect(&bounds, &bounds, &wnd->bounds);
|
|
|
|
|
|
|
|
/* And then let nxbe_cursor_backupdraw_devall() do the rest */
|
|
|
|
|
2019-04-13 23:08:32 +02:00
|
|
|
nxbe_cursor_backupdraw_all(wnd, &bounds);
|
2019-04-13 18:13:00 +02:00
|
|
|
}
|
|
|
|
#else
|
2019-04-13 23:08:32 +02:00
|
|
|
nxbe_cursor_backupdraw(wnd, rect, 0);
|
2019-04-13 18:13:00 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_NX_SWCURSOR */
|