1 | // Copyright (C) 2017 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #include "qwlregion_p.h" |
5 | |
6 | #include <QtWaylandCompositor/private/qwaylandutils_p.h> |
7 | |
8 | QT_BEGIN_NAMESPACE |
9 | |
10 | namespace QtWayland { |
11 | |
12 | Region::Region(struct wl_client *client, uint32_t id) |
13 | : QtWaylandServer::wl_region(client, id, 1) |
14 | { |
15 | } |
16 | |
17 | Region::~Region() |
18 | { |
19 | } |
20 | |
21 | Region *Region::fromResource(struct ::wl_resource *resource) |
22 | { |
23 | return QtWayland::fromResource<Region *>(resource); |
24 | } |
25 | |
26 | void Region::region_destroy_resource(Resource *) |
27 | { |
28 | delete this; |
29 | } |
30 | |
31 | void Region::region_destroy(Resource *resource) |
32 | { |
33 | wl_resource_destroy(resource->handle); |
34 | } |
35 | |
36 | void Region::region_add(Resource *, int32_t x, int32_t y, int32_t w, int32_t h) |
37 | { |
38 | m_region += QRect(x, y, w, h); |
39 | } |
40 | |
41 | void Region::region_subtract(Resource *, int32_t x, int32_t y, int32_t w, int32_t h) |
42 | { |
43 | m_region -= QRect(x, y, w, h); |
44 | } |
45 | |
46 | } |
47 | |
48 | QT_END_NAMESPACE |
49 | |