Cleanup: use function style casts

This commit is contained in:
Campbell Barton
2023-03-23 14:29:46 +11:00
parent d7de8bcf0d
commit 684570ce57
4 changed files with 21 additions and 19 deletions

View File

@@ -656,14 +656,14 @@ static void timeline_cache_draw_cached_segments(PointCache *cache, uint pos_id)
static void timeline_cache_draw_single(PTCacheID *pid, float y_offset, float height, uint pos_id)
{
GPU_matrix_push();
GPU_matrix_translate_2f(0.0, (float)V2D_SCROLL_HANDLE_HEIGHT + y_offset);
GPU_matrix_translate_2f(0.0, float(V2D_SCROLL_HANDLE_HEIGHT) + y_offset);
GPU_matrix_scale_2f(1.0, height);
float color[4];
timeline_cache_color_get(pid, color);
immUniformColor4fv(color);
immRectf(pos_id, (float)pid->cache->startframe, 0.0, (float)pid->cache->endframe, 1.0);
immRectf(pos_id, float(pid->cache->startframe), 0.0, float(pid->cache->endframe), 1.0);
color[3] = 0.4f;
timeline_cache_modify_color_based_on_state(pid->cache, color);

View File

@@ -178,7 +178,7 @@ static bool get_keyframe_extents(bAnimContext *ac, float *min, float *max, const
/* Find gp-frame which is less than or equal to current-frame. */
for (gpf = static_cast<bGPDframe *>(gpl->frames.first); gpf; gpf = gpf->next) {
if (!onlySel || (gpf->flag & GP_FRAME_SELECT)) {
const float framenum = (float)gpf->framenum;
const float framenum = float(gpf->framenum);
*min = min_ff(*min, framenum);
*max = max_ff(*max, framenum);
found = true;
@@ -193,7 +193,7 @@ static bool get_keyframe_extents(bAnimContext *ac, float *min, float *max, const
for (masklay_shape = static_cast<MaskLayerShape *>(masklay->splines_shapes.first);
masklay_shape;
masklay_shape = masklay_shape->next) {
const float framenum = (float)masklay_shape->frame;
const float framenum = float(masklay_shape->frame);
*min = min_ff(*min, framenum);
*max = max_ff(*max, framenum);
found = true;
@@ -231,8 +231,8 @@ static bool get_keyframe_extents(bAnimContext *ac, float *min, float *max, const
else {
/* set default range */
if (ac->scene) {
*min = (float)ac->scene->r.sfra;
*max = (float)ac->scene->r.efra;
*min = float(ac->scene->r.sfra);
*max = float(ac->scene->r.efra);
}
else {
*min = -5;
@@ -397,7 +397,7 @@ static int actkeys_viewall(bContext *C, const bool only_sel)
/* view all -> the summary channel is usually the shows everything,
* and resides right at the top... */
v2d->cur.ymax = 0.0f;
v2d->cur.ymin = (float)-BLI_rcti_size_y(&v2d->mask);
v2d->cur.ymin = float(-BLI_rcti_size_y(&v2d->mask));
}
else {
/* locate first selected channel (or the active one), and frame those */
@@ -850,7 +850,7 @@ static void insert_action_keys(bAnimContext *ac, short mode)
/* insert keyframes */
const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct(
ac->depsgraph, (float)scene->r.cfra);
ac->depsgraph, float(scene->r.cfra));
for (ale = static_cast<bAnimListElem *>(anim_data.first); ale; ale = ale->next) {
switch (ale->type) {
case ANIMTYPE_GPLAYER:
@@ -1962,7 +1962,7 @@ static void mirror_action_keys(bAnimContext *ac, short mode)
TimeMarker *marker = ED_markers_get_first_selected(ac->markers);
if (marker) {
ked.f1 = (float)marker->frame;
ked.f1 = float(marker->frame);
}
else {
return;

View File

@@ -163,8 +163,10 @@ static void actkeys_find_key_in_list_element(bAnimContext *ac,
/* half-size (for either side), but rounded up to nearest int (for easier targeting) */
key_hsize = roundf(key_hsize / 2.0f);
const Range2f range = {UI_view2d_region_to_view_x(v2d, region_x - (int)key_hsize),
UI_view2d_region_to_view_x(v2d, region_x + (int)key_hsize)};
const Range2f range = {
UI_view2d_region_to_view_x(v2d, region_x - int(key_hsize)),
UI_view2d_region_to_view_x(v2d, region_x + int(key_hsize)),
};
const ActKeyColumn *ak = ED_keylist_find_any_between(keylist, range);
if (ak) {
@@ -1075,7 +1077,7 @@ static void columnselect_action_keys(bAnimContext *ac, short mode)
ce = MEM_cnew<CfraElem>("cfraElem");
BLI_addtail(&ked.list, ce);
ce->cfra = (float)scene->r.cfra;
ce->cfra = float(scene->r.cfra);
break;
case ACTKEYS_COLUMNSEL_MARKERS_COLUMN: /* list of selected markers */
@@ -1416,10 +1418,10 @@ static void actkeys_select_leftright(bAnimContext *ac, short leftright, short se
if (leftright == ACTKEYS_LRSEL_LEFT) {
ked.f1 = MINAFRAMEF;
ked.f2 = (float)(scene->r.cfra + 0.1f);
ked.f2 = float(scene->r.cfra + 0.1f);
}
else {
ked.f1 = (float)(scene->r.cfra - 0.1f);
ked.f1 = float(scene->r.cfra - 0.1f);
ked.f2 = MAXFRAMEF;
}

View File

@@ -101,9 +101,9 @@ static SpaceLink *action_create(const ScrArea *area, const Scene *scene)
BLI_addtail(&saction->regionbase, region);
region->regiontype = RGN_TYPE_WINDOW;
region->v2d.tot.xmin = (float)(scene->r.sfra - 10);
region->v2d.tot.ymin = (float)(-area->winy) / 3.0f;
region->v2d.tot.xmax = (float)(scene->r.efra + 10);
region->v2d.tot.xmin = float(scene->r.sfra - 10);
region->v2d.tot.ymin = float(-area->winy) / 3.0f;
region->v2d.tot.xmax = float(scene->r.efra + 10);
region->v2d.tot.ymax = 0.0f;
region->v2d.cur = region->v2d.tot;
@@ -577,8 +577,8 @@ static void action_listener(const wmSpaceTypeListenerParams *params)
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
if (region->regiontype == RGN_TYPE_WINDOW) {
Scene *scene = static_cast<Scene *>(wmn->reference);
region->v2d.tot.xmin = (float)(scene->r.sfra - 4);
region->v2d.tot.xmax = (float)(scene->r.efra + 4);
region->v2d.tot.xmin = float(scene->r.sfra - 4);
region->v2d.tot.xmax = float(scene->r.efra + 4);
break;
}
}