diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-04-08 05:23:38 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-04-08 05:24:52 +0300 |
commit | 808ea6271a0107cc3df52fb0ef18ccec191f6f15 (patch) | |
tree | 6da8eb7f2bb0df099255d3020f67f47d80465480 /source/blender/blenkernel | |
parent | ccfb9a96c346eb8df95775b34ae5388fa5fcacb1 (diff) |
Cleanup: confusing if statements & alignment
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 4cea8aa0b85..2fde98cce74 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1161,30 +1161,25 @@ static void make_black_ibuf(ImBuf *ibuf) } } -static void multibuf(ImBuf *ibuf, float fmul) +static void multibuf(ImBuf *ibuf, const float fmul) { char *rt; float *rt_float; - int a, mul, icol; + int a; - mul = (int)(256.0f * fmul); rt = (char *)ibuf->rect; rt_float = ibuf->rect_float; if (rt) { + const int imul = (int)(256.0f * fmul); a = ibuf->x * ibuf->y; while (a--) { + rt[0] = min_ii((imul * rt[0]) >> 8, 255); + rt[1] = min_ii((imul * rt[1]) >> 8, 255); + rt[2] = min_ii((imul * rt[2]) >> 8, 255); + rt[3] = min_ii((imul * rt[3]) >> 8, 255); - icol = (mul * rt[0]) >> 8; - if (icol > 254) rt[0] = 255; else rt[0] = icol; - icol = (mul * rt[1]) >> 8; - if (icol > 254) rt[1] = 255; else rt[1] = icol; - icol = (mul * rt[2]) >> 8; - if (icol > 254) rt[2] = 255; else rt[2] = icol; - icol = (mul * rt[3]) >> 8; - if (icol > 254) rt[3] = 255; else rt[3] = icol; - rt += 4; } } |