* graphics/nxbe/nxbe_cursor_backupdraw.c
*
* SPDX-License-Identifier: Apache-2.0
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*
****************************************************************************/
* 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
*
****************************************************************************/
static inline void _nxbe_cursor_backupdraw_dev(
FAR struct nxbe_state_s *be,
FAR const struct nxgl_rect_s *rect,
int plane)
{
be->plane[plane].cursor.backup(be, rect, plane);
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;
if (be->cursor.visible)
{
nxgl_rectintersect(&bounds, rect, &be->bkgd.bounds);
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;
if (wnd->be->cursor.visible)
{
nxgl_rectoffset(&bounds, rect, wnd->bounds.pt1.x, wnd->bounds.pt1.y);
nxgl_rectintersect(&bounds, &bounds, &wnd->bounds);
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
* nxbe_cursor_backupdraw(); in graphics device coordinates for
* 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;
if (be->cursor.visible)
{
nxgl_rectintersect(&bounds, &bounds, &be->bkgd.bounds);
if (!nxgl_nullrect(&bounds))
{
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;
if (wnd->be->cursor.visible)
{
nxgl_rectoffset(&bounds, rect, wnd->bounds.pt1.x, wnd->bounds.pt1.y);
nxgl_rectintersect(&bounds, &bounds, &wnd->bounds);
nxbe_cursor_backupdraw_all(wnd, &bounds);
}
#else
nxbe_cursor_backupdraw(wnd, rect, 0);
#endif
}
#endif