diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-09-28 13:06:28 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-09-28 13:06:28 +0400 |
commit | 981afef08e051d00e955526c1c79b8dd01d4bdd5 (patch) | |
tree | 7f1e53ae1ebef7cc7888428fc94acca1af9e3101 /source/blender/imbuf/intern/divers.c | |
parent | ea187e54a8cd4456dbbfb474ba652b2aab69756f (diff) |
Fix #19470: displaying depth pass could crash, conversion from
float to byte was not working correct.
Diffstat (limited to 'source/blender/imbuf/intern/divers.c')
-rw-r--r-- | source/blender/imbuf/intern/divers.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index 6e1a176a5d2..e84a9302bbf 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -190,7 +190,11 @@ void IMB_rect_from_float(struct ImBuf *ibuf) to = (unsigned char *) ibuf->rect; } - if (profile == IB_PROFILE_SRGB && (channels == 3 || channels == 4)) { + if(channels==1) { + for (i = ibuf->x * ibuf->y; i > 0; i--, to+=4, tof++) + to[1]= to[2]= to[3]= to[0] = FTOCHAR(tof[0]); + } + else if (profile == IB_PROFILE_SRGB) { if(channels == 3) { for (i = ibuf->x * ibuf->y; i > 0; i--, to+=4, tof+=3) { srgb[0]= linearrgb_to_srgb(tof[0]); @@ -207,12 +211,8 @@ void IMB_rect_from_float(struct ImBuf *ibuf) floatbuf_to_srgb_byte(tof, to, 0, ibuf->x, 0, ibuf->y, ibuf->x); } } - else if(ELEM(profile, IB_PROFILE_NONE, IB_PROFILE_LINEAR_RGB) && (dither==0.0f || channels!=4)) { - if(channels==1) { - for (i = ibuf->x * ibuf->y; i > 0; i--, to+=4, tof++) - to[1]= to[2]= to[3]= to[0] = FTOCHAR(tof[0]); - } - else if(channels==3) { + else if(ELEM(profile, IB_PROFILE_NONE, IB_PROFILE_LINEAR_RGB) && dither==0.0f) { + if(channels==3) { for (i = ibuf->x * ibuf->y; i > 0; i--, to+=4, tof+=3) { to[0] = FTOCHAR(tof[0]); to[1] = FTOCHAR(tof[1]); |