diff options
author | Severin <eiseljulian@gmail.com> | 2018-06-29 22:22:27 +0300 |
---|---|---|
committer | Severin <eiseljulian@gmail.com> | 2018-06-29 22:29:06 +0300 |
commit | 48ad67ef8201f8fcd5efdf748c5fea86e2c61d7d (patch) | |
tree | 7ea1d3f862bc5ea54b4b7134be07ab416ea9df04 /source/blender/editors/screen/screen_draw.c | |
parent | ac2e10d47b38e944efab66781ed0a4f4d4c41588 (diff) |
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.
Diffstat (limited to 'source/blender/editors/screen/screen_draw.c')
-rw-r--r-- | source/blender/editors/screen/screen_draw.c | 8 |
1 files changed, 4 insertions, 4 deletions
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; |