diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-12-18 13:51:09 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-12-18 13:51:09 +0400 |
commit | 2249d71e2636b99691281139c82b03f754c313b7 (patch) | |
tree | a3a13007e7c8a4b9974a874cde87f270450a7860 /source/blender/imbuf/intern/colormanagement.c | |
parent | d791e606879f3f10323c07f3f3b338d82f03e08c (diff) |
Color management: added utility function to apply processor on a pixel
It applies color management on a pixel in a way, based on number of
channels of this pixel.
Simplifies partial update code a bit.
Diffstat (limited to 'source/blender/imbuf/intern/colormanagement.c')
-rw-r--r-- | source/blender/imbuf/intern/colormanagement.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 91d558c9aed..cc8a453c169 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -2690,17 +2690,7 @@ static void partial_buffer_update_rect(ImBuf *ibuf, unsigned char *display_buffe } if (!is_data) { - if (channels == 4) { - IMB_colormanagement_processor_apply_v4_predivide(cm_processor, pixel); - } - else if (channels == 3) { - IMB_colormanagement_processor_apply_v3(cm_processor, pixel); - } - else /* if (channels == 1) */ { - if (cm_processor->curve_mapping) { - curve_mapping_apply_pixel(cm_processor->curve_mapping, pixel, 1); - } - } + IMB_colormanagement_processor_apply_pixel(cm_processor, pixel, channels); } if (display_buffer_float) { @@ -2917,6 +2907,24 @@ void IMB_colormanagement_processor_apply_v3(ColormanageProcessor *cm_processor, OCIO_processorApplyRGB(cm_processor->processor, pixel); } +void IMB_colormanagement_processor_apply_pixel(struct ColormanageProcessor *cm_processor, float *pixel, int channels) +{ + if (channels == 4) { + IMB_colormanagement_processor_apply_v4_predivide(cm_processor, pixel); + } + else if (channels == 3) { + IMB_colormanagement_processor_apply_v3(cm_processor, pixel); + } + else if (channels == 1) { + if (cm_processor->curve_mapping) { + curve_mapping_apply_pixel(cm_processor->curve_mapping, pixel, 1); + } + } + else { + BLI_assert(!"Incorrect number of channels passed to IMB_colormanagement_processor_apply_pixel"); + } +} + void IMB_colormanagement_processor_apply(ColormanageProcessor *cm_processor, float *buffer, int width, int height, int channels, bool predivide) { |