[Bf-blender-cvs] [802ac0c] master: Fix FileSelector dividers disappearing

Campbell Barton noreply at git.blender.org
Wed Sep 3 08:20:30 CEST 2014


Commit: 802ac0cb8f7e910c5d2c0a26915bd7ec9722b6d4
Author: Campbell Barton
Date:   Wed Sep 3 16:18:31 2014 +1000
Branches: master
https://developer.blender.org/rB802ac0cb8f7e910c5d2c0a26915bd7ec9722b6d4

Fix FileSelector dividers disappearing

Was clamped to short

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

M	source/blender/editors/space_file/file_draw.c

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

diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index f0a84ef..3e099b4 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -416,11 +416,12 @@ static void draw_background(FileLayout *layout, View2D *v2d)
 	int i;
 	int sy;
 
+	UI_ThemeColorShade(TH_BACK, -7);
+
 	/* alternating flat shade background */
 	for (i = 0; (i <= layout->rows); i += 2) {
 		sy = (int)v2d->cur.ymax - i * (layout->tile_h + 2 * layout->tile_border_y) - layout->tile_border_y;
 
-		UI_ThemeColorShade(TH_BACK, -7);
 		glRectf(v2d->cur.xmin, (float)sy, v2d->cur.xmax, (float)(sy + layout->tile_h + 2 * layout->tile_border_y));
 		
 	}
@@ -428,18 +429,36 @@ static void draw_background(FileLayout *layout, View2D *v2d)
 
 static void draw_dividers(FileLayout *layout, View2D *v2d)
 {
+	const int step = (layout->tile_w + 2 * layout->tile_border_x);
+	int v1[2], v2[2];
 	int sx;
+	unsigned char col_hi[3], col_lo[3];
+
+	UI_GetThemeColorShade3ubv(TH_BACK,  30, col_hi);
+	UI_GetThemeColorShade3ubv(TH_BACK, -30, col_lo);
+
+	v1[1] = v2d->cur.ymax - layout->tile_border_y;
+	v2[1] = v2d->cur.ymin;
+
+	glBegin(GL_LINES);
 
 	/* vertical column dividers */
 	sx = (int)v2d->tot.xmin;
 	while (sx < v2d->cur.xmax) {
-		sx += (layout->tile_w + 2 * layout->tile_border_x);
-		
-		UI_ThemeColorShade(TH_BACK, 30);
-		sdrawline(sx + 1, (short)(v2d->cur.ymax - layout->tile_border_y),  sx + 1,  (short)v2d->cur.ymin);
-		UI_ThemeColorShade(TH_BACK, -30);
-		sdrawline(sx, (short)(v2d->cur.ymax - layout->tile_border_y),  sx,  (short)v2d->cur.ymin); 
+		sx += step;
+
+		glColor3ubv(col_lo);
+		v1[0] = v2[0] = sx;
+		glVertex2iv(v1);
+		glVertex2iv(v2);
+
+		glColor3ubv(col_hi);
+		v1[0] = v2[0] = sx + 1;
+		glVertex2iv(v1);
+		glVertex2iv(v2);
 	}
+
+	glEnd();
 }
 
 void file_draw_list(const bContext *C, ARegion *ar)




More information about the Bf-blender-cvs mailing list