Color management: initialize input color space for newly opening images
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 30 Jul 2012 16:07:37 +0000 (16:07 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 30 Jul 2012 16:07:37 +0000 (16:07 +0000)
source/blender/blenkernel/BKE_colortools.h
source/blender/blenkernel/intern/colortools.c
source/blender/blenkernel/intern/image.c

index 345ec68f45702e61b54835054ff978e2a904baa5..d9b6e874c25f252c06fdcca38c1ce2e271683015 100644 (file)
@@ -31,6 +31,7 @@
  *  \ingroup bke
  */
 
+struct ColorManagedColorspaceSettings;
 struct ColorManagedDisplaySettings;
 struct ColorManagedViewSettings;
 struct CurveMapping;
@@ -90,4 +91,8 @@ void BKE_color_managed_view_settings_init(struct ColorManagedViewSettings *setti
 void BKE_color_managed_view_settings_copy(struct ColorManagedViewSettings *new_settings,
                                           const struct ColorManagedViewSettings *settings);
 
+void BKE_color_managed_colorspace_settings_init(struct ColorManagedColorspaceSettings *colorspace_settings);
+void BKE_color_managed_colorspace_settings_copy(struct ColorManagedColorspaceSettings *colorspace_settings,
+                                                const struct ColorManagedColorspaceSettings *settings);
+
 #endif
index c489c08f4dfdd2245716eaa5129b5718b63b9ef1..ec9198590ed2963717d419fe0d42c1f788961ec1 100644 (file)
@@ -1244,3 +1244,14 @@ void BKE_color_managed_view_settings_copy(ColorManagedViewSettings *new_settings
        new_settings->exposure = settings->exposure;
        new_settings->gamma = settings->gamma;
 }
+
+void BKE_color_managed_colorspace_settings_init(ColorManagedColorspaceSettings *colorspace_settings)
+{
+       BLI_strncpy(colorspace_settings->name, "NONE", sizeof(colorspace_settings->name));
+}
+
+void BKE_color_managed_colorspace_settings_copy(ColorManagedColorspaceSettings *colorspace_settings,
+                                                const ColorManagedColorspaceSettings *settings)
+{
+       BLI_strncpy(colorspace_settings->name, settings->name, sizeof(colorspace_settings->name));
+}
index fa0070de76b067e0ea13dc40e45cb017f18e79be..e65099cc621761b2f64e7e59e390887858a2cf08 100644 (file)
@@ -71,6 +71,7 @@
 #include "BLI_bpath.h"
 
 #include "BKE_bmfont.h"
+#include "BKE_colortools.h"
 #include "BKE_global.h"
 #include "BKE_icons.h"
 #include "BKE_image.h"
@@ -245,6 +246,8 @@ static Image *image_alloc(const char *name, short source, short type)
 
                ima->source = source;
                ima->type = type;
+
+               BKE_color_managed_colorspace_settings_init(&ima->colorspace_settings);
        }
        return ima;
 }
@@ -327,6 +330,8 @@ Image *BKE_image_copy(Image *ima)
        nima->aspx = ima->aspx;
        nima->aspy = ima->aspy;
 
+       BKE_color_managed_colorspace_settings_copy(&nima->colorspace_settings, &ima->colorspace_settings);
+
        return nima;
 }