Color Management: new generated images had empty color space by default

Now use default byte/float colorspace when creating new image.
This commit is contained in:
Sergey Sharybin 2012-09-19 19:53:16 +00:00
parent 8801008507
commit a09b5c1f20

@ -643,6 +643,7 @@ Image *BKE_image_add_generated(unsigned int width, unsigned int height, const ch
if (ima) {
ImBuf *ibuf;
const char *colorspace;
/* BLI_strncpy(ima->name, name, FILE_MAX); */ /* don't do this, this writes in ain invalid filepath! */
ima->gen_x = width;
@ -653,6 +654,14 @@ Image *BKE_image_add_generated(unsigned int width, unsigned int height, const ch
ibuf = add_ibuf_size(width, height, ima->name, depth, floatbuf, gen_type, color);
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
/* assign colorspaces */
if (floatbuf)
colorspace = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DEFAULT_FLOAT);
else
colorspace = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DEFAULT_BYTE);
BLI_strncpy(ima->colorspace_settings.name, colorspace, sizeof(ima->colorspace_settings.name));
ima->ok = IMA_OK_LOADED;
}