types/wlr_buffer: remove wlr_resource_get_buffer_size

master
Simon Zeni 4 years ago committed by Simon Ser
parent d086501fba
commit 60f4d8f409

@ -156,11 +156,6 @@ struct wlr_client_buffer *wlr_client_buffer_get(struct wlr_buffer *buffer);
* Check if a resource is a wl_buffer resource.
*/
bool wlr_resource_is_buffer(struct wl_resource *resource);
/**
* Get the size of a wl_buffer resource.
*/
bool wlr_resource_get_buffer_size(struct wl_resource *resource,
int *width, int *height);
/**
* Try to update the buffer's content. On success, returns the updated buffer
* and destroys the provided `buffer`. On error, `buffer` is intact and NULL is

@ -104,32 +104,6 @@ bool wlr_resource_is_buffer(struct wl_resource *resource) {
return strcmp(wl_resource_get_class(resource), wl_buffer_interface.name) == 0;
}
bool wlr_resource_get_buffer_size(struct wl_resource *resource,
int *width, int *height) {
assert(wlr_resource_is_buffer(resource));
struct wl_shm_buffer *shm_buf = wl_shm_buffer_get(resource);
if (shm_buf != NULL) {
*width = wl_shm_buffer_get_width(shm_buf);
*height = wl_shm_buffer_get_height(shm_buf);
} else if (wlr_dmabuf_v1_resource_is_buffer(resource)) {
struct wlr_dmabuf_v1_buffer *dmabuf =
wlr_dmabuf_v1_buffer_from_buffer_resource(resource);
*width = dmabuf->attributes.width;
*height = dmabuf->attributes.height;
} else if (wlr_drm_buffer_is_resource(resource)) {
struct wlr_drm_buffer *drm_buffer =
wlr_drm_buffer_from_resource(resource);
*width = drm_buffer->base.width;
*height = drm_buffer->base.height;
} else {
*width = *height = 0;
return false;
}
return true;
}
static const struct wlr_buffer_impl client_buffer_impl;
struct wlr_client_buffer *wlr_client_buffer_get(struct wlr_buffer *buffer) {

Loading…
Cancel
Save