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:
authorSybren A. Stüvel <sybren@blender.org>2020-09-04 17:23:00 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-09-04 17:23:08 +0300
commitfb5e2f56109e825ce3c446f80e075ee3dde81c3d (patch)
tree20b5808415568f503b4ed4b56d3d4f50b5fe8cee /source/blender/imbuf/intern/imageprocess.c
parentee49ce482a797a5937829de497abd69bcd1edb48 (diff)
Cleanup: Clang-Tidy bugprone-incorrect-roundings fixes
Should cause no noticeable difference.
Diffstat (limited to 'source/blender/imbuf/intern/imageprocess.c')
-rw-r--r--source/blender/imbuf/intern/imageprocess.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c
index bf58f047773..8525991aa40 100644
--- a/source/blender/imbuf/intern/imageprocess.c
+++ b/source/blender/imbuf/intern/imageprocess.c
@@ -27,6 +27,7 @@
* but we'll keep it here for the time being. (nzc)
*/
+#include <math.h>
#include <stdlib.h>
#include "MEM_guardedalloc.h"
@@ -202,10 +203,10 @@ void bilinear_interpolation_color_wrap(
/* need to add 0.5 to avoid rounding down (causes darken with the smear brush)
* tested with white images and this should not wrap back to zero */
- outI[0] = (ma_mb * row1I[0] + a_mb * row3I[0] + ma_b * row2I[0] + a_b * row4I[0]) + 0.5f;
- outI[1] = (ma_mb * row1I[1] + a_mb * row3I[1] + ma_b * row2I[1] + a_b * row4I[1]) + 0.5f;
- outI[2] = (ma_mb * row1I[2] + a_mb * row3I[2] + ma_b * row2I[2] + a_b * row4I[2]) + 0.5f;
- outI[3] = (ma_mb * row1I[3] + a_mb * row3I[3] + ma_b * row2I[3] + a_b * row4I[3]) + 0.5f;
+ outI[0] = roundf(ma_mb * row1I[0] + a_mb * row3I[0] + ma_b * row2I[0] + a_b * row4I[0]);
+ outI[1] = roundf(ma_mb * row1I[1] + a_mb * row3I[1] + ma_b * row2I[1] + a_b * row4I[1]);
+ outI[2] = roundf(ma_mb * row1I[2] + a_mb * row3I[2] + ma_b * row2I[2] + a_b * row4I[2]);
+ outI[3] = roundf(ma_mb * row1I[3] + a_mb * row3I[3] + ma_b * row2I[3] + a_b * row4I[3]);
}
}