aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/drm/drm.c6
-rw-r--r--backend/wayland/output.c6
-rw-r--r--examples/touch.c7
-rw-r--r--render/wlr_renderer.c8
-rw-r--r--types/wlr_buffer.c5
5 files changed, 14 insertions, 18 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 26cf99df..06a58d50 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -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)",
diff --git a/backend/wayland/output.c b/backend/wayland/output.c
index db9056d5..6bc84dcb 100644
--- a/backend/wayland/output.c
+++ b/backend/wayland/output.c
@@ -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 ||
diff --git a/examples/touch.c b/examples/touch.c
index 3d18dfd0..7f8980e1 100644
--- a/examples/touch.c
+++ b/examples/touch.c
@@ -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);
}
diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c
index b8374be9..fc224467 100644
--- a/render/wlr_renderer.c
+++ b/render/wlr_renderer.c
@@ -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,
diff --git a/types/wlr_buffer.c b/types/wlr_buffer.c
index 0878c302..0ead9e09 100644
--- a/types/wlr_buffer.c
+++ b/types/wlr_buffer.c
@@ -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;
}