From 48ad67ef8201f8fcd5efdf748c5fea86e2c61d7d Mon Sep 17 00:00:00 2001 From: Severin Date: Fri, 29 Jun 2018 21:22:27 +0200 Subject: Cleanup: Add/use function to get area width/height from area vertices This used to be rather cryptic and it was easy to forget the `+ 1` which in fact is needed to get the correct width/height, see e626998a262ebe4f. This should also fix some minor off-by-one errors. --- source/blender/editors/screen/screen_draw.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/screen/screen_draw.c') diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c index b81c1e489ea..0a693893310 100644 --- a/source/blender/editors/screen/screen_draw.c +++ b/source/blender/editors/screen/screen_draw.c @@ -44,11 +44,11 @@ */ static void draw_horizontal_join_shape(ScrArea *sa, char dir, unsigned int pos) { + const float width = area_geometry_width(sa) - 1; + const float height = area_geometry_height(sa) - 1; vec2f points[10]; short i; float w, h; - float width = sa->v3->vec.x - sa->v1->vec.x; - float height = sa->v3->vec.y - sa->v1->vec.y; if (height < width) { h = height / 8; @@ -125,11 +125,11 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir, unsigned int pos) */ static void draw_vertical_join_shape(ScrArea *sa, char dir, unsigned int pos) { + const float width = area_geometry_width(sa) - 1; + const float height = area_geometry_height(sa) - 1; vec2f points[10]; short i; float w, h; - float width = sa->v3->vec.x - sa->v1->vec.x; - float height = sa->v3->vec.y - sa->v1->vec.y; if (height < width) { h = height / 4; -- cgit v1.2.3