Bug#1041406: libimlib2: imlib_clone_image() no longer preserves the alpha channel flag

2023-07-18 Thread Markus Koschany
Control: forwarded -1 https://git.enlightenment.org/old/legacy-imlib2/issues/17

Thanks for the report!


signature.asc
Description: This is a digitally signed message part


Bug#1041406: libimlib2: imlib_clone_image() no longer preserves the alpha channel flag

2023-07-18 Thread Niko Tyni
Package: libimlib2
Version: 1.10.0-4
Control: affects -1 libimage-imlib2-perl

As per subject, the imlib_clone_image() function no longer preserves
the alpha channel value since imlib2 1.10.0.

The attached test program fails test 3 on bookworm and sid but passes
on bullseye and older.

I've bisected this to upstream change

  
https://git.enlightenment.org/old/legacy-imlib2/commit/b39d33c80020aaa63bc865d640cb4cfa5eb7332a

and it looks to me like an oversight where other functions were adapted
to the new alpha channel implementation, but imlib_clone_image() remains
unchanged and only copies the flags and not the new alpha byte.

I found this while debugging #1040223 in libimage-imlib2-perl, which
currently relies on the old behaviour. It's easy enough to work around
so this is not quite critical, but it does look like an unintentional
API change.

Thanks for your work on Debian,
-- 
Niko Tyni   nt...@debian.org
#include 
#include 

int main(int argc, char **argv)
{
Imlib_Image orig, clone;

printf("1..3\n");
orig = imlib_create_image(300, 400);
if (orig) {
	printf("ok 1 - created image\n");
} else {
	printf("not ok 1 - failed to create image\n");
	return 1;
}

imlib_context_set_image(orig);
imlib_image_set_has_alpha(1);
if (imlib_image_has_alpha()) {
	printf("ok 2 - alpha should be set in the original image\n");
} else {
	printf("not ok 2 - alpha should be set in the original image\n");
}

clone = imlib_clone_image();
imlib_context_set_image(clone);
if (imlib_image_has_alpha()) {
	printf("ok 3 - alpha should be set in the cloned image\n");
} else {
	printf("not ok 3 - alpha should be set in the cloned image\n");
	return 1;
}

return 0;
}