diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gui/control.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/gui/control.c b/tools/gui/control.c index 93398e4..f74e0f1 100644 --- a/tools/gui/control.c +++ b/tools/gui/control.c @@ -91,7 +91,8 @@ convert_grayscale_to_rgb (ThreadData *data, gpointer buffer) gint offset = y * stride * data->width; for (gint x = 0; x < data->display_width; x++, offset += stride) { - guchar val = (guchar) ((input[offset] - min) * factor); + gdouble dval = (input[offset] - min) * factor; + guchar val = (guchar) CLAMP(dval, 0.0, 255.0); output[i++] = val; output[i++] = val; @@ -106,7 +107,8 @@ convert_grayscale_to_rgb (ThreadData *data, gpointer buffer) gint offset = y * stride * data->width; for (gint x = 0; x < data->display_width; x++, offset += stride) { - guchar val = (guchar) ((input[offset] - min) * factor); + gdouble dval = (input[offset] - min) * factor; + guchar val = (guchar) CLAMP(dval, 0.0, 255.0); output[i++] = val; output[i++] = val; |