1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
From c2d646b9fa925ac2a91cb6cfb3fe6dad430c7927 Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Tue, 18 Jul 2023 15:16:21 +0100
Subject: [PATCH] Work around an imlib2 bug with alpha channel cloning
As discussed in https://bugs.debian.org/1041406 imlib2 1.10.0 introduced
a bug where imlib_clone_image() no longer copies the alpha flag. This
breaks test 12 of t/simple.t :
# Failed test at t/simple.t line 68.
# got: '0'
# expected: '1'
Work around this on our side by checking for any difference after
cloning and copying the alpha flag if necessary.
Bug-Debian: https://bugs.debian.org/1040223
lib/Image/Imlib2.xs | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/lib/Image/Imlib2.xs b/lib/Image/Imlib2.xs
index f48d4ec..cc54d2b 100644
@@ -931,9 +931,20 @@ Imlib2_clone(image)
CODE:
{
Imlib_Image cloned;
+ char alpha_orig;
+ char alpha_cloned;
imlib_context_set_image(image);
cloned = imlib_clone_image();
+
+ /* imlib2 no longer clones the alpha flag since 1.10 */
+ alpha_orig = imlib_image_has_alpha();
+ imlib_context_set_image(cloned);
+ alpha_cloned = imlib_image_has_alpha();
+ if (alpha_orig != alpha_cloned) {
+ imlib_image_set_has_alpha(alpha_orig);
+ }
+ imlib_context_set_image(image);
RETVAL = cloned;
}
--
2.39.1
|