Stop using wlr_texture_get_size

Just use wlr_texture.{width,height} directly.
This commit is contained in:
Simon Ser 2020-12-25 12:21:29 +01:00
parent ae5275c09f
commit b9460ab724
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
5 changed files with 14 additions and 18 deletions

View File

@ -915,10 +915,8 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
plane->cursor_enabled = false;
if (texture != NULL) {
int width, height;
wlr_texture_get_size(texture, &width, &height);
width = width * output->scale / scale;
height = height * output->scale / scale;
int width = texture->width * output->scale / scale;
int height = texture->height * output->scale / scale;
if (width > (int)plane->surf.width || height > (int)plane->surf.height) {
wlr_drm_conn_log(conn, WLR_ERROR, "Cursor too large (max %dx%d)",

View File

@ -402,10 +402,8 @@ static bool output_set_cursor(struct wlr_output *wlr_output,
struct wl_surface *surface = output->cursor.surface;
if (texture != NULL) {
int width, height;
wlr_texture_get_size(texture, &width, &height);
width = width * wlr_output->scale / scale;
height = height * wlr_output->scale / scale;
int width = texture->width * wlr_output->scale / scale;
int height = texture->height * wlr_output->scale / scale;
if (output->cursor.swapchain == NULL ||
output->cursor.swapchain->width != width ||

View File

@ -78,13 +78,10 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
wlr_renderer_begin(sample->renderer, wlr_output->width, wlr_output->height);
wlr_renderer_clear(sample->renderer, (float[]){0.25f, 0.25f, 0.25f, 1});
int tex_width, tex_height;
wlr_texture_get_size(sample->cat_texture, &tex_width, &tex_height);
struct touch_point *p;
wl_list_for_each(p, &sample->touch_points, link) {
int x = (int)(p->x * width) - tex_width / 2;
int y = (int)(p->y * height) - tex_height / 2;
int x = (int)(p->x * width) - sample->cat_texture->width / 2;
int y = (int)(p->y * height) - sample->cat_texture->height / 2;
wlr_render_texture(sample->renderer, sample->cat_texture,
wlr_output->transform_matrix, x, y, 1.0f);
}

View File

@ -76,8 +76,12 @@ void wlr_renderer_scissor(struct wlr_renderer *r, struct wlr_box *box) {
bool wlr_render_texture(struct wlr_renderer *r, struct wlr_texture *texture,
const float projection[static 9], int x, int y, float alpha) {
struct wlr_box box = { .x = x, .y = y };
wlr_texture_get_size(texture, &box.width, &box.height);
struct wlr_box box = {
.x = x,
.y = y,
.width = texture->width,
.height = texture->height,
};
float matrix[9];
wlr_matrix_project_box(matrix, &box, WL_OUTPUT_TRANSFORM_NORMAL, 0,

View File

@ -277,9 +277,8 @@ struct wlr_client_buffer *wlr_client_buffer_apply_damage(
int32_t width = wl_shm_buffer_get_width(shm_buf);
int32_t height = wl_shm_buffer_get_height(shm_buf);
int32_t texture_width, texture_height;
wlr_texture_get_size(buffer->texture, &texture_width, &texture_height);
if (width != texture_width || height != texture_height) {
if ((uint32_t)width != buffer->texture->width ||
(uint32_t)height != buffer->texture->height) {
return NULL;
}