diff options
Diffstat (limited to 'source/blender/render/intern/source/pipeline.c')
-rw-r--r-- | source/blender/render/intern/source/pipeline.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index abecad3b0c6..10d1c1e5f60 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1069,12 +1069,25 @@ void RE_ResultGet32(Render *re, unsigned int *rect) int tot= rres.rectx*rres.recty; char *cp= (char *)rect; - for(;tot>0; tot--, cp+=4, fp+=4) { - cp[0] = FTOCHAR(fp[0]); - cp[1] = FTOCHAR(fp[1]); - cp[2] = FTOCHAR(fp[2]); - cp[3] = FTOCHAR(fp[3]); + if (re->r.color_mgt_flag & R_COLOR_MANAGEMENT) { + /* Finally convert back to sRGB rendered image */ + for(;tot>0; tot--, cp+=4, fp+=4) { + cp[0] = FTOCHAR(linearrgb_to_srgb(fp[0])); + cp[1] = FTOCHAR(linearrgb_to_srgb(fp[1])); + cp[2] = FTOCHAR(linearrgb_to_srgb(fp[2])); + cp[3] = FTOCHAR(fp[3]); + } } + else { + /* Color management is off : no conversion necessary */ + for(;tot>0; tot--, cp+=4, fp+=4) { + cp[0] = FTOCHAR(fp[0]); + cp[1] = FTOCHAR(fp[1]); + cp[2] = FTOCHAR(fp[2]); + cp[3] = FTOCHAR(fp[3]); + } + } + } else /* else fill with black */ |