diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-04-25 18:16:22 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-04-25 18:16:22 +0400 |
commit | c2d5c72245cfebb612ccb11c60777262c9c5994a (patch) | |
tree | b5636494f274c84d9e47d61c32866f222a34c455 /source/blender/blenlib/BLI_math_base.h | |
parent | 631f2b94efe9d438a6a8027279d9e665f31653b6 (diff) |
Fix part of #34640: colors darkening when using the vertex paint blur tool.
The problem was that vertex colors only have 8 bits of precision, and integer
division always rounds down, so after some color blending iterations everything
gets darker. Instead use integer division that behaves like round() instead of
floor() for blending operations.
Diffstat (limited to 'source/blender/blenlib/BLI_math_base.h')
-rw-r--r-- | source/blender/blenlib/BLI_math_base.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index 67c1ffcebc0..04cf0b9d275 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -213,6 +213,8 @@ MINLINE int is_power_of_2_i(int n); MINLINE int power_of_2_max_i(int n); MINLINE int power_of_2_min_i(int n); +MINLINE int divide_round_i(int a, int b); + MINLINE float shell_angle_to_dist(const float angle); #if (defined(WIN32) || defined(WIN64)) && !defined(FREE_WINDOWS) |