diff options
author | Ton Roosendaal <ton@blender.org> | 2013-04-02 21:12:21 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2013-04-02 21:12:21 +0400 |
commit | 726dedafbc6d9b4a12ccf1a715f16459d7e7b1ef (patch) | |
tree | 6c2bac61dc5d1bec0b8286fa1c7a97782e6e1b28 /source/blender/blenkernel/intern/colortools.c | |
parent | dc685bc1c3702c580dc29c1e5132d3e7bc4601e0 (diff) |
More Histogram fixes:
Sequencer histogram was calculating still badly, now it uses a per-color
component counter to calculate the levels (instead of counter for all)
Diffstat (limited to 'source/blender/blenkernel/intern/colortools.c')
-rw-r--r-- | source/blender/blenkernel/intern/colortools.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 9321141f4cc..04cc3cc6a09 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -1092,10 +1092,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings * if (is_float) rf = ibuf->rect_float; else { - if (view_settings) - rc = (unsigned char *)IMB_display_buffer_acquire(ibuf, view_settings, display_settings, &cache_handle); - else - rc = (unsigned char *)ibuf->rect; + rc = (unsigned char *)IMB_display_buffer_acquire(ibuf, view_settings, display_settings, &cache_handle); } if (ibuf->rect_float) @@ -1178,11 +1175,12 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings * if (bin_b[x] > nb) nb = bin_b[x]; if (bin_a[x] > na) na = bin_a[x]; } - divl = 1.0 / (double)nl; - diva = 1.0 / (double)na; - divr = 1.0 / (double)nr; - divg = 1.0 / (double)ng; - divb = 1.0 / (double)nb; + divl = nl ? 1.0 / (double)nl : 1.0; + diva = na ? 1.0 / (double)na : 1.0; + divr = nr ? 1.0 / (double)nr : 1.0; + divg = ng ? 1.0 / (double)ng : 1.0; + divb = nb ? 1.0 / (double)nb : 1.0; + for (x = 0; x < 256; x++) { scopes->hist.data_luma[x] = bin_lum[x] * divl; scopes->hist.data_r[x] = bin_r[x] * divr; |