[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15935] trunk/blender/source/blender/src/ drawseq.c: == Sequencer ==

Peter Schlaile peter at schlaile.de
Sun Aug 3 17:45:53 CEST 2008


Revision: 15935
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15935
Author:   schlaile
Date:     2008-08-03 17:45:53 +0200 (Sun, 03 Aug 2008)

Log Message:
-----------
== Sequencer ==

This fixes:
[#17405] Sequencer: unselected black strips are unreadable
using
[#17418] Fix for bug #17405: unselected black seq strips text unreadable

Thanks to Roelf De Kock for providing the patch and 
mindrones for the bug report :)

Modified Paths:
--------------
    trunk/blender/source/blender/src/drawseq.c

Modified: trunk/blender/source/blender/src/drawseq.c
===================================================================
--- trunk/blender/source/blender/src/drawseq.c	2008-08-03 15:37:24 UTC (rev 15934)
+++ trunk/blender/source/blender/src/drawseq.c	2008-08-03 15:45:53 UTC (rev 15935)
@@ -98,7 +98,7 @@
 int no_rightbox=0, no_leftbox= 0;
 static void draw_seq_handle(Sequence *seq, SpaceSeq *sseq, float pixelx, short direction);
 static void draw_seq_extensions(Sequence *seq, SpaceSeq *sseq);
-static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2);
+static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2, char *background_col);
 static void draw_shadedstrip(Sequence *seq, char *col, float x1, float y1, float x2, float y2);
 static void draw_seq_strip(struct Sequence *seq, struct ScrArea *sa, struct SpaceSeq *sseq, int outline_tint, float pixelx);
 
@@ -604,7 +604,7 @@
 }
 
 /* draw info text on a sequence strip */
-static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2)
+static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2, char *background_col)
 {
 	float v1[2], v2[2];
 	int len, size;
@@ -670,8 +670,13 @@
 	mval[1]= 1;
 	areamouseco_to_ipoco(G.v2d, mval, &x1, &x2);
 	
-	if(seq->flag & SELECT) cpack(0xFFFFFF);
-	else cpack(0);
+	if(seq->flag & SELECT){
+		cpack(0xFFFFFF);
+	}else if ((((int)background_col[0] + (int)background_col[1] + (int)background_col[2]) / 3) < 50){
+		cpack(0x505050); /* use lighter text colour for dark background */
+	}else{
+		cpack(0);
+	}
 	glRasterPos3f(x1,  y1+SEQ_STRIP_OFSBOTTOM, 0.0);
 	BMF_DrawString(G.font, strp);
 }
@@ -740,7 +745,7 @@
 static void draw_seq_strip(Sequence *seq, ScrArea *sa, SpaceSeq *sseq, int outline_tint, float pixelx)
 {
 	float x1, x2, y1, y2;
-	char col[3], is_single_image;
+	char col[3], background_col[3], is_single_image;
 
 	/* we need to know if this is a single image/color or not for drawing */
 	is_single_image = (char)check_single_seq(seq);
@@ -755,13 +760,14 @@
 	
 	
 	/* get the correct color per strip type*/
-	get_seq_color3ubv(seq, col);
+	//get_seq_color3ubv(seq, col);
+	get_seq_color3ubv(seq, background_col);
 	
 	/* draw the main strip body */
 	if (is_single_image) /* single image */
-		draw_shadedstrip(seq, col, seq_tx_get_final_left(seq, 0), y1, seq_tx_get_final_right(seq, 0), y2);
+		draw_shadedstrip(seq, background_col, seq_tx_get_final_left(seq, 0), y1, seq_tx_get_final_right(seq, 0), y2);
 	else /* normal operation */
-		draw_shadedstrip(seq, col, x1, y1, x2, y2);
+		draw_shadedstrip(seq, background_col, x1, y1, x2, y2);
 	
 	/* draw additional info and controls */
 	if (seq->type == SEQ_RAM_SOUND)
@@ -814,7 +820,7 @@
 
 	/* nice text here would require changing the view matrix for texture text */
 	if( (x2-x1) / pixelx > 32) {
-		draw_seq_text(seq, x1, x2, y1, y2);
+		draw_seq_text(seq, x1, x2, y1, y2, background_col);
 	}
 }
 





More information about the Bf-blender-cvs mailing list