From 050045a1f5b99dac9aae981c0d5c5cb04b60d4d9 Mon Sep 17 00:00:00 2001 From: Manuel Stoeckl Date: Wed, 1 Feb 2023 18:15:22 -0500 Subject: [PATCH] render: print error message when image alloc fails --- render.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/render.c b/render.c index 3f82227..96c944c 100644 --- a/render.c +++ b/render.c @@ -131,9 +131,15 @@ static void compute_composite_region(const struct pixman_f_transform *out2com, pixman_image_t *render(struct grim_state *state, struct grim_box *geometry, double scale) { + int common_width = geometry->width * scale; + int common_height = geometry->height * scale; pixman_image_t *common_image = pixman_image_create_bits(PIXMAN_a8r8g8b8, - geometry->width * scale, geometry->height * scale, - NULL, 0); + common_width, common_height, NULL, 0); + if (!common_image) { + fprintf(stderr, "failed to create image with size: %d x %d\n", + common_width, common_height); + return NULL; + } struct grim_output *output; wl_list_for_each(output, &state->outputs, link) { -- 2.45.2