[gimp/gimp-2-8] Bug 788461 - Selection with a Fixed size is created with an ...
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-8] Bug 788461 - Selection with a Fixed size is created with an ...
- Date: Thu, 5 Oct 2017 20:18:41 +0000 (UTC)
commit eadd42b9eeec9e83032b01898adf4aee72bfa93b
Author: Ell <ell_se yahoo com>
Date: Thu Oct 5 16:05:25 2017 -0400
Bug 788461 - Selection with a Fixed size is created with an ...
... off-by one size in special cases
SIGNED_ROUND(), which is used by GimpToolRectangle, among other
things, used to round negative values which lie exactly between
two integers, i.e., -foo.5, down. This could lead to the rectangle
being one pixel bigger than expected, in either dimension, when one
of its edges had a negative coordinate, and the opposite edge had a
positive coordinate.
Fix SIGNED_ROUND() to always round such values up, regardless of
sign.
(cherry picked from commit e8b37a7a2543cf8fabd9780931ecf9dd7a461975)
libgimpmath/gimpmath.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/libgimpmath/gimpmath.h b/libgimpmath/gimpmath.h
index d3abb33..5925004 100644
--- a/libgimpmath/gimpmath.h
+++ b/libgimpmath/gimpmath.h
@@ -84,7 +84,7 @@ G_BEGIN_DECLS
*
* This macro rounds its argument @x to the nearest integer.
**/
-#define SIGNED_ROUND(x) ((int) ((((x) < 0) ? (x) - 0.5 : (x) + 0.5)))
+#define SIGNED_ROUND(x) ((int) RINT (x))
/**
* SQR:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]