|
|
@ -6,15 +6,27 @@
|
|
|
|
#include <wlr/types/wlr_region.h>
|
|
|
|
#include <wlr/types/wlr_region.h>
|
|
|
|
#include "types/wlr_region.h"
|
|
|
|
#include "types/wlr_region.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const struct wl_region_interface region_impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static pixman_region32_t *region_from_resource(struct wl_resource *resource) {
|
|
|
|
|
|
|
|
assert(wl_resource_instance_of(resource, &wl_region_interface,
|
|
|
|
|
|
|
|
®ion_impl));
|
|
|
|
|
|
|
|
return wl_resource_get_user_data(resource);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const pixman_region32_t *wlr_region_from_resource(struct wl_resource *resource) {
|
|
|
|
|
|
|
|
return region_from_resource(resource);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void region_add(struct wl_client *client, struct wl_resource *resource,
|
|
|
|
static void region_add(struct wl_client *client, struct wl_resource *resource,
|
|
|
|
int32_t x, int32_t y, int32_t width, int32_t height) {
|
|
|
|
int32_t x, int32_t y, int32_t width, int32_t height) {
|
|
|
|
pixman_region32_t *region = wlr_region_from_resource(resource);
|
|
|
|
pixman_region32_t *region = region_from_resource(resource);
|
|
|
|
pixman_region32_union_rect(region, region, x, y, width, height);
|
|
|
|
pixman_region32_union_rect(region, region, x, y, width, height);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void region_subtract(struct wl_client *client, struct wl_resource *resource,
|
|
|
|
static void region_subtract(struct wl_client *client, struct wl_resource *resource,
|
|
|
|
int32_t x, int32_t y, int32_t width, int32_t height) {
|
|
|
|
int32_t x, int32_t y, int32_t width, int32_t height) {
|
|
|
|
pixman_region32_t *region = wlr_region_from_resource(resource);
|
|
|
|
pixman_region32_t *region = region_from_resource(resource);
|
|
|
|
pixman_region32_union_rect(region, region, x, y, width, height);
|
|
|
|
pixman_region32_union_rect(region, region, x, y, width, height);
|
|
|
|
|
|
|
|
|
|
|
|
pixman_region32_t rect;
|
|
|
|
pixman_region32_t rect;
|
|
|
@ -34,7 +46,7 @@ static const struct wl_region_interface region_impl = {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void region_handle_resource_destroy(struct wl_resource *resource) {
|
|
|
|
static void region_handle_resource_destroy(struct wl_resource *resource) {
|
|
|
|
pixman_region32_t *reg = wlr_region_from_resource(resource);
|
|
|
|
pixman_region32_t *reg = region_from_resource(resource);
|
|
|
|
pixman_region32_fini(reg);
|
|
|
|
pixman_region32_fini(reg);
|
|
|
|
free(reg);
|
|
|
|
free(reg);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -61,9 +73,3 @@ struct wl_resource *region_create(struct wl_client *client,
|
|
|
|
|
|
|
|
|
|
|
|
return region_resource;
|
|
|
|
return region_resource;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pixman_region32_t *wlr_region_from_resource(struct wl_resource *resource) {
|
|
|
|
|
|
|
|
assert(wl_resource_instance_of(resource, &wl_region_interface,
|
|
|
|
|
|
|
|
®ion_impl));
|
|
|
|
|
|
|
|
return wl_resource_get_user_data(resource);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|