Color Management: float generated images had is_data flag set incorrect
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 25 Sep 2012 08:42:24 +0000 (08:42 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 25 Sep 2012 08:42:24 +0000 (08:42 +0000)
source/blender/blenkernel/intern/image.c
source/blender/imbuf/IMB_colormanagement.h
source/blender/imbuf/intern/colormanagement.c

index e73f4fa..8b287eb 100644 (file)
@@ -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);
index f6aaae7..f05973d 100644 (file)
@@ -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 ** */
index 0f1a880..c5d0b93 100644 (file)
@@ -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 *************************/