Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2013-04-02 16:41:11 +0400
committerTon Roosendaal <ton@blender.org>2013-04-02 16:41:11 +0400
commit58530a5affce93388937064e6dadd1eadc2b1b0c (patch)
tree5e5ed13f899b1194f79956b24d8cb37c431c1cf7
parenta78aa15cd653c18bc0b3b486cf4c7dab39f85fd3 (diff)
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.
-rw-r--r--source/blender/blenkernel/intern/colortools.c18
-rw-r--r--source/blender/editors/space_image/space_image.c12
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c4
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c1
4 files changed, 26 insertions, 9 deletions
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;
}
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 761becdbf8e..1b4ff44bb6b 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -435,6 +435,12 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
/* context changes */
switch (wmn->category) {
+ case NC_WINDOW:
+ /* notifier comes from editing color space */
+ image_scopes_tag_refresh(sa);
+ ED_area_tag_refresh(sa);
+ ED_area_tag_redraw(sa);
+ break;
case NC_SCENE:
switch (wmn->data) {
case ND_FRAME:
@@ -801,11 +807,15 @@ static void image_scope_area_draw(const bContext *C, ARegion *ar)
Scene *scene = CTX_data_scene(C);
void *lock;
ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock);
+
if (ibuf) {
if (!sima->scopes.ok) {
BKE_histogram_update_sample_line(&sima->sample_line_hist, ibuf, &scene->view_settings, &scene->display_settings);
}
- scopes_update(&sima->scopes, ibuf, &scene->view_settings, &scene->display_settings);
+ if (sima->image->flag & IMA_VIEW_AS_RENDER)
+ scopes_update(&sima->scopes, ibuf, &scene->view_settings, &scene->display_settings);
+ else
+ scopes_update(&sima->scopes, ibuf, NULL, &scene->display_settings);
}
ED_space_image_release_buffer(sima, ibuf, lock);
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 3c2c715efc2..536832a2ff8 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -897,10 +897,8 @@ static ImBuf *sequencer_make_scope(Scene *scene, ImBuf *ibuf, ImBuf *(*make_scop
ImBuf *display_ibuf = IMB_dupImBuf(ibuf);
ImBuf *scope;
- if (display_ibuf->rect_float) {
- IMB_colormanagement_imbuf_make_display_space(display_ibuf, &scene->view_settings,
+ IMB_colormanagement_imbuf_make_display_space(display_ibuf, &scene->view_settings,
&scene->display_settings);
- }
scope = make_scope_cb(display_ibuf);
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index ffe89407715..c933bbff0b3 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -330,6 +330,7 @@ static void sequencer_listener(ScrArea *sa, wmNotifier *wmn)
break;
}
break;
+ case NC_WINDOW:
case NC_SPACE:
if (wmn->data == ND_SPACE_SEQUENCER)
sequencer_scopes_tag_refresh(sa);