View2d: API Cleanup for view<->region conversion
authorCampbell Barton <ideasman42@gmail.com>
Mon, 21 Apr 2014 06:47:16 +0000 (16:47 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 21 Apr 2014 06:59:40 +0000 (16:59 +1000)
commit9ae0e585b0aab466c978ec1a55c824d902faa3b4
tree6a99d63651f1b66ffacac2582b5f03d58898ad99
parent6ee8670fca946d146332e80ceff29e459cd91ed5
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
35 files changed:
source/blender/editors/animation/anim_markers.c
source/blender/editors/animation/anim_ops.c
source/blender/editors/gpencil/gpencil_edit.c
source/blender/editors/gpencil/gpencil_paint.c
source/blender/editors/include/UI_view2d.h
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/view2d.c
source/blender/editors/interface/view2d_ops.c
source/blender/editors/mask/mask_draw.c
source/blender/editors/screen/area.c
source/blender/editors/sculpt_paint/paint_image_2d.c
source/blender/editors/space_action/action_select.c
source/blender/editors/space_clip/clip_draw.c
source/blender/editors/space_clip/clip_editor.c
source/blender/editors/space_clip/clip_graph_ops.c
source/blender/editors/space_clip/space_clip.c
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_graph/graph_select.c
source/blender/editors/space_image/image_draw.c
source/blender/editors/space_image/image_edit.c
source/blender/editors/space_info/info_report.c
source/blender/editors/space_nla/nla_select.c
source/blender/editors/space_node/node_select.c
source/blender/editors/space_outliner/outliner_edit.c
source/blender/editors/space_outliner/outliner_select.c
source/blender/editors/space_outliner/outliner_tools.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/space_sequencer/sequencer_select.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_snap.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/makesrna/intern/rna_screen.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_operators.c
source/blenderplayer/bad_level_call_stubs/stubs.c