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:
authorCampbell Barton <ideasman42@gmail.com>2019-04-23 09:39:14 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-23 09:39:14 +0300
commit310f288bb03b4197f54b7d7b6d611669f2604d04 (patch)
tree32ca4cc795c68237566197f8410ca0833320291e /source/blender/editors/interface/interface.c
parent4d5e83f608d3cb7312383d4d90352a175594772e (diff)
UI: add ui_window_to_block_rctf, ui_window_to_region_rcti
Diffstat (limited to 'source/blender/editors/interface/interface.c')
-rw-r--r--source/blender/editors/interface/interface.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 3edf8e5135a..a5abbb2b86f 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -213,6 +213,16 @@ void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y
}
}
+void ui_window_to_block_rctf(const struct ARegion *ar,
+ uiBlock *block,
+ rctf *rct_dst,
+ const rctf *rct_src)
+{
+ *rct_dst = *rct_src;
+ ui_window_to_block_fl(ar, block, &rct_dst->xmin, &rct_dst->ymin);
+ ui_window_to_block_fl(ar, block, &rct_dst->xmax, &rct_dst->ymax);
+}
+
void ui_window_to_block(const ARegion *ar, uiBlock *block, int *x, int *y)
{
float fx, fy;
@@ -232,6 +242,14 @@ void ui_window_to_region(const ARegion *ar, int *x, int *y)
*y -= ar->winrct.ymin;
}
+void ui_window_to_region_rcti(const ARegion *ar, rcti *rect_dst, const rcti *rct_src)
+{
+ rect_dst->xmin = rct_src->xmin - ar->winrct.xmin;
+ rect_dst->xmax = rct_src->xmax - ar->winrct.xmin;
+ rect_dst->ymin = rct_src->ymin - ar->winrct.ymin;
+ rect_dst->ymax = rct_src->ymax - ar->winrct.ymin;
+}
+
void ui_region_to_window(const ARegion *ar, int *x, int *y)
{
*x += ar->winrct.xmin;