2012-03-27 21:40:49 +02:00
|
|
|
/****************************************************************************
|
2021-03-08 22:39:04 +01:00
|
|
|
* graphics/nxterm/nxterm_redraw.c
|
2012-03-27 21:40:49 +02:00
|
|
|
*
|
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
|
2012-03-27 21:40:49 +02:00
|
|
|
*
|
2021-02-05 11:12:53 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2012-03-27 21:40:49 +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.
|
2012-03-27 21:40:49 +02: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-20 23:53:28 +02:00
|
|
|
#include "nxterm.h"
|
2012-03-27 21:40:49 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2014-09-20 23:53:28 +02:00
|
|
|
* Name: nxterm_redraw
|
2012-03-27 21:40:49 +02: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 09:05:48 +01:00
|
|
|
void nxterm_redraw(NXTERM handle,
|
|
|
|
FAR const struct nxgl_rect_s *rect,
|
|
|
|
bool more)
|
2012-03-27 21:40:49 +02:00
|
|
|
{
|
2014-09-20 23:53:28 +02:00
|
|
|
FAR struct nxterm_state_s *priv;
|
2012-03-27 21:40:49 +02:00
|
|
|
int ret;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
DEBUGASSERT(handle && rect);
|
2016-06-11 19:59:51 +02:00
|
|
|
ginfo("rect={(%d,%d),(%d,%d)} more=%s\n",
|
2012-03-27 21:40:49 +02:00
|
|
|
rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y,
|
|
|
|
more ? "true" : "false");
|
|
|
|
|
|
|
|
/* Recover our private state structure */
|
|
|
|
|
2014-09-20 23:53:28 +02:00
|
|
|
priv = (FAR struct nxterm_state_s *)handle;
|
2012-03-27 21:40:49 +02:00
|
|
|
|
2012-03-28 21:29:30 +02:00
|
|
|
/* Get exclusive access to the state structure */
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2022-09-06 08:18:45 +02:00
|
|
|
ret = nxmutex_lock(&priv->lock);
|
2012-03-28 21:29:30 +02:00
|
|
|
}
|
|
|
|
while (ret < 0);
|
|
|
|
|
2012-03-27 21:40:49 +02: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 09:08:51 +01:00
|
|
|
gerr("ERROR: fill failed: %d\n", get_errno());
|
2012-03-27 21:40:49 +02: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-20 23:53:28 +02:00
|
|
|
nxterm_fillchar(priv, rect, &priv->bm[i]);
|
2012-03-27 21:40:49 +02:00
|
|
|
}
|
2014-02-11 01:08:49 +01:00
|
|
|
|
2022-09-06 08:18:45 +02:00
|
|
|
nxmutex_unlock(&priv->lock);
|
2012-03-27 21:40:49 +02:00
|
|
|
}
|