File indexing completed on 2024-11-10 04:57:31
0001 /* 0002 SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org> 0003 SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0006 */ 0007 #include "region_p.h" 0008 #include "utils/resource.h" 0009 0010 namespace KWin 0011 { 0012 RegionInterface::RegionInterface(wl_resource *resource) 0013 : QtWaylandServer::wl_region(resource) 0014 { 0015 } 0016 0017 void RegionInterface::region_destroy_resource(Resource *) 0018 { 0019 delete this; 0020 } 0021 0022 void RegionInterface::region_destroy(Resource *resource) 0023 { 0024 wl_resource_destroy(resource->handle); 0025 } 0026 0027 void RegionInterface::region_add(Resource *, int32_t x, int32_t y, int32_t width, int32_t height) 0028 { 0029 m_region += QRegion(x, y, width, height); 0030 } 0031 0032 void RegionInterface::region_subtract(Resource *, int32_t x, int32_t y, int32_t width, int32_t height) 0033 { 0034 m_region -= QRegion(x, y, width, height); 0035 } 0036 0037 QRegion RegionInterface::region() const 0038 { 0039 return m_region; 0040 } 0041 0042 RegionInterface *RegionInterface::get(wl_resource *native) 0043 { 0044 return resource_cast<RegionInterface *>(native); 0045 } 0046 0047 } // namespace KWin