Revision: 48498
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48498
Author: nazgul
Date: 2012-07-02 16:37:40 +0000 (Mon, 02 Jul 2012)
Log Message:
-----------
Color management refactor
- Move color management display settings into own structure like it's
done for view settings.
This is helpful from two sides:
* It is planned to support display calibration settings which
should be taken into account by color management stuff to
add needed transformations to OCIO processor.
* File saving should be able to make the same display
transformations as it's done by window when displaying the image.
Having own DNA and RNA structures for display device settings
helps avoiding having duplicated code.
- Small refactor of cacheing functions which are now accepts
cache-like versions of view and display settings. This structures
used for cache are quite the same as DNA structures but they contains
indices of view and display which avoids extra lookup for this
things.
This also helps having reasonable amount of variables passing
to cache functions.
Modified Paths:
--------------
branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_color_management.py
branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_info.py
branches/soc-2011-tomato/source/blender/blenkernel/BKE_colortools.h
branches/soc-2011-tomato/source/blender/blenkernel/intern/colortools.c
branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c
branches/soc-2011-tomato/source/blender/editors/space_image/image_draw.c
branches/soc-2011-tomato/source/blender/editors/space_node/drawnode.c
branches/soc-2011-tomato/source/blender/imbuf/IMB_colormanagement.h
branches/soc-2011-tomato/source/blender/imbuf/intern/colormanagement.c
branches/soc-2011-tomato/source/blender/makesdna/DNA_color_types.h
branches/soc-2011-tomato/source/blender/makesdna/DNA_windowmanager_types.h
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_color.c
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_wm.c
branches/soc-2011-tomato/source/blender/windowmanager/intern/wm_window.c
Modified:
branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_color_management.py
===================================================================
---
branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_color_management.py
2012-07-02 16:27:09 UTC (rev 48497)
+++
branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_color_management.py
2012-07-02 16:37:40 UTC (rev 48498)
@@ -25,6 +25,7 @@
space = context.space_data
window = context.window
+ display_settings = context.window.display_settings
space_view_settings = space.view_settings
if space_view_settings.use_global_settings:
@@ -34,7 +35,7 @@
col = layout.column()
col.prop(space_view_settings, "use_global_settings")
- col.prop(window, "display_device", text="Display")
+ col.prop(display_settings, "display_device", text="Display")
col.prop(view_settings, "view_transform", text="View")
col = layout.column()
Modified: branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_info.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_info.py
2012-07-02 16:27:09 UTC (rev 48497)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_info.py
2012-07-02 16:37:40 UTC (rev 48498)
@@ -357,6 +357,7 @@
import sys
window = context.window
+ display_settings = window.display_settings
layout = self.layout
@@ -367,7 +368,7 @@
layout.operator("wm.console_toggle", icon='CONSOLE')
layout.separator()
- layout.prop_menu_enum(window, "display_device", text="Display")
+ layout.prop_menu_enum(display_settings, "display_device",
text="Display")
class INFO_MT_help(Menu):
Modified: branches/soc-2011-tomato/source/blender/blenkernel/BKE_colortools.h
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/BKE_colortools.h
2012-07-02 16:27:09 UTC (rev 48497)
+++ branches/soc-2011-tomato/source/blender/blenkernel/BKE_colortools.h
2012-07-02 16:37:40 UTC (rev 48498)
@@ -31,6 +31,7 @@
* \ingroup bke
*/
+struct ColorManagedDisplaySettings;
struct ColorManagedViewSettings;
struct CurveMapping;
struct CurveMap;
@@ -81,6 +82,10 @@
void scopes_free(struct Scopes *scopes);
void scopes_new(struct Scopes *scopes);
+void BKE_color_managed_display_settings_init(struct
ColorManagedDisplaySettings *settings);
+void BKE_color_managed_display_settings_copy(struct
ColorManagedDisplaySettings *new_settings,
+ const struct
ColorManagedDisplaySettings *settings);
+
void BKE_color_managed_view_settings_init(struct ColorManagedViewSettings
*settings);
void BKE_color_managed_view_settings_copy(struct ColorManagedViewSettings
*new_settings,
const struct
ColorManagedViewSettings *settings);
Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/colortools.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/colortools.c
2012-07-02 16:27:09 UTC (rev 48497)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/colortools.c
2012-07-02 16:37:40 UTC (rev 48498)
@@ -49,6 +49,7 @@
#include "BKE_fcurve.h"
+#include "IMB_colormanagement.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
@@ -1208,6 +1209,19 @@
scopes->vecscope = NULL;
}
+void BKE_color_managed_display_settings_init(ColorManagedDisplaySettings
*settings)
+{
+ const char *display_name =
IMB_colormanagement_display_get_default_name();
+
+ BLI_strncpy(settings->display_device, display_name,
sizeof(settings->display_device));
+}
+
+void BKE_color_managed_display_settings_copy(ColorManagedDisplaySettings
*new_settings,
+ const ColorManagedDisplaySettings
*settings)
+{
+ BLI_strncpy(new_settings->display_device, settings->display_device,
sizeof(new_settings->display_device));
+}
+
void BKE_color_managed_view_settings_init(ColorManagedViewSettings *settings)
{
/* OCIO_TODO: use default view transform here when OCIO is completely
integrated
@@ -1223,5 +1237,8 @@
void BKE_color_managed_view_settings_copy(ColorManagedViewSettings
*new_settings,
const ColorManagedViewSettings
*settings)
{
- *new_settings = *settings;
+ BLI_strncpy(new_settings->view_transform, new_settings->view_transform,
sizeof(new_settings->view_transform));
+
+ new_settings->exposure = settings->exposure;
+ new_settings->gamma = settings->gamma;
}
Modified: branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c
2012-07-02 16:27:09 UTC (rev 48497)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c
2012-07-02 16:37:40 UTC (rev 48498)
@@ -273,7 +273,7 @@
verify_buffer_float(ibuf);
view_settings = IMB_view_settings_get_effective(win,
&sc->view_settings);
- display_buffer = IMB_display_buffer_acquire(ibuf,
view_settings, win->display_device, &cache_handle);
+ display_buffer = IMB_display_buffer_acquire(ibuf,
view_settings, &win->display_settings, &cache_handle);
if (display_buffer) {
int need_fallback = 1;
Modified:
branches/soc-2011-tomato/source/blender/editors/space_image/image_draw.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_image/image_draw.c
2012-07-02 16:27:09 UTC (rev 48497)
+++ branches/soc-2011-tomato/source/blender/editors/space_image/image_draw.c
2012-07-02 16:37:40 UTC (rev 48498)
@@ -463,7 +463,7 @@
image_verify_buffer_float(ima, ibuf, color_manage);
view_settings = IMB_view_settings_get_effective(win,
&sima->view_settings);
- display_buffer = IMB_display_buffer_acquire(ibuf,
view_settings, win->display_device, &cache_handle);
+ display_buffer = IMB_display_buffer_acquire(ibuf,
view_settings, &win->display_settings, &cache_handle);
if (display_buffer)
glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x,
GL_RGBA, GL_UNSIGNED_BYTE, display_buffer);
Modified: branches/soc-2011-tomato/source/blender/editors/space_node/drawnode.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_node/drawnode.c
2012-07-02 16:27:09 UTC (rev 48497)
+++ branches/soc-2011-tomato/source/blender/editors/space_node/drawnode.c
2012-07-02 16:37:40 UTC (rev 48498)
@@ -2986,7 +2986,7 @@
view_settings = IMB_view_settings_get_effective(win,
&snode->view_settings);
- display_buffer = IMB_display_buffer_acquire(ibuf,
view_settings, win->display_device, &cache_handle);
+ display_buffer = IMB_display_buffer_acquire(ibuf,
view_settings, &win->display_settings, &cache_handle);
if (display_buffer) {
if (snode->flag & SNODE_SHOW_ALPHA) {
Modified: branches/soc-2011-tomato/source/blender/imbuf/IMB_colormanagement.h
===================================================================
--- branches/soc-2011-tomato/source/blender/imbuf/IMB_colormanagement.h
2012-07-02 16:27:09 UTC (rev 48497)
+++ branches/soc-2011-tomato/source/blender/imbuf/IMB_colormanagement.h
2012-07-02 16:37:40 UTC (rev 48498)
@@ -33,6 +33,7 @@
#define BCM_CONFIG_FILE "config.ocio"
+struct ColorManagedDisplaySettings;
struct ColorManagedViewSettings;
struct EnumPropertyItem;
struct ImBuf;
@@ -54,7 +55,7 @@
void IMB_colormanage_cache_data_free(struct ImBuf *ibuf);
unsigned char *IMB_display_buffer_acquire(struct ImBuf *ibuf, const struct
ColorManagedViewSettings *view_settings,
- const char *display, void
**cache_handle);
+ const struct
ColorManagedDisplaySettings *display_settings, void **cache_handle);
void IMB_display_buffer_release(void *cache_handle);
void IMB_display_buffer_invalidate(struct ImBuf *ibuf);
@@ -67,6 +68,7 @@
/* ** Display funcrions ** */
int IMB_colormanagement_display_get_named_index(const char *name);
const char *IMB_colormanagement_display_get_indexed_name(int index);
+const char *IMB_colormanagement_display_get_default_name(void);
/* ** View funcrions ** */
int IMB_colormanagement_view_get_named_index(const char *name);
Modified: branches/soc-2011-tomato/source/blender/imbuf/intern/colormanagement.c
===================================================================
--- branches/soc-2011-tomato/source/blender/imbuf/intern/colormanagement.c
2012-07-02 16:27:09 UTC (rev 48497)
+++ branches/soc-2011-tomato/source/blender/imbuf/intern/colormanagement.c
2012-07-02 16:37:40 UTC (rev 48498)
@@ -124,9 +124,28 @@
* becoming zero, original ImBuf is being freed completely.
*/
+/* NOTE: ColormanageCacheViewSettings and ColormanageCacheDisplaySettings are
+ * quite the same as ColorManagedViewSettings and
ColorManageDisplaySettings
+ * but they holds indexes of all transformations and color spaces, not
+ * their names.
+ *
+ * This helps avoid extra colorsmace / display / view lookup without
+ * requiring to pass all variables which affects on display buffer
+ * to color management cache system and keeps calls small and nice.
+ */
+typedef struct ColormanageCacheViewSettings {
+ int view;
+ float exposure;
+ float gamma;
+} ColormanageCacheViewSettings;
+
+typedef struct ColormanageCacheDisplaySettings {
+ int display;
+} ColormanageCacheDisplaySettings;
+
typedef struct ColormanageCacheKey {
ImBuf *ibuf; /* image buffer for which display buffer was
created */
- int view_transform; /* view transformation used for display buffer */
+ int view; /* view transformation used for display buffer */
int display; /* display device name */
} ColormanageCacheKey;
@@ -156,9 +175,9 @@
else if (a->ibuf > b->ibuf)
return 1;
- if (a->view_transform < b->view_transform)
+ if (a->view < b->view)
return -1;
- else if (a->view_transform > b->view_transform)
+ else if (a->view > b->view)
return 1;
if (a->display < b->display)
@@ -201,29 +220,63 @@
}
#ifdef WITH_OCIO
@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs