From 58530a5affce93388937064e6dadd1eadc2b1b0c Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Tue, 2 Apr 2013 12:41:11 +0000 Subject: Usability fix, for color grading. The Scopes and Histogram (Image editor, Sequencer) were not updating on changes in color or display settings. - Missing notifiers for refreshing - Missing code to draw correct for managed byte buffers. --- source/blender/blenkernel/intern/colortools.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'source/blender/blenkernel/intern/colortools.c') diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 5176f93f4f3..6dc496f060c 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -1008,6 +1008,7 @@ void BKE_histogram_update_sample_line(Histogram *hist, ImBuf *ibuf, const ColorM IMB_colormanagement_processor_free(cm_processor); } +/* if view_settings, it also applies this to byte buffers */ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings) { @@ -1021,7 +1022,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings * float rgba[4], ycc[3], luma; int ycc_mode = -1; const short is_float = (ibuf->rect_float != NULL); - + void *cache_handle = NULL; struct ColormanageProcessor *cm_processor = NULL; if (ibuf->rect == NULL && ibuf->rect_float == NULL) return; @@ -1090,12 +1091,17 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings * if (is_float) rf = ibuf->rect_float; - else - rc = (unsigned char *)ibuf->rect; - + else { + if (view_settings) + rc = (unsigned char *)IMB_display_buffer_acquire(ibuf, view_settings, display_settings, &cache_handle); + else + rc = (unsigned char *)ibuf->rect; + } + if (ibuf->rect_float) cm_processor = IMB_colormanagement_display_processor_new(view_settings, display_settings); + printf("update %p\n", cm_processor); for (y = 0; y < ibuf->y; y++) { if (savedlines < scopes->sample_lines && y >= ((savedlines) * ibuf->y) / (scopes->sample_lines + 1)) { saveline = 1; @@ -1193,7 +1199,9 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings * if (cm_processor) IMB_colormanagement_processor_free(cm_processor); - + if (cache_handle) + IMB_display_buffer_release(cache_handle); + scopes->ok = 1; } -- cgit v1.2.3