[Bf-blender-cvs] [ec442224df8] blender2.8: Getting rid of setlinestyle: Squencer space.

Bastien Montagne noreply at git.blender.org
Wed Apr 26 12:31:36 CEST 2017


Commit: ec442224df837f1005082ef2e892b3c221c0eb9a
Author: Bastien Montagne
Date:   Wed Apr 26 12:26:30 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBec442224df837f1005082ef2e892b3c221c0eb9a

Getting rid of setlinestyle: Squencer space.

Not much to add here, except that it needs the scale of its MVP matrix
to be taken into account here...

Reviewers: merwin, dfelinto

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

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

M	source/blender/editors/space_sequencer/sequencer_draw.c

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

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 8be340140bf..0dcfe2d2076 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1033,35 +1033,52 @@ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, cons
 	glLineWidth(1.0f);
 
 	/* border */
-	setlinestyle(3);
+	float mvp[4][4];
+	gpuGetModelViewProjectionMatrix(mvp);
+	const float view_scale = mat4_to_xy_scale(mvp) * (U.pixelsize * 72.0f);
 
-	unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+	VertexFormat *format = immVertexFormat();
+	unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+	unsigned int line_origin = VertexFormat_add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT);
+	float color1[4];
 
-	immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
-	immUniformThemeColor(TH_BACK);
+	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+	glEnable(GL_BLEND);
+
+	immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR);
 
-	imm_draw_line_box(pos, x1 - 0.5f, y1 - 0.5f, x2 + 0.5f, y2 + 0.5f);
+	immUniform1f("view_scale", view_scale);
+
+	UI_GetThemeColor4fv(TH_BACK, color1);
+	immUniform4fv("color1", color1);
+	immUniform4f("color2", 0.0f, 0.0f, 0.0f, 0.0f);
+	immUniform1f("dash_width", 1.0f);
+	immUniform1f("dash_width_on", 0.5f);
+
+	imm_draw_line_box_dashed(pos, line_origin, x1 - 0.5f, y1 - 0.5f, x2 + 0.5f, y2 + 0.5f);
 
 	/* safety border */
 	if (sseq->flag & SEQ_SHOW_SAFE_MARGINS) {
-#if 0 /* Disabled just for this commit, will be fixed in next one. */
+		UI_GetThemeColorBlend3f(TH_VIEW_OVERLAY, TH_BACK, 0.25f, color1);
+		color1[3] = 1.0f;
+		immUniform4fv("color1", color1);
+
 		UI_draw_safe_areas(
-		        pos, x1, x2, y1, y2,
+		        pos, line_origin, x1, x2, y1, y2,
 		        scene->safe_areas.title,
 		        scene->safe_areas.action);
 
 		if (sseq->flag & SEQ_SHOW_SAFE_CENTER) {
 			UI_draw_safe_areas(
-			        pos, x1, x2, y1, y2,
+			        pos, line_origin, x1, x2, y1, y2,
 			        scene->safe_areas.title_center,
 			        scene->safe_areas.action_center);
 		}
-#endif
 	}
 
 	immUnbindProgram();
 
-	setlinestyle(0);
+	glDisable(GL_BLEND);
 }
 
 /* draws checkerboard background for transparent content */




More information about the Bf-blender-cvs mailing list