Changeset View
Changeset View
Standalone View
Standalone View
source/blender/imbuf/intern/colormanagement.c
| Show First 20 Lines • Show All 741 Lines • ▼ Show 20 Lines | void colormanagement_exit(void) | ||||
| memset(&global_glsl_state, 0, sizeof(global_glsl_state)); | memset(&global_glsl_state, 0, sizeof(global_glsl_state)); | ||||
| memset(&global_color_picking_state, 0, sizeof(global_color_picking_state)); | memset(&global_color_picking_state, 0, sizeof(global_color_picking_state)); | ||||
| colormanage_free_config(); | colormanage_free_config(); | ||||
| } | } | ||||
| /*********************** Internal functions *************************/ | /*********************** Internal functions *************************/ | ||||
| static bool colormanage_compatible_look(ColorManagedLook *look, const char *view_name) | |||||
| { | |||||
| if (look->is_noop) { | |||||
| return true; | |||||
| } | |||||
| /* Skip looks only relevant to specific view transforms. */ | |||||
| return (look->view[0] == 0 || (view_name && STREQ(look->view, view_name))); | |||||
| } | |||||
| void colormanage_cache_free(ImBuf *ibuf) | void colormanage_cache_free(ImBuf *ibuf) | ||||
| { | { | ||||
| if (ibuf->display_buffer_flags) { | if (ibuf->display_buffer_flags) { | ||||
| MEM_freeN(ibuf->display_buffer_flags); | MEM_freeN(ibuf->display_buffer_flags); | ||||
| ibuf->display_buffer_flags = NULL; | ibuf->display_buffer_flags = NULL; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | static OCIO_ConstProcessorRcPtr *create_display_buffer_processor(const char *look, | ||||
| ColorManagedLook *look_descr = colormanage_look_get_named(look); | ColorManagedLook *look_descr = colormanage_look_get_named(look); | ||||
| dt = OCIO_createDisplayTransform(); | dt = OCIO_createDisplayTransform(); | ||||
| OCIO_displayTransformSetInputColorSpaceName(dt, from_colorspace); | OCIO_displayTransformSetInputColorSpaceName(dt, from_colorspace); | ||||
| OCIO_displayTransformSetView(dt, view_transform); | OCIO_displayTransformSetView(dt, view_transform); | ||||
| OCIO_displayTransformSetDisplay(dt, display); | OCIO_displayTransformSetDisplay(dt, display); | ||||
| if (look_descr->is_noop == false) { | if (look_descr->is_noop == false && colormanage_compatible_look(look_descr, view_transform)) { | ||||
| OCIO_displayTransformSetLooksOverrideEnabled(dt, true); | OCIO_displayTransformSetLooksOverrideEnabled(dt, true); | ||||
| OCIO_displayTransformSetLooksOverride(dt, look); | OCIO_displayTransformSetLooksOverride(dt, look); | ||||
| } | } | ||||
| /* fstop exposure control */ | /* fstop exposure control */ | ||||
| if (exposure != 0.0f) { | if (exposure != 0.0f) { | ||||
| OCIO_MatrixTransformRcPtr *mt; | OCIO_MatrixTransformRcPtr *mt; | ||||
| float gain = powf(2.0f, exposure); | float gain = powf(2.0f, exposure); | ||||
| ▲ Show 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | static OCIO_ConstProcessorRcPtr *display_to_scene_linear_processor(ColorManagedDisplay *display) | ||||
| } | } | ||||
| return (OCIO_ConstProcessorRcPtr *)display->to_scene_linear; | return (OCIO_ConstProcessorRcPtr *)display->to_scene_linear; | ||||
| } | } | ||||
| void IMB_colormanagement_init_default_view_settings( | void IMB_colormanagement_init_default_view_settings( | ||||
| ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings) | ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings) | ||||
| { | { | ||||
| /* First, try use "Default" view transform of the requested device. */ | /* First, try use "Standard" view transform of the requested device. */ | ||||
| ColorManagedView *default_view = colormanage_view_get_named_for_display( | ColorManagedView *default_view = colormanage_view_get_named_for_display( | ||||
| display_settings->display_device, "Default"); | display_settings->display_device, "Standard"); | ||||
| /* If that fails, we fall back to the default view transform of the display | /* If that fails, we fall back to the default view transform of the display | ||||
| * as per OCIO configuration. */ | * as per OCIO configuration. */ | ||||
| if (default_view == NULL) { | if (default_view == NULL) { | ||||
| ColorManagedDisplay *display = colormanage_display_get_named(display_settings->display_device); | ColorManagedDisplay *display = colormanage_display_get_named(display_settings->display_device); | ||||
| if (display != NULL) { | if (display != NULL) { | ||||
| default_view = colormanage_view_get_default(display); | default_view = colormanage_view_get_default(display); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 2,207 Lines • ▼ Show 20 Lines | void IMB_colormanagement_view_items_add(EnumPropertyItem **items, | ||||
| } | } | ||||
| } | } | ||||
| void IMB_colormanagement_look_items_add(struct EnumPropertyItem **items, | void IMB_colormanagement_look_items_add(struct EnumPropertyItem **items, | ||||
| int *totitem, | int *totitem, | ||||
| const char *view_name) | const char *view_name) | ||||
| { | { | ||||
| ColorManagedLook *look; | ColorManagedLook *look; | ||||
| const char *view_filter = NULL; | |||||
| /* Test if this view transform is limited to specific looks. */ | |||||
| for (look = global_looks.first; look; look = look->next) { | |||||
| if (STREQ(look->view, view_name)) { | |||||
| view_filter = view_name; | |||||
| } | |||||
| } | |||||
| for (look = global_looks.first; look; look = look->next) { | for (look = global_looks.first; look; look = look->next) { | ||||
| if (!look->is_noop && view_filter && !STREQ(look->view, view_filter)) { | if (!colormanage_compatible_look(look, view_name)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| EnumPropertyItem item; | EnumPropertyItem item; | ||||
| item.value = look->index; | item.value = look->index; | ||||
| item.name = look->ui_name; | item.name = look->ui_name; | ||||
| item.identifier = look->name; | item.identifier = look->name; | ||||
| ▲ Show 20 Lines • Show All 835 Lines • Show Last 20 Lines | |||||