diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenlib/BLI_rect.h | 3 | ||||
-rw-r--r-- | source/blender/blenlib/intern/rct.c | 18 | ||||
-rw-r--r-- | source/blender/editors/interface/interface.c | 5 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 19 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 5 |
6 files changed, 24 insertions, 28 deletions
diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h index 55ab961cc53..d6579afcd0d 100644 --- a/source/blender/blenlib/BLI_rect.h +++ b/source/blender/blenlib/BLI_rect.h @@ -69,7 +69,8 @@ int BLI_rctf_isect(const struct rctf *src1, const struct rctf *src2, struct rct int BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest); void BLI_rctf_union(struct rctf *rctf1, const struct rctf *rctf2); void BLI_rcti_union(struct rcti *rcti1, const struct rcti *rcti2); -void BLI_rcti_rctf_copy(struct rcti *tar, const struct rctf *src); +void BLI_rcti_rctf_copy(struct rcti *dst, const struct rctf *src); +void BLI_rctf_rcti_copy(struct rctf *dst, const struct rcti *src); void print_rctf(const char *str, const struct rctf *rect); void print_rcti(const char *str, const struct rcti *rect); diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c index e22becddfd6..9c65c26c72b 100644 --- a/source/blender/blenlib/intern/rct.c +++ b/source/blender/blenlib/intern/rct.c @@ -363,12 +363,20 @@ int BLI_rcti_isect(const rcti *src1, const rcti *src2, rcti *dest) } } -void BLI_rcti_rctf_copy(rcti *tar, const rctf *src) +void BLI_rcti_rctf_copy(rcti *dst, const rctf *src) { - tar->xmin = floorf(src->xmin + 0.5f); - tar->xmax = floorf((src->xmax - src->xmin) + 0.5f); - tar->ymin = floorf(src->ymin + 0.5f); - tar->ymax = floorf((src->ymax - src->ymin) + 0.5f); + dst->xmin = floorf(src->xmin + 0.5f); + dst->xmax = dst->xmin + floorf((src->xmax - src->xmin) + 0.5f); + dst->ymin = floorf(src->ymin + 0.5f); + dst->ymax = dst->ymin + floorf((src->ymax - src->ymin) + 0.5f); +} + +void BLI_rctf_rcti_copy(rctf *dst, const rcti *src) +{ + dst->xmin = src->xmin; + dst->xmax = src->xmax; + dst->ymin = src->ymin; + dst->ymax = src->ymax; } void print_rctf(const char *str, const rctf *rect) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 7185946f4fe..e7eb1e3a698 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -137,10 +137,7 @@ void ui_block_to_window_rct(const ARegion *ar, uiBlock *block, rctf *graph, rcti ui_block_to_window_fl(ar, block, &tmpr.xmin, &tmpr.ymin); ui_block_to_window_fl(ar, block, &tmpr.xmax, &tmpr.ymax); - winr->xmin = tmpr.xmin; - winr->ymin = tmpr.ymin; - winr->xmax = tmpr.xmax; - winr->ymax = tmpr.ymax; + BLI_rcti_rctf_copy(winr, &tmpr); } void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y) /* for mouse cursor */ diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 55249e66521..5226b2ae9e3 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3347,9 +3347,8 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, float ui_mouse_scale_warp(data, mx, my, &mx_fl, &my_fl, shift); - rect.xmin = but->rect.xmin; rect.xmax = but->rect.xmax; - rect.ymin = but->rect.ymin; rect.ymax = but->rect.ymax; - + BLI_rcti_rctf_copy(&rect, &but->rect); + ui_get_but_vectorf(but, rgb); copy_v3_v3(hsv, ui_block_hsv_get(but->block)); rgb_to_hsv_compat_v(rgb, hsv); @@ -3856,8 +3855,7 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx int changed = 1; float /* dx, */ dy; /* UNUSED */ - /* rect.xmin = but->rect.xmin; rect.xmax = but->rect.xmax; */ - /* rect.ymin = but->rect.ymin; rect.ymax = but->rect.ymax; */ + /* BLI_rcti_rctf_copy(&rect, &but->rect); */ /* dx = mx - data->draglastx; */ /* UNUSED */ dy = my - data->draglasty; @@ -3940,8 +3938,7 @@ static int ui_numedit_but_WAVEFORM(uiBut *but, uiHandleButtonData *data, int mx, int changed = 1; float /* dx, */ dy /* , yfac=1.f */; /* UNUSED */ - /* rect.xmin = but->rect.xmin; rect.xmax = but->rect.xmax; */ - /* rect.ymin = but->rect.ymin; rect.ymax = but->rect.ymax; */ + /* BLI_rcti_rctf_copy(&rect, &but->rect); */ /* dx = mx - data->draglastx; */ /* UNUSED */ dy = my - data->draglasty; @@ -4024,8 +4021,7 @@ static int ui_numedit_but_VECTORSCOPE(uiBut *but, uiHandleButtonData *data, int int changed = 1; /* float dx, dy; */ - /* rect.xmin = but->rect.xmin; rect.xmax = but->rect.xmax; */ - /* rect.ymin = but->rect.ymin; rect.ymax = but->rect.ymax; */ + /* BLI_rcti_rctf_copy(&rect, &but->rect); */ /* dx = mx - data->draglastx; */ /* dy = my - data->draglasty; */ @@ -5019,10 +5015,7 @@ static int ui_mouse_inside_region(ARegion *ar, int x, int y) ui_window_to_region(ar, &mx, &my); /* make a copy of the mask rect, and tweak accordingly for hidden scrollbars */ - mask_rct.xmin = v2d->mask.xmin; - mask_rct.xmax = v2d->mask.xmax; - mask_rct.ymin = v2d->mask.ymin; - mask_rct.ymax = v2d->mask.ymax; + mask_rct = v2d->mask; if (v2d->scroll & (V2D_SCROLL_VERTICAL_HIDE | V2D_SCROLL_VERTICAL_FULLR)) { if (v2d->scroll & V2D_SCROLL_LEFT) diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 79aff82fe6f..501a5cf91b0 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -422,7 +422,7 @@ static void ui_draw_panel_scalewidget(rcti *rect) glDisable(GL_BLEND); } -static void ui_draw_panel_dragwidget(rctf *rect) +static void ui_draw_panel_dragwidget(const rctf *rect) { float xmin, xmax, dx; float ymin, ymax, dy; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 93d70004b18..fbbf23beca4 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1212,10 +1212,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b rect.ymax = input->ymin + 12; } else { - rect.xmin = input->xmin; - rect.xmax = input->xmax; - rect.ymin = input->ymin; - rect.ymax = input->ymax; + BLI_rctf_rcti_copy(&rect, input); } setwinmatrixview3d(ar, v3d, &rect); |