Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-09-18 14:11:41 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-09-18 16:55:41 +0300
commitd0344d7b7d619e62bc852c4d00df52cfbfdda544 (patch)
tree713d7bfd2faa3d77ef1f67a8072abf8a05a29256 /source/blender/editors/interface
parentc4fc9c4a8ecc421fdbf1f5d06d3b67ac4c8c1895 (diff)
Cleanup: use clamped rounding functions
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 427291e713a..fd5159bb76c 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1937,13 +1937,14 @@ void ui_but_value_set(uiBut *but, double value)
else {
/* first do rounding */
if (but->pointype == UI_BUT_POIN_CHAR) {
- value = (char)floor(value + 0.5);
+ value = round_db_to_uchar_clamp(value);
}
else if (but->pointype == UI_BUT_POIN_SHORT) {
- value = (short)floor(value + 0.5);
+ value = round_db_to_short_clamp(value);
+ }
+ else if (but->pointype == UI_BUT_POIN_INT) {
+ value = round_db_to_int_clamp(value);
}
- else if (but->pointype == UI_BUT_POIN_INT)
- value = (int)floor(value + 0.5);
else if (but->pointype == UI_BUT_POIN_FLOAT) {
float fval = (float)value;
if (fval >= -0.00001f && fval <= 0.00001f) fval = 0.0f; /* prevent negative zero */