2020-03-15 15:19:28 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
|
2020-07-01 18:38:27 +00:00
|
|
|
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
2014-10-16 11:04:51 +00:00
|
|
|
|
2020-03-15 15:19:28 +00:00
|
|
|
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
|
|
|
*/
|
2021-03-10 21:33:40 +00:00
|
|
|
#include "region_interface_p.h"
|
2020-11-03 22:50:38 +00:00
|
|
|
#include "utils.h"
|
2020-07-01 18:38:27 +00:00
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
namespace KWaylandServer
|
2014-10-16 11:04:51 +00:00
|
|
|
{
|
|
|
|
|
2021-03-10 21:33:40 +00:00
|
|
|
RegionInterface::RegionInterface(wl_resource *resource)
|
2020-07-01 18:38:27 +00:00
|
|
|
: QtWaylandServer::wl_region(resource)
|
2014-10-16 11:04:51 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-03-10 21:33:40 +00:00
|
|
|
void RegionInterface::region_destroy_resource(Resource *)
|
2020-07-01 18:38:27 +00:00
|
|
|
{
|
2021-03-10 21:33:40 +00:00
|
|
|
delete this;
|
2020-07-01 18:38:27 +00:00
|
|
|
}
|
2014-10-16 11:04:51 +00:00
|
|
|
|
2021-03-10 21:33:40 +00:00
|
|
|
void RegionInterface::region_destroy(Resource *resource)
|
2014-10-16 11:04:51 +00:00
|
|
|
{
|
2020-07-01 18:38:27 +00:00
|
|
|
wl_resource_destroy(resource->handle);
|
2014-10-16 11:04:51 +00:00
|
|
|
}
|
|
|
|
|
2021-03-10 21:33:40 +00:00
|
|
|
void RegionInterface::region_add(Resource *, int32_t x, int32_t y, int32_t width, int32_t height)
|
2014-10-16 11:04:51 +00:00
|
|
|
{
|
2021-03-10 21:33:40 +00:00
|
|
|
m_region += QRegion(x, y, width, height);
|
2014-10-16 11:04:51 +00:00
|
|
|
}
|
|
|
|
|
2021-03-10 21:33:40 +00:00
|
|
|
void RegionInterface::region_subtract(Resource *, int32_t x, int32_t y, int32_t width, int32_t height)
|
2014-10-16 11:04:51 +00:00
|
|
|
{
|
2021-03-10 21:33:40 +00:00
|
|
|
m_region -= QRegion(x, y, width, height);
|
2014-10-16 11:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QRegion RegionInterface::region() const
|
|
|
|
{
|
2021-03-10 21:33:40 +00:00
|
|
|
return m_region;
|
2014-10-16 11:04:51 +00:00
|
|
|
}
|
|
|
|
|
2014-11-14 08:45:02 +00:00
|
|
|
RegionInterface *RegionInterface::get(wl_resource *native)
|
2014-10-16 11:04:51 +00:00
|
|
|
{
|
2021-03-10 21:33:40 +00:00
|
|
|
return resource_cast<RegionInterface *>(native);
|
2014-10-16 11:04:51 +00:00
|
|
|
}
|
|
|
|
|
2020-07-01 18:38:27 +00:00
|
|
|
} // namespace KWaylandServer
|