[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52437] trunk/blender/source/blender/imbuf /intern/cineon/cineon_dpx.c: Fix #33222: When rendering DPX it' s flipped in the Image Editor

Sergey Sharybin sergey.vfx at gmail.com
Wed Nov 21 12:10:39 CET 2012


Revision: 52437
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52437
Author:   nazgul
Date:     2012-11-21 11:10:37 +0000 (Wed, 21 Nov 2012)
Log Message:
-----------
Fix #33222: When rendering DPX it's flipped in the Image Editor

Avoid using IMB_flipy from image save callback. It will use a bit more
memory but wold be thread-safe.

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

Modified: trunk/blender/source/blender/imbuf/intern/cineon/cineon_dpx.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/cineon/cineon_dpx.c	2012-11-21 10:57:45 UTC (rev 52436)
+++ trunk/blender/source/blender/imbuf/intern/cineon/cineon_dpx.c	2012-11-21 11:10:37 UTC (rev 52437)
@@ -139,9 +139,19 @@
 	if (ibuf->rect_float != 0 && bitspersample != 8) {
 		/* don't use the float buffer to save 8 bpp picture to prevent color banding
 		   (there's no dithering algorithm behing the logImageSetDataRGBA function) */
-		IMB_flipy(ibuf);
-		rvalue = (logImageSetDataRGBA(logImage, ibuf->rect_float, 1) == 0);
-		IMB_flipy(ibuf);
+
+		fbuf = (float *)MEM_mallocN(ibuf->x * ibuf->y * 4 * sizeof(float), "fbuf in imb_save_dpx_cineon");
+
+		for (y = 0; y < ibuf->y; y++) {
+			float *dst_ptr = fbuf + 4 * ((ibuf->y - y - 1) * ibuf->x);
+			float *src_ptr = ibuf->rect_float + 4 * (y * ibuf->x);
+
+			memcpy(dst_ptr, src_ptr, 4 * ibuf->x * sizeof(float));
+		}
+
+		rvalue = (logImageSetDataRGBA(logImage, fbuf, 1) == 0);
+
+		MEM_freeN(fbuf);
 	}
 	else {
 		if (ibuf->rect == 0)




More information about the Bf-blender-cvs mailing list