plug-ins: Fix crash for bumpmaps without alpha channels

979a3c3c assumed that all bumpmaps in the Lighting Effects plug-in
would have an alpha channel, which is not always the case.
This patch adds a check via gimp_drawable_has_alpha (), and sets the
babl format accordingly.
This commit is contained in:
Alx Sa 2024-11-04 02:05:57 +00:00
parent fe6e1d77c8
commit c408d44e03

View file

@ -397,15 +397,19 @@ bumpmap_setup (GimpDrawable *bumpmap)
{
if (bumpmap)
{
gboolean has_alpha = gimp_drawable_has_alpha (bumpmap);
if (! bump_buffer)
{
bump_buffer = gimp_drawable_get_buffer (bumpmap);
}
if (gimp_drawable_is_rgb (bumpmap))
bump_format = babl_format ("R'aG'aB'aA u8");
bump_format = has_alpha ? babl_format ("R'aG'aB'aA u8") :
babl_format ("R'G'B' u8");
else
bump_format = babl_format ("Y'aA u8"); /* FIXME */
bump_format = has_alpha ? babl_format ("Y'aA u8") : /* FIXME */
babl_format ("Y' u8");
}
}