[Bf-blender-cvs] [d2589b0a31b] blender2.8: Getting rid of setlinestyle: Text space margin line.
Bastien Montagne
noreply at git.blender.org
Sat Apr 29 13:20:15 CEST 2017
Commit: d2589b0a31bfbbc3dc9b5992de49ce571454341a
Author: Bastien Montagne
Date: Sat Apr 29 12:43:37 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBd2589b0a31bfbbc3dc9b5992de49ce571454341a
Getting rid of setlinestyle: Text space margin line.
===================================================================
M source/blender/editors/space_text/text_draw.c
===================================================================
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);
}
}
More information about the Bf-blender-cvs
mailing list