diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-04-26 13:26:30 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-04-26 13:26:30 +0300 |
commit | ec442224df837f1005082ef2e892b3c221c0eb9a (patch) | |
tree | 9010ddf48add43bf99f2ceab5e8c277f6b327e49 /source/blender/editors/space_sequencer/sequencer_draw.c | |
parent | 8de3778d11bf60dcee7bd38de0f5f648f2be7333 (diff) |
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
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_draw.c')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_draw.c | 37 |
1 files changed, 27 insertions, 10 deletions
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 */ |