aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-12-08 16:53:14 +0100
committerSimon Ser <contact@emersion.fr>2022-12-08 16:53:14 +0100
commit32fc23a3834ba5c4ecfea3b7c5c4c2126369074c (patch)
tree4ee6f1c762bc4510e486476ab68bd72392a7ce82
parent9b7ee63774a0d9e51ee677ed5e924093e71b8847 (diff)
render/pixman: skip mask for opaque texture rendering
-rw-r--r--render/pixman/renderer.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/render/pixman/renderer.c b/render/pixman/renderer.c
index 490d99a8..e8f4298d 100644
--- a/render/pixman/renderer.c
+++ b/render/pixman/renderer.c
@@ -255,10 +255,12 @@ static bool pixman_render_subtexture_with_matrix(
}
}
- // TODO: don't create a mask if alpha == 1.0
- struct pixman_color mask_colour = {0};
- mask_colour.alpha = 0xFFFF * alpha;
- pixman_image_t *mask = pixman_image_create_solid_fill(&mask_colour);
+ pixman_image_t *mask = NULL;
+ if (alpha != 1.0) {
+ struct pixman_color mask_colour = {0};
+ mask_colour.alpha = 0xFFFF * alpha;
+ mask = pixman_image_create_solid_fill(&mask_colour);
+ }
float m[9];
memcpy(m, matrix, sizeof(m));
@@ -279,7 +281,9 @@ static bool pixman_render_subtexture_with_matrix(
wlr_buffer_end_data_ptr_access(texture->buffer);
}
- pixman_image_unref(mask);
+ if (mask != NULL) {
+ pixman_image_unref(mask);
+ }
return true;
}