[Bf-blender-cvs] [17e40f8] master: Consolidate multiple checks for out->rect_float in prepare_effect_imbufs()

Chad Fraleigh noreply at git.blender.org
Thu Jul 14 14:17:17 CEST 2016


Commit: 17e40f821e56ec1fc07a4e707d9b86fa8b0a2bda
Author: Chad Fraleigh
Date:   Thu Jul 14 14:15:43 2016 +0200
Branches: master
https://developer.blender.org/rB17e40f821e56ec1fc07a4e707d9b86fa8b0a2bda

Consolidate multiple checks for out->rect_float in prepare_effect_imbufs()

Many checks for out->rect_float being [non-]NULL are done back-to-back.
Combining them into a single check for slightly more efficient code and
less code clutter for easier readability/understanding.

Differential Revision: https://developer.blender.org/D2097

===================================================================

M	source/blender/blenkernel/intern/seqeffects.c

===================================================================

diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 3de4a42..ce7c520 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -123,28 +123,34 @@ static ImBuf *prepare_effect_imbufs(const SeqRenderData *context, ImBuf *ibuf1,
 		out = IMB_allocImBuf(x, y, 32, IB_rect);
 	}
 	
-	if (ibuf1 && !ibuf1->rect_float && out->rect_float) {
-		BKE_sequencer_imbuf_to_sequencer_space(scene, ibuf1, true);
-	}
-	if (ibuf2 && !ibuf2->rect_float && out->rect_float) {
-		BKE_sequencer_imbuf_to_sequencer_space(scene, ibuf2, true);
-	}
-	if (ibuf3 && !ibuf3->rect_float && out->rect_float) {
-		BKE_sequencer_imbuf_to_sequencer_space(scene, ibuf3, true);
-	}
+	if (out->rect_float) {
+		if (ibuf1 && !ibuf1->rect_float) {
+			BKE_sequencer_imbuf_to_sequencer_space(scene, ibuf1, true);
+		}
+
+		if (ibuf2 && !ibuf2->rect_float) {
+			BKE_sequencer_imbuf_to_sequencer_space(scene, ibuf2, true);
+		}
+
+		if (ibuf3 && !ibuf3->rect_float) {
+			BKE_sequencer_imbuf_to_sequencer_space(scene, ibuf3, true);
+		}
 	
-	if (ibuf1 && !ibuf1->rect && !out->rect_float) {
-		IMB_rect_from_float(ibuf1);
-	}
-	if (ibuf2 && !ibuf2->rect && !out->rect_float) {
-		IMB_rect_from_float(ibuf2);
-	}
-	if (ibuf3 && !ibuf3->rect && !out->rect_float) {
-		IMB_rect_from_float(ibuf3);
+		IMB_colormanagement_assign_float_colorspace(out, scene->sequencer_colorspace_settings.name);
 	}
+	else {
+		if (ibuf1 && !ibuf1->rect) {
+			IMB_rect_from_float(ibuf1);
+		}
 
-	if (out->rect_float)
-		IMB_colormanagement_assign_float_colorspace(out, scene->sequencer_colorspace_settings.name);
+		if (ibuf2 && !ibuf2->rect) {
+			IMB_rect_from_float(ibuf2);
+		}
+
+		if (ibuf3 && !ibuf3->rect) {
+			IMB_rect_from_float(ibuf3);
+		}
+	}
 
 	/* If effect only affecting a single channel, forward input's metadata to the output. */
 	if (ibuf1 != NULL && ibuf1 == ibuf2 && ibuf2 == ibuf3) {




More information about the Bf-blender-cvs mailing list