Merge branch 'master' into blender2.8
[blender.git] / source / blender / editors / space_console / console_draw.c
index 6ee658b..66b203f 100644 (file)
@@ -40,6 +40,7 @@
 #include "MEM_guardedalloc.h"
 
 #include "BIF_gl.h"
+#include "GPU_immediate.h"
 
 #include "UI_interface.h"
 #include "UI_resources.h"
@@ -157,6 +158,8 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha
                int offl = 0, offc = 0;
                int xy[2] = {CONSOLE_DRAW_MARGIN, CONSOLE_DRAW_MARGIN};
                int pen[2];
+               Gwn_VertFormat *format = immVertexFormat();
+               unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
                xy[1] += tvc->lheight / 6;
 
                console_cursor_wrap_offset(sc->prompt, tvc->console_width, &offl, &offc, NULL);
@@ -168,14 +171,17 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha
                pen[1] += tvc->lheight * offl;
 
                /* cursor */
-               UI_GetThemeColor3ubv(TH_CONSOLE_CURSOR, fg);
-               glColor3ubv(fg);
-
-               glRecti((xy[0] + pen[0]) - 1,
-                       (xy[1] + pen[1]),
-                       (xy[0] + pen[0]) + 1,
-                       (xy[1] + pen[1] + tvc->lheight)
-                       );
+               immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+               immUniformThemeColor(TH_CONSOLE_CURSOR);
+
+               immRectf(pos,
+                        (xy[0] + pen[0]) - 1,
+                        (xy[1] + pen[1]),
+                        (xy[0] + pen[0]) + 1,
+                        (xy[1] + pen[1] + tvc->lheight)
+                        );
+
+               immUnbindProgram();
        }
 
        console_line_color(fg, cl_iter->type);