diff options
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 2 | ||||
-rw-r--r-- | source/blender/imbuf/IMB_colormanagement.h | 1 | ||||
-rw-r--r-- | source/blender/imbuf/intern/colormanagement.c | 23 |
3 files changed, 19 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index e73f4fa79af..8b287eb2863 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -619,6 +619,8 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char BLI_strncpy(colorspace_settings->name, colorspace, sizeof(colorspace_settings->name)); } + + IMB_colormanagement_check_is_data(ibuf, colorspace_settings->name); } else { ibuf = IMB_allocImBuf(width, height, depth, IB_rect); diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h index f6aaae716a8..f05973dd210 100644 --- a/source/blender/imbuf/IMB_colormanagement.h +++ b/source/blender/imbuf/IMB_colormanagement.h @@ -58,6 +58,7 @@ void IMB_colormanagement_validate_settings(struct ColorManagedDisplaySettings *d struct ColorManagedViewSettings *view_settings); const char *IMB_colormanagement_role_colorspace_name_get(int role); +void IMB_colormanagement_check_is_data(struct ImBuf *ibuf, const char *name); void IMB_colormanagement_assign_rect_colorspace(struct ImBuf *ibuf, const char *name); /* ** Color space transformation functions ** */ diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 0f1a880fb75..c5d0b935784 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -1071,17 +1071,26 @@ const char *IMB_colormanagement_role_colorspace_name_get(int role) return NULL; } +void IMB_colormanagement_check_is_data(ImBuf *ibuf, const char *name) +{ + ColorSpace *colorspace = colormanage_colorspace_get_named(name); + + if (colorspace->is_data) + ibuf->colormanage_flag |= IMB_COLORMANAGE_IS_DATA; + else + ibuf->colormanage_flag &= ~IMB_COLORMANAGE_IS_DATA; +} + void IMB_colormanagement_assign_rect_colorspace(ImBuf *ibuf, const char *name) { ColorSpace *colorspace = colormanage_colorspace_get_named(name); - if (colorspace) { - ibuf->rect_colorspace = colorspace; - if (colorspace->is_data) - ibuf->colormanage_flag |= IMB_COLORMANAGE_IS_DATA; - else - ibuf->colormanage_flag &= ~IMB_COLORMANAGE_IS_DATA; - } + ibuf->rect_colorspace = colorspace; + + if (colorspace->is_data) + ibuf->colormanage_flag |= IMB_COLORMANAGE_IS_DATA; + else + ibuf->colormanage_flag &= ~IMB_COLORMANAGE_IS_DATA; } /*********************** Threaded display buffer transform routines *************************/ |