From b3a4b61a3b55406d80867cfd41a363d27afed958 Mon Sep 17 00:00:00 2001 From: Mike Erwin Date: Fri, 3 Mar 2017 13:12:29 -0500 Subject: OpenGL: remove last uses of sdrawline & sdrawbox Part of T49043 --- source/blender/editors/space_image/image_draw.c | 12 ++++++---- .../blender/editors/space_outliner/outliner_draw.c | 27 +++++++++++----------- 2 files changed, 21 insertions(+), 18 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 03a45d1d935..07cf7489020 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -60,9 +60,10 @@ #include "BKE_image.h" #include "BKE_paint.h" -#include "BIF_gl.h" #include "BIF_glutil.h" +#include "GPU_immediate.h" + #include "BLF_api.h" #include "ED_gpencil.h" @@ -71,8 +72,6 @@ #include "ED_render.h" #include "ED_screen.h" -#include "GPU_shader.h" - #include "UI_interface.h" #include "UI_resources.h" #include "UI_view2d.h" @@ -353,8 +352,11 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d } /* draw outline */ - glColor3ub(128, 128, 128); - sdrawbox(color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax); + unsigned int pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + immUniformColor3ub(128, 128, 128); + imm_draw_line_box(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax); + immUnbindProgram(); dx += 1.75f * UI_UNIT_X; diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 816740b8769..e8d98d9f4db 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1837,25 +1837,26 @@ static void outliner_back(ARegion *ar) static void outliner_draw_restrictcols(ARegion *ar) { glLineWidth(1.0f); - UI_ThemeColorShadeAlpha(TH_BACK, -15, -200); + + unsigned int pos = add_attrib(immVertexFormat(), "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + immUniformThemeColorShadeAlpha(TH_BACK, -15, -200); + immBegin(PRIM_LINES, 6); /* view */ - sdrawline((int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), - (int)ar->v2d.cur.ymax, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), - (int)ar->v2d.cur.ymin); + immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)ar->v2d.cur.ymax); + immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)ar->v2d.cur.ymin); /* render */ - sdrawline((int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), - (int)ar->v2d.cur.ymax, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), - (int)ar->v2d.cur.ymin); + immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), (int)ar->v2d.cur.ymax); + immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), (int)ar->v2d.cur.ymin); /* render */ - sdrawline((int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), - (int)ar->v2d.cur.ymax, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), - (int)ar->v2d.cur.ymin); + immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), (int)ar->v2d.cur.ymax); + immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), (int)ar->v2d.cur.ymin); + + immEnd(); + immUnbindProgram(); } /* ****************************************************** */ -- cgit v1.2.3