diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-09-18 14:11:41 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-09-18 16:55:41 +0300 |
commit | d0344d7b7d619e62bc852c4d00df52cfbfdda544 (patch) | |
tree | 713d7bfd2faa3d77ef1f67a8072abf8a05a29256 /source/blender/blenkernel/intern/customdata.c | |
parent | c4fc9c4a8ecc421fdbf1f5d06d3b67ac4c8c1895 (diff) |
Cleanup: use clamped rounding functions
Diffstat (limited to 'source/blender/blenkernel/intern/customdata.c')
-rw-r--r-- | source/blender/blenkernel/intern/customdata.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 0939d35ed8d..68acb60f21a 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -828,10 +828,10 @@ static void layerInterp_mloopcol( * although weights should also not cause this situation */ /* also delay writing to the destination incase dest is in sources */ - mc->r = CLAMPIS(iroundf(col.r), 0, 255); - mc->g = CLAMPIS(iroundf(col.g), 0, 255); - mc->b = CLAMPIS(iroundf(col.b), 0, 255); - mc->a = CLAMPIS(iroundf(col.a), 0, 255); + mc->r = round_fl_to_uchar_clamp(col.r); + mc->g = round_fl_to_uchar_clamp(col.g); + mc->b = round_fl_to_uchar_clamp(col.b); + mc->a = round_fl_to_uchar_clamp(col.a); } static int layerMaxNum_mloopcol(void) @@ -1054,10 +1054,10 @@ static void layerInterp_mcol( /* Subdivide smooth or fractal can cause problems without clamping * although weights should also not cause this situation */ - mc[j].a = CLAMPIS(iroundf(col[j].a), 0, 255); - mc[j].r = CLAMPIS(iroundf(col[j].r), 0, 255); - mc[j].g = CLAMPIS(iroundf(col[j].g), 0, 255); - mc[j].b = CLAMPIS(iroundf(col[j].b), 0, 255); + mc[j].a = round_fl_to_uchar_clamp(col[j].a); + mc[j].r = round_fl_to_uchar_clamp(col[j].r); + mc[j].g = round_fl_to_uchar_clamp(col[j].g); + mc[j].b = round_fl_to_uchar_clamp(col[j].b); } } |