render/pixman: skip mask for opaque texture rendering

This commit is contained in:
Simon Ser 2022-12-08 16:53:14 +01:00
parent 9b7ee63774
commit 32fc23a383
1 changed files with 9 additions and 5 deletions

View File

@ -255,10 +255,12 @@ static bool pixman_render_subtexture_with_matrix(
} }
} }
// TODO: don't create a mask if alpha == 1.0 pixman_image_t *mask = NULL;
struct pixman_color mask_colour = {0}; if (alpha != 1.0) {
mask_colour.alpha = 0xFFFF * alpha; struct pixman_color mask_colour = {0};
pixman_image_t *mask = pixman_image_create_solid_fill(&mask_colour); mask_colour.alpha = 0xFFFF * alpha;
mask = pixman_image_create_solid_fill(&mask_colour);
}
float m[9]; float m[9];
memcpy(m, matrix, sizeof(m)); memcpy(m, matrix, sizeof(m));
@ -279,7 +281,9 @@ static bool pixman_render_subtexture_with_matrix(
wlr_buffer_end_data_ptr_access(texture->buffer); wlr_buffer_end_data_ptr_access(texture->buffer);
} }
pixman_image_unref(mask); if (mask != NULL) {
pixman_image_unref(mask);
}
return true; return true;
} }