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