2012-03-28 03:40:49 +08:00
|
|
|
/****************************************************************************
|
2021-03-09 05:39:04 +08:00
|
|
|
* graphics/nxterm/nxterm_redraw.c
|
2012-03-28 03:40:49 +08:00
|
|
|
*
|
2021-02-05 18:12:53 +08: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
|
2012-03-28 03:40:49 +08:00
|
|
|
*
|
2021-02-05 18:12:53 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2012-03-28 03:40:49 +08:00
|
|
|
*
|
2021-02-05 18:12:53 +08: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.
|
2012-03-28 03:40:49 +08:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <debug.h>
|
|
|
|
|
|
|
|
#include <nuttx/nx/nx.h>
|
|
|
|
#include <nuttx/nx/nxglib.h>
|
|
|
|
|
2014-09-21 05:53:28 +08:00
|
|
|
#include "nxterm.h"
|
2012-03-28 03:40:49 +08:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2014-09-21 05:53:28 +08:00
|
|
|
* Name: nxterm_redraw
|
2012-03-28 03:40:49 +08:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Re-draw a portion of the NX console. This function should be called
|
|
|
|
* from the appropriate window callback logic.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* handle - A handle previously returned by nx_register, nxtk_register, or
|
|
|
|
* nxtool_register.
|
|
|
|
* rect - The rectangle that needs to be re-drawn (in window relative
|
|
|
|
* coordinates)
|
|
|
|
* more - true: More re-draw requests will follow
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-02-05 16:05:48 +08:00
|
|
|
void nxterm_redraw(NXTERM handle,
|
|
|
|
FAR const struct nxgl_rect_s *rect,
|
|
|
|
bool more)
|
2012-03-28 03:40:49 +08:00
|
|
|
{
|
2014-09-21 05:53:28 +08:00
|
|
|
FAR struct nxterm_state_s *priv;
|
2012-03-28 03:40:49 +08:00
|
|
|
int ret;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
DEBUGASSERT(handle && rect);
|
2016-06-12 01:59:51 +08:00
|
|
|
ginfo("rect={(%d,%d),(%d,%d)} more=%s\n",
|
2012-03-28 03:40:49 +08:00
|
|
|
rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y,
|
|
|
|
more ? "true" : "false");
|
|
|
|
|
|
|
|
/* Recover our private state structure */
|
|
|
|
|
2014-09-21 05:53:28 +08:00
|
|
|
priv = (FAR struct nxterm_state_s *)handle;
|
2012-03-28 03:40:49 +08:00
|
|
|
|
2012-03-29 03:29:30 +08:00
|
|
|
/* Get exclusive access to the state structure */
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2022-09-06 14:18:45 +08:00
|
|
|
ret = nxmutex_lock(&priv->lock);
|
2012-03-29 03:29:30 +08:00
|
|
|
}
|
|
|
|
while (ret < 0);
|
|
|
|
|
2012-03-28 03:40:49 +08:00
|
|
|
/* Fill the rectangular region with the window background color */
|
|
|
|
|
|
|
|
ret = priv->ops->fill(priv, rect, priv->wndo.wcolor);
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
2021-02-15 16:08:51 +08:00
|
|
|
gerr("ERROR: fill failed: %d\n", get_errno());
|
2012-03-28 03:40:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Then redraw each character on the display (Only the characters within
|
|
|
|
* the rectangle will actually be redrawn).
|
|
|
|
*/
|
|
|
|
|
|
|
|
for (i = 0; i < priv->nchars; i++)
|
|
|
|
{
|
2014-09-21 05:53:28 +08:00
|
|
|
nxterm_fillchar(priv, rect, &priv->bm[i]);
|
2012-03-28 03:40:49 +08:00
|
|
|
}
|
2014-02-11 08:08:49 +08:00
|
|
|
|
2022-09-06 14:18:45 +08:00
|
|
|
nxmutex_unlock(&priv->lock);
|
2012-03-28 03:40:49 +08:00
|
|
|
}
|