Color Management: float generated images had is_data flag set incorrect

This commit is contained in:
Sergey Sharybin 2012-09-25 08:42:24 +00:00
parent 3cf59bce78
commit 90a5e8593c
3 changed files with 19 additions and 7 deletions

@ -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)); BLI_strncpy(colorspace_settings->name, colorspace, sizeof(colorspace_settings->name));
} }
IMB_colormanagement_check_is_data(ibuf, colorspace_settings->name);
} }
else { else {
ibuf = IMB_allocImBuf(width, height, depth, IB_rect); ibuf = IMB_allocImBuf(width, height, depth, IB_rect);

@ -58,6 +58,7 @@ void IMB_colormanagement_validate_settings(struct ColorManagedDisplaySettings *d
struct ColorManagedViewSettings *view_settings); struct ColorManagedViewSettings *view_settings);
const char *IMB_colormanagement_role_colorspace_name_get(int role); 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); void IMB_colormanagement_assign_rect_colorspace(struct ImBuf *ibuf, const char *name);
/* ** Color space transformation functions ** */ /* ** Color space transformation functions ** */

@ -1071,17 +1071,26 @@ const char *IMB_colormanagement_role_colorspace_name_get(int role)
return NULL; 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) void IMB_colormanagement_assign_rect_colorspace(ImBuf *ibuf, const char *name)
{ {
ColorSpace *colorspace = colormanage_colorspace_get_named(name); ColorSpace *colorspace = colormanage_colorspace_get_named(name);
if (colorspace) {
ibuf->rect_colorspace = colorspace;
if (colorspace->is_data) ibuf->rect_colorspace = colorspace;
ibuf->colormanage_flag |= IMB_COLORMANAGE_IS_DATA;
else if (colorspace->is_data)
ibuf->colormanage_flag &= ~IMB_COLORMANAGE_IS_DATA; ibuf->colormanage_flag |= IMB_COLORMANAGE_IS_DATA;
} else
ibuf->colormanage_flag &= ~IMB_COLORMANAGE_IS_DATA;
} }
/*********************** Threaded display buffer transform routines *************************/ /*********************** Threaded display buffer transform routines *************************/