diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-30 07:16:14 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-30 07:51:49 +0300 |
commit | 8bdd4b468554446cb1351785f0db751e2f84341f (patch) | |
tree | d81bda8a17f036de212b2982d7b13093f5b35a9e /source/blender/editors/interface | |
parent | 1c1dc5f8440d918aca480904c53e31a528aef42f (diff) |
Cleanup: use function style casts for C++
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface.cc | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/view2d_ops.cc | 26 |
2 files changed, 14 insertions, 14 deletions
diff --git a/source/blender/editors/interface/interface.cc b/source/blender/editors/interface/interface.cc index 403cb0116d2..42b3198a9c0 100644 --- a/source/blender/editors/interface/interface.cc +++ b/source/blender/editors/interface/interface.cc @@ -5933,7 +5933,7 @@ bContextStore *UI_but_context_get(const uiBut *but) void UI_but_unit_type_set(uiBut *but, const int unit_type) { - but->unit_type = (uchar)(RNA_SUBTYPE_UNIT_VALUE(unit_type)); + but->unit_type = uchar(RNA_SUBTYPE_UNIT_VALUE(unit_type)); } int UI_but_unit_type_get(const uiBut *but) diff --git a/source/blender/editors/interface/view2d_ops.cc b/source/blender/editors/interface/view2d_ops.cc index 0282c1b1813..c72a0c75ee4 100644 --- a/source/blender/editors/interface/view2d_ops.cc +++ b/source/blender/editors/interface/view2d_ops.cc @@ -1628,7 +1628,7 @@ static int view2d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), const w float step; if (sms->time_allowed != 0.0) { - step = (float)((v2d->smooth_timer->duration) / sms->time_allowed); + step = float((v2d->smooth_timer->duration) / sms->time_allowed); } else { step = 1.0f; @@ -1859,11 +1859,11 @@ static void scroller_activate_init(bContext *C, if (in_scroller == 'h') { /* horizontal scroller - calculate adjustment factor first */ - const float mask_size = (float)BLI_rcti_size_x(&v2d->hor); + const float mask_size = float(BLI_rcti_size_x(&v2d->hor)); vsm->fac = BLI_rctf_size_x(&tot_cur_union) / mask_size; /* pixel rounding */ - vsm->fac_round = (BLI_rctf_size_x(&v2d->cur)) / (float)(BLI_rcti_size_x(®ion->winrct) + 1); + vsm->fac_round = (BLI_rctf_size_x(&v2d->cur)) / float(BLI_rcti_size_x(®ion->winrct) + 1); /* get 'zone' (i.e. which part of scroller is activated) */ vsm->zone = mouse_in_scroller_handle( @@ -1879,11 +1879,11 @@ static void scroller_activate_init(bContext *C, } else { /* vertical scroller - calculate adjustment factor first */ - const float mask_size = (float)BLI_rcti_size_y(&v2d->vert); + const float mask_size = float(BLI_rcti_size_y(&v2d->vert)); vsm->fac = BLI_rctf_size_y(&tot_cur_union) / mask_size; /* pixel rounding */ - vsm->fac_round = (BLI_rctf_size_y(&v2d->cur)) / (float)(BLI_rcti_size_y(®ion->winrct) + 1); + vsm->fac_round = (BLI_rctf_size_y(&v2d->cur)) / float(BLI_rcti_size_y(®ion->winrct) + 1); /* get 'zone' (i.e. which part of scroller is activated) */ vsm->zone = mouse_in_scroller_handle( @@ -2000,11 +2000,11 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e switch (vsm->scroller) { case 'h': /* horizontal scroller - so only horizontal movement * ('cur' moves opposite to mouse) */ - vsm->delta = (float)(event->xy[0] - vsm->lastx); + vsm->delta = float(event->xy[0] - vsm->lastx); break; case 'v': /* vertical scroller - so only vertical movement * ('cur' moves opposite to mouse) */ - vsm->delta = (float)(event->xy[1] - vsm->lasty); + vsm->delta = float(event->xy[1] - vsm->lasty); break; } } @@ -2013,11 +2013,11 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e switch (vsm->scroller) { case 'h': /* horizontal scroller - so only horizontal movement * ('cur' moves with mouse) */ - vsm->delta = (float)(vsm->lastx - event->xy[0]); + vsm->delta = float(vsm->lastx - event->xy[0]); break; case 'v': /* vertical scroller - so only vertical movement * ('cur' moves with to mouse) */ - vsm->delta = (float)(vsm->lasty - event->xy[1]); + vsm->delta = float(vsm->lasty - event->xy[1]); break; } } @@ -2080,11 +2080,11 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent * switch (vsm->scroller) { case 'h': /* horizontal scroller - so only horizontal movement * ('cur' moves opposite to mouse) */ - vsm->delta = (float)(event->xy[0] - vsm->scrollbar_orig); + vsm->delta = float(event->xy[0] - vsm->scrollbar_orig); break; case 'v': /* vertical scroller - so only vertical movement * ('cur' moves opposite to mouse) */ - vsm->delta = (float)(event->xy[1] - vsm->scrollbar_orig); + vsm->delta = float(event->xy[1] - vsm->scrollbar_orig); break; } scroller_activate_apply(C, op); @@ -2177,8 +2177,8 @@ static int reset_exec(bContext *C, wmOperator *UNUSED(op)) const int snap_test = ED_region_snap_size_test(region); /* zoom 1.0 */ - const int winx = (float)(BLI_rcti_size_x(&v2d->mask) + 1); - const int winy = (float)(BLI_rcti_size_y(&v2d->mask) + 1); + const int winx = float(BLI_rcti_size_x(&v2d->mask) + 1); + const int winy = float(BLI_rcti_size_y(&v2d->mask) + 1); v2d->cur.xmax = v2d->cur.xmin + winx; v2d->cur.ymax = v2d->cur.ymin + winy; |