Revision: 23521
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23521
Author:   blendix
Date:     2009-09-28 11:06:28 +0200 (Mon, 28 Sep 2009)

Log Message:
-----------
Fix #19470: displaying depth pass could crash, conversion from
float to byte was not working correct.

Modified Paths:
--------------
    trunk/blender/source/blender/imbuf/intern/divers.c

Modified: trunk/blender/source/blender/imbuf/intern/divers.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/divers.c  2009-09-28 08:52:02 UTC 
(rev 23520)
+++ trunk/blender/source/blender/imbuf/intern/divers.c  2009-09-28 09:06:28 UTC 
(rev 23521)
@@ -190,7 +190,11 @@
                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 @@
                        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]);


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to