[gegl] vignette: fix inner-region alpha when gamma == 0
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] vignette: fix inner-region alpha when gamma == 0
- Date: Thu, 14 May 2020 21:50:30 +0000 (UTC)
commit 6efa906a93376783e181a6a6a6d41eaae04081d0
Author: Ell <ell_se yahoo com>
Date: Thu May 14 21:32:21 2020 +0300
vignette: fix inner-region alpha when gamma == 0
Make sure the inner region is fully transparent, even when
gamma == 0.
operations/common/vignette.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/operations/common/vignette.c b/operations/common/vignette.c
index fe65ad5f8..71d120917 100644
--- a/operations/common/vignette.c
+++ b/operations/common/vignette.c
@@ -192,7 +192,7 @@ cl_process (GeglOperation *operation,
const size_t gbl_size[2] = {roi->width, roi->height};
gint shape = (gint) o->shape;
- gfloat gamma = o->gamma;
+ gfloat gamma = MAX (o->gamma, 0.0001);
cl_int cl_err = 0;
cl_float4 f_color;
@@ -263,6 +263,7 @@ process (GeglOperation *operation,
GeglRectangle *bounds = gegl_operation_source_get_bounding_box (operation, "input");
gfloat length = hypot (bounds->width, bounds->height)/2;
gfloat rdiff;
+ gfloat gamma;
gfloat cost, sint;
gfloat costy, sinty;
@@ -289,6 +290,8 @@ process (GeglOperation *operation,
if (fabs (rdiff) < 0.0001)
rdiff = 0.0001;
+ gamma = MAX (o->gamma, 0.0001);
+
midx = bounds->x + bounds->width * o->x;
midy = bounds->y + bounds->height * o->y;
@@ -341,13 +344,13 @@ process (GeglOperation *operation,
if (strength>1.0)
strength = 1.0;
- if (o->gamma > 1.9999 && o->gamma < 2.0001)
+ if (gamma > 1.9999 && gamma < 2.0001)
strength *= strength; /* fast path for default gamma */
- else if (o->gamma != 1.0)
- strength = powf(strength, o->gamma); /* this gamma factor is
- * very expensive.. and precision
- * is not very important
- */
+ else if (gamma != 1.0)
+ strength = powf(strength, gamma); /* this gamma factor is
+ * very expensive.. and precision
+ * is not very important
+ */
out_pixel[0]=in_pixel[0] * (1.0-strength) + color[0] * strength;
out_pixel[1]=in_pixel[1] * (1.0-strength) + color[1] * strength;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]