From 9ae0e585b0aab466c978ec1a55c824d902faa3b4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 21 Apr 2014 16:47:16 +1000 Subject: View2d: API Cleanup for view<->region conversion View2D had some inconsistencies making it error prone in some cases. - Inconstant checking for NULL x/y args. Disallow NULL args for x/y destination pointers, instead add: - UI_view2d_region_to_view_x/y - UI_view2d_view_to_region_x/y - '_no_clip' suffix wasn't always used for non-clipping conversion, switch it around and use a '_clip' suffix for all funcs that clip. - UI_view2d_text_cache_add now clips before adding cache. - '_clip' funcs return a bool to quickly check if its in the view. - add conversion for rectangles, since this is a common task: - UI_view2d_view_to_region_rcti - UI_view2d_region_to_view_rctf --- source/blender/editors/screen/area.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/screen/area.c') diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 30f7c637868..468c3a0524b 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1925,8 +1925,8 @@ void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy) /* the image is located inside (0, 0), (1, 1) as set by view2d */ UI_ThemeColorShade(TH_BACK, 20); - UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x1, &y1); - UI_view2d_to_region_no_clip(&ar->v2d, 1.0f, 1.0f, &x2, &y2); + UI_view2d_view_to_region(&ar->v2d, 0.0f, 0.0f, &x1, &y1); + UI_view2d_view_to_region(&ar->v2d, 1.0f, 1.0f, &x2, &y2); glRectf(x1, y1, x2, y2); /* gridsize adapted to zoom level */ -- cgit v1.2.3