Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2016-01-22 09:45:39 +0300
committerMike Erwin <significant.bit@gmail.com>2016-01-22 10:52:12 +0300
commit66d9efe765626887a911cd0415681bbd4b21c89c (patch)
tree56b7867b69757192966aadab66024b61ee948011 /source/blender
parentf2fdec3ab7e76fe42216b03b416e39ed81f5ff9c (diff)
OpenGL: draw box outlines with lines, not rectangles
2 reasons: - fewer state changes (PolygonMode) - glRect goes away in later GL versions
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/space_image/image_draw.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c20
2 files changed, 8 insertions, 16 deletions
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index d36ab5e10e2..74f663e9b34 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -338,9 +338,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d
/* draw outline */
glColor3ub(128, 128, 128);
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- glRecti(color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ sdrawbox(color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
dx += 1.75f * UI_UNIT_X;
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 6daf2d4a4ab..c66647e009e 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1144,19 +1144,16 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
glDisable(GL_BLEND);
}
- /* edge */
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-
setlinestyle(0);
UI_ThemeColor(TH_BACK);
- glRectf(x1i, y1i, x2i, y2i);
+ fdrawbox(x1i, y1i, x2i, y2i);
#ifdef VIEW3D_CAMERA_BORDER_HACK
if (view3d_camera_border_hack_test == true) {
glColor3ubv(view3d_camera_border_hack_col);
- glRectf(x1i + 1, y1i + 1, x2i - 1, y2i - 1);
+ fdrawbox(x1i + 1, y1i + 1, x2i - 1, y2i - 1);
view3d_camera_border_hack_test = false;
}
#endif
@@ -1166,11 +1163,11 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
/* outer line not to confuse with object selecton */
if (v3d->flag2 & V3D_LOCK_CAMERA) {
UI_ThemeColor(TH_REDALERT);
- glRectf(x1i - 1, y1i - 1, x2i + 1, y2i + 1);
+ fdrawbox(x1i - 1, y1i - 1, x2i + 1, y2i + 1);
}
UI_ThemeColor(TH_VIEW_OVERLAY);
- glRectf(x1i, y1i, x2i, y2i);
+ fdrawbox(x1i, y1i, x2i, y2i);
/* border */
if (scene->r.mode & R_BORDER) {
@@ -1182,7 +1179,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
y4 = y1i + 1 + roundf(scene->r.border.ymax * (y2 - y1));
cpack(0x4040FF);
- glRecti(x3, y3, x4, y4);
+ sdrawbox(x3, y3, x4, y4);
}
/* safety border */
@@ -1298,7 +1295,6 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
}
setlinestyle(0);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
/* camera name - draw in highlighted text color */
if (ca && (ca->flag & CAM_SHOWNAME)) {
@@ -3964,15 +3960,13 @@ static void view3d_main_region_draw_info(const bContext *C, Scene *scene,
drawviewborder(scene, ar, v3d);
}
else if (v3d->flag2 & V3D_RENDER_BORDER) {
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
setlinestyle(3);
cpack(0x4040FF);
- glRecti(v3d->render_border.xmin * ar->winx, v3d->render_border.ymin * ar->winy,
- v3d->render_border.xmax * ar->winx, v3d->render_border.ymax * ar->winy);
+ sdrawbox(v3d->render_border.xmin * ar->winx, v3d->render_border.ymin * ar->winy,
+ v3d->render_border.xmax * ar->winx, v3d->render_border.ymax * ar->winy);
setlinestyle(0);
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
if (v3d->flag2 & V3D_SHOW_GPENCIL) {