[eog] EogTransform: Calc absolute double value before casting to int



commit 7da8cb95645c5f9f7ebdd2030de65e0a5c3346a9
Author: Felix Riemann <friemann gnome org>
Date:   Sat Dec 5 17:48:46 2020 +0100

    EogTransform: Calc absolute double value before casting to int
    
    This fixes a warning in Clang and avoids the implicit cast when using abs().
    Using fabs() also calculates the absolute value in the floating-point
    domain, where only the sign bit needs to be cleared. In many cases this
    can be done using a single processor instruction.

 src/eog-transform.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/eog-transform.c b/src/eog-transform.c
index da12fa7b..d6802d67 100644
--- a/src/eog-transform.c
+++ b/src/eog-transform.c
@@ -132,8 +132,8 @@ eog_transform_apply (EogTransform *trans, GdkPixbuf *pixbuf, EogJob *job)
        }
 
        /* create the resulting pixbuf */
-       dest_width = abs (dest_bottom_right.x - dest_top_left.x + 1);
-       dest_height = abs (dest_bottom_right.y - dest_top_left.y + 1);
+       dest_width = (int) fabs (dest_bottom_right.x - dest_top_left.x + 1);
+       dest_height = (int) fabs (dest_bottom_right.y - dest_top_left.y + 1);
 
        dest_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
                               gdk_pixbuf_get_has_alpha (pixbuf),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]