diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-04-29 13:43:37 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-04-29 13:43:37 +0300 |
commit | d2589b0a31bfbbc3dc9b5992de49ce571454341a (patch) | |
tree | 9f4cd797f9a467cc583e0383c5870cd2a81171a1 /source/blender/editors/space_text/text_draw.c | |
parent | 8f028ec8408c35c2029e6a0caeb7eb27dc8e53f3 (diff) |
Getting rid of setlinestyle: Text space margin line.
Diffstat (limited to 'source/blender/editors/space_text/text_draw.c')
-rw-r--r-- | source/blender/editors/space_text/text_draw.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 148f605f68c..c4e6dde2a64 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1501,18 +1501,34 @@ void draw_text_main(SpaceText *st, ARegion *ar) margin_column_x = x + st->cwidth * (st->margin_column - st->left); if (margin_column_x >= x) { - setlinestyle(1); - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + VertexFormat *format = immVertexFormat(); + uint shdr_dashed_pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + uint shdr_dashed_origin = VertexFormat_add_attrib(format, "line_origin", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); + + float viewport_size[4]; + glGetFloatv(GL_VIEWPORT, viewport_size); + immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); + + float color1[4]; + UI_GetThemeColor4fv(TH_GRID, color1); /* same color as line number background */ + immUniform4fv("color1", color1); + immUniform4f("color2", 0.0f, 0.0f, 0.0f, 0.0f); + immUniform1f("dash_width", 2.0f); + immUniform1f("dash_width_on", 1.0f); - /* same color as line number background */ - immUniformThemeColor(TH_GRID); immBegin(PRIM_LINES, 2); - immVertex2i(pos, margin_column_x, 0); - immVertex2i(pos, margin_column_x, ar->winy - 2); + immAttrib2i(shdr_dashed_origin, margin_column_x, 0); + immVertex2i(shdr_dashed_pos, margin_column_x, 0); + immVertex2i(shdr_dashed_pos, margin_column_x, ar->winy - 2); immEnd(); immUnbindProgram(); - setlinestyle(0); + + glDisable(GL_BLEND); } } |