[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50880] trunk/blender/source/blender/imbuf /intern/colormanagement.c: Color Management: render result could have been incorrectly changed by file saving routines

Sergey Sharybin sergey.vfx at gmail.com
Tue Sep 25 11:34:19 CEST 2012


Revision: 50880
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50880
Author:   nazgul
Date:     2012-09-25 09:34:19 +0000 (Tue, 25 Sep 2012)
Log Message:
-----------
Color Management: render result could have been incorrectly changed by file saving routines

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

Modified: trunk/blender/source/blender/imbuf/intern/colormanagement.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/colormanagement.c	2012-09-25 09:03:11 UTC (rev 50879)
+++ trunk/blender/source/blender/imbuf/intern/colormanagement.c	2012-09-25 09:34:19 UTC (rev 50880)
@@ -1692,9 +1692,25 @@
 		int make_byte = FALSE;
 		ImFileType *type;
 
-		if (allocate_result)
+		if (allocate_result) {
 			colormanaged_ibuf = IMB_dupImBuf(ibuf);
+		}
+		else {
+			/* render pipeline is constructing image buffer itself, but it's re-using byte and float buffers from render result
+			 * make copy of this buffers here sine this buffers would be transformed to other color space here
+			 */
 
+			if (ibuf->rect && (ibuf->mall & IB_rect) == 0) {
+				ibuf->rect = MEM_dupallocN(ibuf->rect);
+				ibuf->mall |= IB_rect;
+			}
+
+			if (ibuf->rect_float && (ibuf->mall & IB_rectfloat) == 0) {
+				ibuf->rect_float = MEM_dupallocN(ibuf->rect_float);
+				ibuf->mall |= IB_rectfloat;
+			}
+		}
+
 		/* for proper check whether byte buffer is required by a format or not
 		 * should be pretty safe since this image buffer is supposed to be used for
 		 * saving only and ftype would be overwritten a bit later by BKE_imbuf_write




More information about the Bf-blender-cvs mailing list