2008-12-01 19:51:48 +01:00
|
|
|
/****************************************************************************
|
2019-05-05 23:18:31 +02:00
|
|
|
* graphics/nxbe/nxbe_isvisible.c
|
2008-12-01 19:51:48 +01:00
|
|
|
*
|
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
|
2008-12-01 19:51:48 +01:00
|
|
|
*
|
2021-02-05 11:12:53 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2008-12-01 19:51:48 +01: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.
|
2008-12-01 19:51:48 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
2009-12-15 19:12:29 +01:00
|
|
|
#include <stdbool.h>
|
2008-12-01 19:51:48 +01:00
|
|
|
#include <errno.h>
|
|
|
|
#include <debug.h>
|
|
|
|
|
2011-07-24 22:49:01 +02:00
|
|
|
#include <nuttx/nx/nxglib.h>
|
2008-12-01 19:51:48 +01:00
|
|
|
|
|
|
|
#include "nxbe.h"
|
2019-03-13 16:16:30 +01:00
|
|
|
#include "nxmu.h"
|
2008-12-01 19:51:48 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Private Types
|
|
|
|
****************************************************************************/
|
|
|
|
|
2019-05-05 23:18:31 +02:00
|
|
|
struct nxbe_setvisibility_s
|
2008-12-01 19:51:48 +01:00
|
|
|
{
|
|
|
|
struct nxbe_clipops_s cops;
|
2009-12-15 19:12:29 +01:00
|
|
|
bool visible;
|
2008-12-01 19:51:48 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Private Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nxbe_clipvisible
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
static void nxbe_clipvisible(FAR struct nxbe_clipops_s *cops,
|
|
|
|
FAR struct nxbe_plane_s *plane,
|
|
|
|
FAR const struct nxgl_rect_s *rect)
|
|
|
|
{
|
2021-02-05 09:05:48 +01:00
|
|
|
FAR struct nxbe_setvisibility_s *info =
|
|
|
|
(FAR struct nxbe_setvisibility_s *)cops;
|
2009-12-15 19:12:29 +01:00
|
|
|
info->visible = true;
|
2008-12-01 19:51:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2019-05-05 23:18:31 +02:00
|
|
|
* Name: nxbe_isvisible
|
2008-12-01 19:51:48 +01:00
|
|
|
*
|
2018-02-01 19:03:55 +01:00
|
|
|
* Description:
|
2008-12-01 19:51:48 +01:00
|
|
|
* Return true if the point, pt, in window wnd is visible. pt is in
|
|
|
|
* absolute screen coordinates
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2019-05-05 23:18:31 +02:00
|
|
|
bool nxbe_isvisible(FAR struct nxbe_window_s *wnd,
|
|
|
|
FAR const struct nxgl_point_s *pos)
|
2008-12-01 19:51:48 +01:00
|
|
|
{
|
2019-05-05 23:18:31 +02:00
|
|
|
struct nxbe_setvisibility_s info;
|
|
|
|
|
|
|
|
/* Hidden windows are never visible */
|
|
|
|
|
|
|
|
if (NXBE_ISHIDDEN(wnd))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2008-12-01 19:51:48 +01:00
|
|
|
|
|
|
|
/* Check if the absolute position lies within the window */
|
|
|
|
|
|
|
|
if (!nxgl_rectinside(&wnd->bounds, pos))
|
|
|
|
{
|
2009-12-15 19:12:29 +01:00
|
|
|
return false;
|
2008-12-01 19:51:48 +01:00
|
|
|
}
|
|
|
|
|
2019-05-05 23:18:31 +02:00
|
|
|
/* If this is the top window, then the position is visible */
|
2008-12-01 19:51:48 +01:00
|
|
|
|
|
|
|
if (!wnd->above)
|
|
|
|
{
|
2009-12-15 19:12:29 +01:00
|
|
|
return true;
|
2008-12-01 19:51:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* The position within the window range, but the window is not at
|
|
|
|
* the top. We will have to work harder to determine if the point
|
|
|
|
* visible
|
|
|
|
*/
|
|
|
|
|
|
|
|
info.cops.visible = nxbe_clipvisible;
|
|
|
|
info.cops.obscured = nxbe_clipnull;
|
2009-12-15 19:12:29 +01:00
|
|
|
info.visible = false;
|
2008-12-01 19:51:48 +01:00
|
|
|
|
|
|
|
nxbe_clipper(wnd->above, &wnd->bounds, NX_CLIPORDER_DEFAULT,
|
2009-12-15 19:12:29 +01:00
|
|
|
&info.cops, &wnd->be->plane[0]);
|
2008-12-01 19:51:48 +01:00
|
|
|
|
|
|
|
return info.visible;
|
|
|
|
}
|