[gegl] libs/rgbe: fix handling of exponent=0
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] libs/rgbe: fix handling of exponent=0
- Date: Thu, 25 Feb 2021 17:31:14 +0000 (UTC)
commit 5561c7121aae019068d1ad86ae34a23cb693d0f6
Author: Øyvind Kolås <pippin gimp org>
Date: Thu Feb 25 18:28:44 2021 +0100
libs/rgbe: fix handling of exponent=0
The existing code skipped setting alpha=1.0f for files with an exponent
component of 0.0, resulting in transparent output pixels. Fixing issue #275.
libs/rgbe/rgbe.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/libs/rgbe/rgbe.c b/libs/rgbe/rgbe.c
index fc0e0a609..94f4fa94f 100644
--- a/libs/rgbe/rgbe.c
+++ b/libs/rgbe/rgbe.c
@@ -14,6 +14,7 @@
* License along with GEGL; if not, see <https://www.gnu.org/licenses/>.
*
* Copyright 2010 Danny Robson <danny blubinc net>
+ * 2021 Øyvind Kolås <pippin gimp org>
*/
#include "config.h"
@@ -529,23 +530,22 @@ rgbe_apply_exponent (const rgbe_file *file,
if (e == 0)
{
rgb[OFFSET_R] = rgb[OFFSET_G] = rgb[OFFSET_B] = 0;
- goto cleanup;
+ }
+ else
+ {
+ mult = ldexp (1.0, e - (128 + 8));
+ rgb[OFFSET_R] *= mult *
+ file->header.exposure *
+ file->header.colorcorr[OFFSET_R];
+ rgb[OFFSET_G] *= mult *
+ file->header.exposure *
+ file->header.colorcorr[OFFSET_G];
+ rgb[OFFSET_B] *= mult *
+ file->header.exposure *
+ file->header.colorcorr[OFFSET_B];
}
- mult = ldexp (1.0, e - (128 + 8));
- rgb[OFFSET_R] *= mult *
- file->header.exposure *
- file->header.colorcorr[OFFSET_R];
- rgb[OFFSET_G] *= mult *
- file->header.exposure *
- file->header.colorcorr[OFFSET_G];
- rgb[OFFSET_B] *= mult *
- file->header.exposure *
- file->header.colorcorr[OFFSET_B];
- rgb[OFFSET_A] = 1.0f;
-
-cleanup:
- return;
+ rgb[OFFSET_A] = 1.0f;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]