mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-22 15:12:26 +00:00
Stop using wlr_texture_get_size
Just use wlr_texture.{width,height} directly.
This commit is contained in:
parent
ae5275c09f
commit
b9460ab724
@ -915,10 +915,8 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
|
|||||||
|
|
||||||
plane->cursor_enabled = false;
|
plane->cursor_enabled = false;
|
||||||
if (texture != NULL) {
|
if (texture != NULL) {
|
||||||
int width, height;
|
int width = texture->width * output->scale / scale;
|
||||||
wlr_texture_get_size(texture, &width, &height);
|
int height = texture->height * output->scale / scale;
|
||||||
width = width * output->scale / scale;
|
|
||||||
height = height * output->scale / scale;
|
|
||||||
|
|
||||||
if (width > (int)plane->surf.width || height > (int)plane->surf.height) {
|
if (width > (int)plane->surf.width || height > (int)plane->surf.height) {
|
||||||
wlr_drm_conn_log(conn, WLR_ERROR, "Cursor too large (max %dx%d)",
|
wlr_drm_conn_log(conn, WLR_ERROR, "Cursor too large (max %dx%d)",
|
||||||
|
@ -402,10 +402,8 @@ static bool output_set_cursor(struct wlr_output *wlr_output,
|
|||||||
struct wl_surface *surface = output->cursor.surface;
|
struct wl_surface *surface = output->cursor.surface;
|
||||||
|
|
||||||
if (texture != NULL) {
|
if (texture != NULL) {
|
||||||
int width, height;
|
int width = texture->width * wlr_output->scale / scale;
|
||||||
wlr_texture_get_size(texture, &width, &height);
|
int height = texture->height * wlr_output->scale / scale;
|
||||||
width = width * wlr_output->scale / scale;
|
|
||||||
height = height * wlr_output->scale / scale;
|
|
||||||
|
|
||||||
if (output->cursor.swapchain == NULL ||
|
if (output->cursor.swapchain == NULL ||
|
||||||
output->cursor.swapchain->width != width ||
|
output->cursor.swapchain->width != width ||
|
||||||
|
@ -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_begin(sample->renderer, wlr_output->width, wlr_output->height);
|
||||||
wlr_renderer_clear(sample->renderer, (float[]){0.25f, 0.25f, 0.25f, 1});
|
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;
|
struct touch_point *p;
|
||||||
wl_list_for_each(p, &sample->touch_points, link) {
|
wl_list_for_each(p, &sample->touch_points, link) {
|
||||||
int x = (int)(p->x * width) - tex_width / 2;
|
int x = (int)(p->x * width) - sample->cat_texture->width / 2;
|
||||||
int y = (int)(p->y * height) - tex_height / 2;
|
int y = (int)(p->y * height) - sample->cat_texture->height / 2;
|
||||||
wlr_render_texture(sample->renderer, sample->cat_texture,
|
wlr_render_texture(sample->renderer, sample->cat_texture,
|
||||||
wlr_output->transform_matrix, x, y, 1.0f);
|
wlr_output->transform_matrix, x, y, 1.0f);
|
||||||
}
|
}
|
||||||
|
@ -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,
|
bool wlr_render_texture(struct wlr_renderer *r, struct wlr_texture *texture,
|
||||||
const float projection[static 9], int x, int y, float alpha) {
|
const float projection[static 9], int x, int y, float alpha) {
|
||||||
struct wlr_box box = { .x = x, .y = y };
|
struct wlr_box box = {
|
||||||
wlr_texture_get_size(texture, &box.width, &box.height);
|
.x = x,
|
||||||
|
.y = y,
|
||||||
|
.width = texture->width,
|
||||||
|
.height = texture->height,
|
||||||
|
};
|
||||||
|
|
||||||
float matrix[9];
|
float matrix[9];
|
||||||
wlr_matrix_project_box(matrix, &box, WL_OUTPUT_TRANSFORM_NORMAL, 0,
|
wlr_matrix_project_box(matrix, &box, WL_OUTPUT_TRANSFORM_NORMAL, 0,
|
||||||
|
@ -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 width = wl_shm_buffer_get_width(shm_buf);
|
||||||
int32_t height = wl_shm_buffer_get_height(shm_buf);
|
int32_t height = wl_shm_buffer_get_height(shm_buf);
|
||||||
|
|
||||||
int32_t texture_width, texture_height;
|
if ((uint32_t)width != buffer->texture->width ||
|
||||||
wlr_texture_get_size(buffer->texture, &texture_width, &texture_height);
|
(uint32_t)height != buffer->texture->height) {
|
||||||
if (width != texture_width || height != texture_height) {
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user