[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55968] trunk/blender/source/blender/imbuf /intern/divers.c: Fix issue with bright frames appearing in clip editor when compositor is open .

Sergey Sharybin sergey.vfx at gmail.com
Thu Apr 11 16:15:52 CEST 2013


Revision: 55968
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55968
Author:   nazgul
Date:     2013-04-11 14:15:52 +0000 (Thu, 11 Apr 2013)
Log Message:
-----------
Fix issue with bright frames appearing in clip editor when compositor is open.

Allocate float buffer outside of image buffer,
so work-in-progress color space conversion doesn't
interfere with other parts of blender.

Covers most of cases -- since image buffer wouldn't
have partially-update float buffer all the rest
areas would be happy.

However, if there're places which updates float
buffer from byte buffer, it's still possible
some WIP color space conversion is displayed on
the screen.

But what a heck someone will do such a crappy
conversion anyway!

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	2013-04-11 14:15:25 UTC (rev 55967)
+++ trunk/blender/source/blender/imbuf/intern/divers.c	2013-04-11 14:15:52 UTC (rev 55968)
@@ -627,36 +627,47 @@
 
 void IMB_float_from_rect(ImBuf *ibuf)
 {
+	float *rect_float;
+
 	/* verify if we byte and float buffers */
 	if (ibuf->rect == NULL)
 		return;
 
-	/* lock the color management thread
-	 * need this because allocated but not filled float buffer will confuse
-	 * display transform which lead to black areas across the frame
+	/* allocate float buffer outside of image buffer,
+	 * so work-in-progress color space conversion doesn't
+	 * interfere with other parts of blender
 	 */
-	BLI_lock_thread(LOCK_COLORMANAGE);
+	rect_float = ibuf->rect_float;
+	if (rect_float == NULL) {
+		int size;
 
-	if (ibuf->rect_float == NULL) {
-		if (imb_addrectfloatImBuf(ibuf) == 0) {
-			BLI_unlock_thread(LOCK_COLORMANAGE);
+		size = ibuf->x * ibuf->y;
+		size = size * 4 * sizeof(float);
+		ibuf->channels = 4;
 
+		rect_float = MEM_mapallocN(size, "IMB_float_from_rect");
+
+		if (rect_float == NULL)
 			return;
-		}
 	}
 
 	/* first, create float buffer in non-linear space */
-	IMB_buffer_float_from_byte(ibuf->rect_float, (unsigned char *) ibuf->rect, IB_PROFILE_SRGB, IB_PROFILE_SRGB,
+	IMB_buffer_float_from_byte(rect_float, (unsigned char *) ibuf->rect, IB_PROFILE_SRGB, IB_PROFILE_SRGB,
 	                           FALSE, ibuf->x, ibuf->y, ibuf->x, ibuf->x);
 
 	/* then make float be in linear space */
-	IMB_colormanagement_colorspace_to_scene_linear(ibuf->rect_float, ibuf->x, ibuf->y, ibuf->channels,
+	IMB_colormanagement_colorspace_to_scene_linear(rect_float, ibuf->x, ibuf->y, ibuf->channels,
 	                                               ibuf->rect_colorspace, FALSE);
 
 	/* byte buffer is straight alpha, float should always be premul */
-	IMB_premultiply_rect_float(ibuf->rect_float, ibuf->planes, ibuf->x, ibuf->y);
+	IMB_premultiply_rect_float(rect_float, ibuf->channels, ibuf->x, ibuf->y);
 
-	BLI_unlock_thread(LOCK_COLORMANAGE);
+
+	if (ibuf->rect_float == NULL) {
+		ibuf->rect_float = rect_float;
+		ibuf->mall |= IB_rectfloat;
+		ibuf->flags |= IB_rectfloat;
+	}
 }
 
 /**************************** Color to Grayscale *****************************/




More information about the Bf-blender-cvs mailing list