diff --git a/source/blender/blenkernel/intern/tracking.cc b/source/blender/blenkernel/intern/tracking.cc index 742e34d5243..e23eed89709 100644 --- a/source/blender/blenkernel/intern/tracking.cc +++ b/source/blender/blenkernel/intern/tracking.cc @@ -382,11 +382,11 @@ void BKE_tracking_get_projection_matrix(MovieTracking *tracking, float mat[4][4]) { MovieReconstructedCamera *camera; - float lens = tracking->camera.focal * tracking->camera.sensor_width / (float)winx; + float lens = tracking->camera.focal * tracking->camera.sensor_width / float(winx); float viewfac, pixsize, left, right, bottom, top, clipsta, clipend; float winmat[4][4]; float ycor = 1.0f / tracking->camera.pixel_aspect; - float shiftx, shifty, winside = (float)min_ii(winx, winy); + float shiftx, shifty, winside = float(min_ii(winx, winy)); BKE_tracking_camera_shift_get(tracking, winx, winy, &shiftx, &shifty); @@ -402,10 +402,10 @@ void BKE_tracking_get_projection_matrix(MovieTracking *tracking, pixsize = clipsta / viewfac; - left = -0.5f * (float)winx + shiftx * winside; - bottom = -0.5f * (ycor) * (float)winy + shifty * winside; - right = 0.5f * (float)winx + shiftx * winside; - top = 0.5f * (ycor) * (float)winy + shifty * winside; + left = -0.5f * float(winx) + shiftx * winside; + bottom = -0.5f * (ycor) * float(winy) + shifty * winside; + right = 0.5f * float(winx) + shiftx * winside; + top = 0.5f * (ycor) * float(winy) + shifty * winside; left *= pixsize; right *= pixsize; @@ -976,7 +976,7 @@ static void tracking_average_markers(MovieTrackingTrack *dst_track, if (!counters[frame_index]) { continue; } - const float multiplier = 1.0f / (float)counters[frame_index]; + const float multiplier = 1.0f / float(counters[frame_index]); multiply_marker(&accumulator[frame_index], multiplier); /* Store the result. */ BKE_tracking_marker_insert(dst_track, &accumulator[frame_index]); @@ -1081,8 +1081,8 @@ typedef struct TrackMaskSetPixelData { static void track_mask_set_pixel_cb(int x, int x_end, int y, void *user_data) { TrackMaskSetPixelData *data = (TrackMaskSetPixelData *)user_data; - size_t index = (size_t)y * data->mask_width + x; - size_t index_end = (size_t)y * data->mask_width + x_end; + size_t index = size_t(y) * data->mask_width + x; + size_t index_end = size_t(y) * data->mask_width + x_end; do { data->mask[index] = 1.0f; } while (++index != index_end); @@ -1466,7 +1466,7 @@ bool BKE_tracking_marker_get_interpolated(struct MovieTrackingTrack *track, return true; } - const float factor = (float)(framenr - left_marker->framenr) / + const float factor = float(framenr - left_marker->framenr) / (right_marker->framenr - left_marker->framenr); interp_v2_v2v2(r_marker->pos, left_marker->pos, right_marker->pos, factor); @@ -1510,7 +1510,7 @@ void BKE_tracking_marker_get_subframe_position(MovieTrackingTrack *track, float framenr, float pos[2]) { - MovieTrackingMarker *marker = BKE_tracking_marker_get(track, (int)framenr); + MovieTrackingMarker *marker = BKE_tracking_marker_get(track, int(framenr)); MovieTrackingMarker *marker_last = track->markers + (track->markersnr - 1); if (marker != marker_last) { @@ -1522,7 +1522,7 @@ void BKE_tracking_marker_get_subframe_position(MovieTrackingTrack *track, * tracked segments */ - float fac = (framenr - (int)framenr) / (marker_next->framenr - marker->framenr); + float fac = (framenr - int(framenr)) / (marker_next->framenr - marker->framenr); interp_v2_v2v2(pos, marker->pos, marker_next->pos, fac); } @@ -1872,12 +1872,12 @@ void BKE_tracking_plane_marker_get_subframe_corners(MovieTrackingPlaneTrack *pla float framenr, float corners[4][2]) { - MovieTrackingPlaneMarker *marker = BKE_tracking_plane_marker_get(plane_track, (int)framenr); + MovieTrackingPlaneMarker *marker = BKE_tracking_plane_marker_get(plane_track, int(framenr)); MovieTrackingPlaneMarker *marker_last = plane_track->markers + (plane_track->markersnr - 1); if (marker != marker_last) { MovieTrackingPlaneMarker *marker_next = marker + 1; if (marker_next->framenr == marker->framenr + 1) { - float fac = (framenr - (int)framenr) / (marker_next->framenr - marker->framenr); + float fac = (framenr - int(framenr)) / (marker_next->framenr - marker->framenr); for (int i = 0; i < 4; i++) { interp_v2_v2v2(corners[i], marker->corners[i], marker_next->corners[i], fac); } @@ -2156,7 +2156,7 @@ void BKE_tracking_camera_get_reconstructed_interpolate(MovieTracking * /*trackin MovieTrackingReconstruction *reconstruction = &tracking_object->reconstruction; MovieReconstructedCamera *cameras = reconstruction->cameras; - int a = reconstructed_camera_index_get(reconstruction, (int)framenr, true); + int a = reconstructed_camera_index_get(reconstruction, int(framenr), true); if (a == -1) { unit_m4(mat); @@ -2164,7 +2164,7 @@ void BKE_tracking_camera_get_reconstructed_interpolate(MovieTracking * /*trackin } if (cameras[a].framenr != framenr && a < reconstruction->camnr - 1) { - float t = ((float)framenr - cameras[a].framenr) / + float t = (float(framenr) - cameras[a].framenr) / (cameras[a + 1].framenr - cameras[a].framenr); blend_m4_m4m4(mat, cameras[a].mat, cameras[a + 1].mat, t); } @@ -2354,8 +2354,8 @@ void BKE_tracking_distortion_undistort_v2(MovieDistortion *distortion, libmv_cameraIntrinsicsInvert(distortion->intrinsics, x, y, &x, &y); const float aspy = 1.0f / distortion->pixel_aspect; - r_co[0] = (float)x * distortion->focal + distortion->principal_px[0]; - r_co[1] = (float)y * distortion->focal + distortion->principal_px[1] * aspy; + r_co[0] = float(x) * distortion->focal + distortion->principal_px[0]; + r_co[1] = float(y) * distortion->focal + distortion->principal_px[1] * aspy; } void BKE_tracking_distortion_free(MovieDistortion *distortion) @@ -2411,8 +2411,8 @@ void BKE_tracking_undistort_v2( tracking_principal_point_normalized_to_pixel( tracking->camera.principal_point, image_width, image_height, principal_px); - r_co[0] = (float)x * camera->focal + principal_px[0]; - r_co[1] = (float)y * camera->focal + principal_px[1] * aspy; + r_co[0] = float(x) * camera->focal + principal_px[0]; + r_co[1] = float(y) * camera->focal + principal_px[1] * aspy; } ImBuf *BKE_tracking_undistort_frame(MovieTracking *tracking, @@ -2590,10 +2590,10 @@ ImBuf *BKE_tracking_sample_pattern(const int frame_width, */ if (from_anchor) { for (int a = 0; a < 5; a++) { - src_pixel_x[a] += (double)((track->offset[0] * frame_width) - - (int)(track->offset[0] * frame_width)); - src_pixel_y[a] += (double)((track->offset[1] * frame_height) - - (int)(track->offset[1] * frame_height)); + src_pixel_x[a] += double((track->offset[0] * frame_width) - + int(track->offset[0] * frame_width)); + src_pixel_y[a] += double((track->offset[1] * frame_height) - + int(track->offset[1] * frame_height)); /* when offset is negative, rounding happens in opposite direction */ if (track->offset[0] < 0.0f) { diff --git a/source/blender/blenkernel/intern/tracking_plane_tracker.cc b/source/blender/blenkernel/intern/tracking_plane_tracker.cc index 85afc22f649..abc37fbe5f6 100644 --- a/source/blender/blenkernel/intern/tracking_plane_tracker.cc +++ b/source/blender/blenkernel/intern/tracking_plane_tracker.cc @@ -131,8 +131,8 @@ static void track_plane_from_existing_motion(MovieTrackingPlaneTrack *plane_trac if (!retrack && keyframe_plane_marker && next_plane_marker && (plane_track->flag & PLANE_TRACK_AUTOKEY)) { - float fac = ((float)next_plane_marker->framenr - start_plane_marker->framenr) / - ((float)keyframe_plane_marker->framenr - start_plane_marker->framenr); + float fac = (float(next_plane_marker->framenr) - start_plane_marker->framenr) / + (float(keyframe_plane_marker->framenr) - start_plane_marker->framenr); fac = 3 * fac * fac - 2 * fac * fac * fac; diff --git a/source/blender/blenkernel/intern/tracking_stabilize.cc b/source/blender/blenkernel/intern/tracking_stabilize.cc index 621674d4d22..10325e64992 100644 --- a/source/blender/blenkernel/intern/tracking_stabilize.cc +++ b/source/blender/blenkernel/intern/tracking_stabilize.cc @@ -700,7 +700,7 @@ static bool interpolate_averaged_track_contributions(StabContext *ctx, BLI_assert(frame_a <= framenr); BLI_assert(framenr <= frame_b); - t = ((float)framenr - frame_a) / (frame_b - frame_a); + t = (float(framenr) - frame_a) / (frame_b - frame_a); s = 1.0f - t; success = average_track_contributions( @@ -1038,10 +1038,10 @@ static void stabilization_calculate_data(StabContext *ctx, } /* Convert from relative to absolute coordinates, square pixels. */ - r_translation[0] *= (float)size * aspect; - r_translation[1] *= (float)size; - r_pivot[0] *= (float)size * aspect; - r_pivot[1] *= (float)size; + r_translation[0] *= float(size) * aspect; + r_translation[1] *= float(size); + r_pivot[0] *= float(size) * aspect; + r_pivot[1] *= float(size); /* Output measured data, or inverse of the measured values for * compensation? @@ -1258,7 +1258,7 @@ void BKE_tracking_stabilization_data_get(MovieClip *clip, bool do_compensate = true; float scale_step = 0.0f; float pixel_aspect = tracking->camera.pixel_aspect; - float aspect = (float)width * pixel_aspect / height; + float aspect = float(width) * pixel_aspect / height; int size = height; float pivot[2]; diff --git a/source/blender/blenkernel/intern/tracking_util.cc b/source/blender/blenkernel/intern/tracking_util.cc index e420744b317..86981614f2b 100644 --- a/source/blender/blenkernel/intern/tracking_util.cc +++ b/source/blender/blenkernel/intern/tracking_util.cc @@ -236,8 +236,8 @@ void tracking_get_search_origin_frame_pixel(int frame_width, /* Get the lower left coordinate of the search window and snap to pixel coordinates */ marker_unified_to_frame_pixel_coordinates( frame_width, frame_height, marker, marker->search_min, frame_pixel); - frame_pixel[0] = (int)frame_pixel[0]; - frame_pixel[1] = (int)frame_pixel[1]; + frame_pixel[0] = int(frame_pixel[0]); + frame_pixel[1] = int(frame_pixel[1]); } static void pixel_to_unified(int frame_width, @@ -349,8 +349,8 @@ void tracking_principal_point_normalized_to_pixel(const float principal_point_no const int frame_height, float r_principal_point_pixel[2]) { - const float frame_center_x = ((float)frame_width) / 2; - const float frame_center_y = ((float)frame_height) / 2; + const float frame_center_x = (float(frame_width)) / 2; + const float frame_center_y = (float(frame_height)) / 2; r_principal_point_pixel[0] = frame_center_x + principal_point_normalized[0] * frame_center_x; r_principal_point_pixel[1] = frame_center_y + principal_point_normalized[1] * frame_center_y; @@ -361,8 +361,8 @@ void tracking_principal_point_pixel_to_normalized(const float principal_point_pi const int frame_height, float r_principal_point_normalized[2]) { - const float frame_center_x = ((float)frame_width) / 2; - const float frame_center_y = ((float)frame_height) / 2; + const float frame_center_x = (float(frame_width)) / 2; + const float frame_center_y = (float(frame_height)) / 2; r_principal_point_normalized[0] = (principal_point_pixel[0] - frame_center_x) / frame_center_x; r_principal_point_normalized[1] = (principal_point_pixel[1] - frame_center_y) / frame_center_y; @@ -503,7 +503,7 @@ void tracking_cameraIntrinscisOptionsFromTracking( distortion_model_parameters_from_tracking(camera, camera_intrinsics_options); camera_intrinsics_options->image_width = calibration_width; - camera_intrinsics_options->image_height = (int)(calibration_height * aspy); + camera_intrinsics_options->image_height = int(calibration_height * aspy); } void tracking_trackingCameraFromIntrinscisOptions( @@ -623,7 +623,7 @@ static ImBuf *make_grayscale_ibuf_copy(ImBuf *ibuf) * * Will generalize it later. */ - const size_t num_pixels = (size_t)grayscale->x * (size_t)grayscale->y; + const size_t num_pixels = size_t(grayscale->x) * size_t(grayscale->y); grayscale->channels = 1; if ((grayscale->rect_float = MEM_cnew_array(num_pixels, "tracking grayscale image")) != nullptr) { @@ -652,7 +652,7 @@ static void ibuf_to_float_image(const ImBuf *ibuf, libmv_FloatImage *float_image static ImBuf *float_image_to_ibuf(libmv_FloatImage *float_image) { ImBuf *ibuf = IMB_allocImBuf(float_image->width, float_image->height, 32, 0); - size_t num_total_channels = (size_t)ibuf->x * (size_t)ibuf->y * float_image->channels; + size_t num_total_channels = size_t(ibuf->x) * size_t(ibuf->y) * float_image->channels; ibuf->channels = float_image->channels; if ((ibuf->rect_float = MEM_cnew_array(num_total_channels, "tracking grayscale image")) != nullptr) { @@ -688,10 +688,10 @@ static ImBuf *accessor_get_ibuf(TrackingImageAccessor *accessor, * return the requested region size, but only fill it's partially with * the data we can. */ - int clamped_origin_x = max_ii((int)region->min[0], 0), - clamped_origin_y = max_ii((int)region->min[1], 0); - int dst_offset_x = clamped_origin_x - (int)region->min[0], - dst_offset_y = clamped_origin_y - (int)region->min[1]; + int clamped_origin_x = max_ii(int(region->min[0]), 0), + clamped_origin_y = max_ii(int(region->min[1]), 0); + int dst_offset_x = clamped_origin_x - int(region->min[0]), + dst_offset_y = clamped_origin_y - int(region->min[1]); int clamped_width = width - dst_offset_x, clamped_height = height - dst_offset_y; clamped_width = min_ii(clamped_width, orig_ibuf->x - clamped_origin_x); clamped_height = min_ii(clamped_height, orig_ibuf->y - clamped_origin_y); diff --git a/source/blender/draw/engines/eevee/eevee_shaders.cc b/source/blender/draw/engines/eevee/eevee_shaders.cc index b76af0ab592..1cbcbd38337 100644 --- a/source/blender/draw/engines/eevee/eevee_shaders.cc +++ b/source/blender/draw/engines/eevee/eevee_shaders.cc @@ -662,7 +662,7 @@ struct GPUShader *EEVEE_shaders_effect_reflection_resolve_sh_get(void) struct GPUShader *EEVEE_shaders_effect_reflection_resolve_probe_sh_get(void) { - if (e_data.reflection_resolve_probe == NULL) { + if (e_data.reflection_resolve_probe == nullptr) { e_data.reflection_resolve_probe = DRW_shader_create_from_info_name( "eevee_legacy_effect_reflection_resolve_probe"); } @@ -671,7 +671,7 @@ struct GPUShader *EEVEE_shaders_effect_reflection_resolve_probe_sh_get(void) struct GPUShader *EEVEE_shaders_effect_reflection_resolve_refl_sh_get(void) { - if (e_data.reflection_resolve_raytrace == NULL) { + if (e_data.reflection_resolve_raytrace == nullptr) { e_data.reflection_resolve_raytrace = DRW_shader_create_from_info_name( "eevee_legacy_effect_reflection_resolve_ssr"); } diff --git a/source/blender/editors/space_clip/clip_buttons.cc b/source/blender/editors/space_clip/clip_buttons.cc index ba33f043e49..af1a4f3ab1b 100644 --- a/source/blender/editors/space_clip/clip_buttons.cc +++ b/source/blender/editors/space_clip/clip_buttons.cc @@ -201,7 +201,7 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname) 0, 0, UI_UNIT_X * 10, - (short)(UI_UNIT_Y * 0.8f), + short(UI_UNIT_Y * 0.8f), &scopes->track_preview_height, UI_UNIT_Y, UI_UNIT_Y * 20.0f, @@ -828,7 +828,7 @@ void uiTemplateMovieclipInformation(uiLayout *layout, float frs_sec_base; if (IMB_anim_get_fps(clip->anim, &frs_sec, &frs_sec_base, true)) { ofs += BLI_snprintf_rlen( - str + ofs, sizeof(str) - ofs, TIP_(", %.2f fps"), (float)frs_sec / frs_sec_base); + str + ofs, sizeof(str) - ofs, TIP_(", %.2f fps"), float(frs_sec) / frs_sec_base); } } } diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.cc b/source/blender/editors/space_clip/clip_dopesheet_draw.cc index 6df51739013..87dd61ce1e1 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_draw.cc +++ b/source/blender/editors/space_clip/clip_dopesheet_draw.cc @@ -114,9 +114,9 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *region, Scene *scene) /* don't use totrect set, as the width stays the same * (NOTE: this is ok here, the configuration is pretty straightforward) */ - v2d->tot.ymin = (float)(-height); + v2d->tot.ymin = float(-height); - float y = (float)CHANNEL_FIRST; + float y = float(CHANNEL_FIRST); /* setup colors for regular and selected strips */ UI_GetThemeColor3fv(TH_STRIP, strip); @@ -130,8 +130,8 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *region, Scene *scene) clip_draw_dopesheet_background(region, clip, pos_id); LISTBASE_FOREACH (MovieTrackingDopesheetChannel *, channel, &dopesheet->channels) { - float yminc = (float)(y - CHANNEL_HEIGHT_HALF); - float ymaxc = (float)(y + CHANNEL_HEIGHT_HALF); + float yminc = float(y - CHANNEL_HEIGHT_HALF); + float ymaxc = float(y + CHANNEL_HEIGHT_HALF); /* check if visible */ if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || @@ -150,9 +150,9 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *region, Scene *scene) immRectf(pos_id, v2d->cur.xmin, - (float)y - CHANNEL_HEIGHT_HALF, + float(y) - CHANNEL_HEIGHT_HALF, v2d->cur.xmax + EXTRA_SCROLL_PAD, - (float)y + CHANNEL_HEIGHT_HALF); + float(y) + CHANNEL_HEIGHT_HALF); } /* tracked segments */ @@ -167,9 +167,9 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *region, Scene *scene) if (start_frame != end_frame) { immRectf(pos_id, start_frame, - (float)y - STRIP_HEIGHT_HALF, + float(y) - STRIP_HEIGHT_HALF, end_frame, - (float)y + STRIP_HEIGHT_HALF); + float(y) + STRIP_HEIGHT_HALF); keyframe_len += 2; } else { @@ -218,10 +218,10 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *region, Scene *scene) immAttr4ub(outline_color_id, 0, 0, 0, 255); immAttr1u(flags_id, 0); - y = (float)CHANNEL_FIRST; /* start again at the top */ + y = float(CHANNEL_FIRST); /* start again at the top */ LISTBASE_FOREACH (MovieTrackingDopesheetChannel *, channel, &dopesheet->channels) { - float yminc = (float)(y - CHANNEL_HEIGHT_HALF); - float ymaxc = (float)(y + CHANNEL_HEIGHT_HALF); + float yminc = float(y - CHANNEL_HEIGHT_HALF); + float ymaxc = float(y + CHANNEL_HEIGHT_HALF); /* check if visible */ if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || @@ -296,7 +296,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *region) /* don't use totrect set, as the width stays the same * (NOTE: this is ok here, the configuration is pretty straightforward) */ - v2d->tot.ymin = (float)(-height); + v2d->tot.ymin = float(-height); } /* need to do a view-sync here, so that the keys area doesn't jump around @@ -306,7 +306,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *region) /* loop through channels, and set up drawing depending on their type * first pass: just the standard GL-drawing for backdrop + text */ - float y = (float)CHANNEL_FIRST; + float y = float(CHANNEL_FIRST); GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -314,8 +314,8 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *region) immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); LISTBASE_FOREACH (MovieTrackingDopesheetChannel *, channel, &dopesheet->channels) { - float yminc = (float)(y - CHANNEL_HEIGHT_HALF); - float ymaxc = (float)(y + CHANNEL_HEIGHT_HALF); + float yminc = float(y - CHANNEL_HEIGHT_HALF); + float ymaxc = float(y + CHANNEL_HEIGHT_HALF); /* check if visible */ if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || @@ -327,9 +327,9 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *region) immRectf(pos, v2d->cur.xmin, - (float)y - CHANNEL_HEIGHT_HALF, + float(y) - CHANNEL_HEIGHT_HALF, v2d->cur.xmax + EXTRA_SCROLL_PAD, - (float)y + CHANNEL_HEIGHT_HALF); + float(y) + CHANNEL_HEIGHT_HALF); } /* adjust y-position for next one */ @@ -338,13 +338,13 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *region) immUnbindProgram(); /* second pass: text */ - y = (float)CHANNEL_FIRST; + y = float(CHANNEL_FIRST); BLF_size(fontid, 11.0f * U.dpi_fac); LISTBASE_FOREACH (MovieTrackingDopesheetChannel *, channel, &dopesheet->channels) { - float yminc = (float)(y - CHANNEL_HEIGHT_HALF); - float ymaxc = (float)(y + CHANNEL_HEIGHT_HALF); + float yminc = float(y - CHANNEL_HEIGHT_HALF); + float ymaxc = float(y + CHANNEL_HEIGHT_HALF); /* check if visible */ if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || @@ -365,7 +365,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *region) /* third pass: widgets */ uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS); - y = (float)CHANNEL_FIRST; + y = float(CHANNEL_FIRST); /* get RNA properties (once) */ PropertyRNA *chan_prop_lock = RNA_struct_type_find_property(&RNA_MovieTrackingTrack, "lock"); @@ -373,8 +373,8 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *region) GPU_blend(GPU_BLEND_ALPHA); LISTBASE_FOREACH (MovieTrackingDopesheetChannel *, channel, &dopesheet->channels) { - float yminc = (float)(y - CHANNEL_HEIGHT_HALF); - float ymaxc = (float)(y + CHANNEL_HEIGHT_HALF); + float yminc = float(y - CHANNEL_HEIGHT_HALF); + float ymaxc = float(y + CHANNEL_HEIGHT_HALF); /* check if visible */ if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) || diff --git a/source/blender/editors/space_clip/clip_draw.cc b/source/blender/editors/space_clip/clip_draw.cc index f7dbb5a85bc..f594767bf23 100644 --- a/source/blender/editors/space_clip/clip_draw.cc +++ b/source/blender/editors/space_clip/clip_draw.cc @@ -1685,7 +1685,7 @@ static void draw_distortion(SpaceClip *sc, MovieTracking *tracking = &clip->tracking; bGPdata *gpd = nullptr; float aspy = 1.0f / tracking->camera.pixel_aspect; - float dx = (float)width / n, dy = (float)height / n * aspy; + float dx = float(width) / n, dy = float(height) / n * aspy; float offsx = 0.0f, offsy = 0.0f; if (!tracking->camera.focal) { @@ -1814,7 +1814,7 @@ static void draw_distortion(SpaceClip *sc, immUniformColor4fv(layer->color); GPU_line_width(layer->thickness); - GPU_point_size((float)(layer->thickness + 2)); + GPU_point_size(float(layer->thickness + 2)); while (frame) { bGPDstroke *stroke = static_cast(frame->strokes.first); @@ -1905,7 +1905,7 @@ void clip_draw_main(const bContext *C, SpaceClip *sc, ARegion *region) } if (ibuf != nullptr && width != ibuf->x) { - mul_v2_v2fl(translation, sc->loc, (float)width / ibuf->x); + mul_v2_v2fl(translation, sc->loc, float(width) / ibuf->x); } else { copy_v2_v2(translation, sc->loc); diff --git a/source/blender/editors/space_clip/clip_editor.cc b/source/blender/editors/space_clip/clip_editor.cc index ea2c79bb785..0035aa5430d 100644 --- a/source/blender/editors/space_clip/clip_editor.cc +++ b/source/blender/editors/space_clip/clip_editor.cc @@ -167,9 +167,9 @@ void ED_space_clip_get_zoom(const SpaceClip *sc, const ARegion *region, float *z ED_space_clip_get_size(sc, &width, &height); - *zoomx = (float)(BLI_rcti_size_x(®ion->winrct) + 1) / + *zoomx = float(BLI_rcti_size_x(®ion->winrct) + 1) / (BLI_rctf_size_x(®ion->v2d.cur) * width); - *zoomy = (float)(BLI_rcti_size_y(®ion->winrct) + 1) / + *zoomy = float(BLI_rcti_size_y(®ion->winrct) + 1) / (BLI_rctf_size_y(®ion->v2d.cur) * height); } @@ -215,8 +215,8 @@ void ED_space_clip_get_aspect_dimension_aware(const SpaceClip *sc, float *aspx, ED_space_clip_get_aspect(sc, aspx, aspy); BKE_movieclip_get_size(sc->clip, &sc->user, &w, &h); - *aspx *= (float)w; - *aspy *= (float)h; + *aspx *= float(w); + *aspy *= float(h); if (*aspx < *aspy) { *aspy = *aspy / *aspx; @@ -318,7 +318,7 @@ bool ED_space_clip_color_sample(const SpaceClip *sc, if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) { const float *fp; uchar *cp; - int x = (int)(fx * ibuf->x), y = (int)(fy * ibuf->y); + int x = int(fx * ibuf->x), y = int(fy * ibuf->y); CLAMP(x, 0, ibuf->x - 1); CLAMP(y, 0, ibuf->y - 1); @@ -541,8 +541,8 @@ void ED_clip_point_stable_pos__reverse(const SpaceClip *sc, /* untested */ mul_v3_m4v3(pos, sc->stabmat, pos); - r_co[0] = (pos[0] * width * zoomx) + (float)sx; - r_co[1] = (pos[1] * height * zoomy) + (float)sy; + r_co[0] = (pos[0] * width * zoomx) + float(sx); + r_co[1] = (pos[1] * height * zoomy) + float(sy); } void ED_clip_mouse_pos(const SpaceClip *sc, const ARegion *region, const int mval[2], float co[2]) @@ -824,7 +824,7 @@ static uchar *prefetch_thread_next_frame(PrefetchQueue *queue, } *queue->do_update = true; - *queue->progress = (float)frames_processed / (queue->end_frame - queue->start_frame); + *queue->progress = float(frames_processed) / (queue->end_frame - queue->start_frame); } } BLI_spin_unlock(&queue->spin); @@ -981,7 +981,7 @@ static void do_prefetch_movie(MovieClip *clip, frames_processed++; *do_update = true; - *progress = (float)frames_processed / (end_frame - start_frame); + *progress = float(frames_processed) / (end_frame - start_frame); } /* read frames starting from current frame up to scene start frame */ @@ -993,7 +993,7 @@ static void do_prefetch_movie(MovieClip *clip, frames_processed++; *do_update = true; - *progress = (float)frames_processed / (end_frame - start_frame); + *progress = float(frames_processed) / (end_frame - start_frame); } } diff --git a/source/blender/editors/space_clip/clip_graph_ops.cc b/source/blender/editors/space_clip/clip_graph_ops.cc index 2bf558906cd..2379b1f511d 100644 --- a/source/blender/editors/space_clip/clip_graph_ops.cc +++ b/source/blender/editors/space_clip/clip_graph_ops.cc @@ -626,8 +626,8 @@ static int view_all_exec(bContext *C, wmOperator * /*op*/) nullptr); /* set extents of view to start/end frames */ - v2d->cur.xmin = (float)scene->r.sfra; - v2d->cur.xmax = (float)scene->r.efra; + v2d->cur.xmin = float(scene->r.sfra); + v2d->cur.xmax = float(scene->r.efra); if (userdata.min < userdata.max) { v2d->cur.ymin = userdata.min; @@ -672,8 +672,8 @@ void ED_clip_graph_center_current_frame(Scene *scene, ARegion *region) float extra = BLI_rctf_size_x(&v2d->cur) / 2.0f; /* set extents of view to start/end frames */ - v2d->cur.xmin = (float)scene->r.cfra - extra; - v2d->cur.xmax = (float)scene->r.cfra + extra; + v2d->cur.xmin = float(scene->r.cfra) - extra; + v2d->cur.xmax = float(scene->r.cfra) + extra; } static int center_current_frame_exec(bContext *C, wmOperator * /*op*/) diff --git a/source/blender/editors/space_clip/clip_ops.cc b/source/blender/editors/space_clip/clip_ops.cc index 3093d768bc3..3ace6605487 100644 --- a/source/blender/editors/space_clip/clip_ops.cc +++ b/source/blender/editors/space_clip/clip_ops.cc @@ -631,10 +631,10 @@ static void view_zoom_apply( if (U.viewzoom != USER_ZOOM_SCALE) { if (U.uiflag & USER_ZOOM_HORIZ) { - delta = (float)(event->xy[0] - vpd->x); + delta = float(event->xy[0] - vpd->x); } else { - delta = (float)(event->xy[1] - vpd->y); + delta = float(event->xy[1] - vpd->y); } } else { @@ -650,7 +650,7 @@ static void view_zoom_apply( if (U.viewzoom == USER_ZOOM_CONTINUE) { SpaceClip *sclip = CTX_wm_space_clip(C); double time = PIL_check_seconds_timer(); - float time_step = (float)(time - vpd->timer_lastdraw); + float time_step = float(time - vpd->timer_lastdraw); float zfac; zfac = 1.0f + ((delta / 20.0f) * time_step); @@ -863,8 +863,8 @@ static int view_zoom_ratio_exec(bContext *C, wmOperator *op) sclip_zoom_set(C, RNA_float_get(op->ptr, "ratio"), nullptr, false); /* ensure pixel exact locations for draw */ - sc->xof = (int)sc->xof; - sc->yof = (int)sc->yof; + sc->xof = int(sc->xof); + sc->yof = int(sc->yof); ED_region_tag_redraw(CTX_wm_region(C)); @@ -929,15 +929,15 @@ static int view_all_exec(bContext *C, wmOperator *op) if (fit_view) { const int margin = 5; /* margin from border */ - zoomx = (float)width / (w + 2 * margin); - zoomy = (float)height / (h + 2 * margin); + zoomx = float(width) / (w + 2 * margin); + zoomy = float(height) / (h + 2 * margin); sclip_zoom_set(C, min_ff(zoomx, zoomy), nullptr, false); } else { if ((w >= width || h >= height) && (width > 0 && height > 0)) { - zoomx = (float)width / w; - zoomy = (float)height / h; + zoomx = float(width) / w; + zoomy = float(height) / h; /* find the zoom value that will fit the image in the image space */ sclip_zoom_set(C, 1.0f / power_of_2(1.0f / min_ff(zoomx, zoomy)), nullptr, false); @@ -1261,7 +1261,7 @@ static void do_movie_proxy(void *pjv, } *do_update = true; - *progress = ((float)cfra - sfra) / (efra - sfra); + *progress = (float(cfra) - sfra) / (efra - sfra); } if (distortion) { @@ -1344,7 +1344,7 @@ static uchar *proxy_thread_next_frame(ProxyQueue *queue, close(file); *queue->do_update = true; - *queue->progress = (float)(queue->cfra - queue->sfra) / (queue->efra - queue->sfra); + *queue->progress = float(queue->cfra - queue->sfra) / (queue->efra - queue->sfra); } BLI_spin_unlock(&queue->spin); diff --git a/source/blender/editors/space_clip/clip_utils.cc b/source/blender/editors/space_clip/clip_utils.cc index 3b285fe5294..6bd8e69d264 100644 --- a/source/blender/editors/space_clip/clip_utils.cc +++ b/source/blender/editors/space_clip/clip_utils.cc @@ -575,8 +575,8 @@ bool clip_view_calculate_view_selection( width = BLI_rcti_size_x(®ion->winrct) + 1; height = BLI_rcti_size_y(®ion->winrct) + 1; - zoomx = (float)width / w / aspx; - zoomy = (float)height / h / aspy; + zoomx = float(width) / w / aspx; + zoomy = float(height) / h / aspy; newzoom = 1.0f / power_of_2(1.0f / min_ff(zoomx, zoomy)); @@ -614,8 +614,8 @@ void clip_draw_sfra_efra(View2D *v2d, Scene *scene) immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f); - immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, (float)scene->r.sfra, v2d->cur.ymax); - immRectf(pos, (float)scene->r.efra, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); + immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, float(scene->r.sfra), v2d->cur.ymax); + immRectf(pos, float(scene->r.efra), v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); GPU_blend(GPU_BLEND_NONE); @@ -625,10 +625,10 @@ void clip_draw_sfra_efra(View2D *v2d, Scene *scene) GPU_line_width(1.0f); immBegin(GPU_PRIM_LINES, 4); - immVertex2f(pos, (float)scene->r.sfra, v2d->cur.ymin); - immVertex2f(pos, (float)scene->r.sfra, v2d->cur.ymax); - immVertex2f(pos, (float)scene->r.efra, v2d->cur.ymin); - immVertex2f(pos, (float)scene->r.efra, v2d->cur.ymax); + immVertex2f(pos, float(scene->r.sfra), v2d->cur.ymin); + immVertex2f(pos, float(scene->r.sfra), v2d->cur.ymax); + immVertex2f(pos, float(scene->r.efra), v2d->cur.ymin); + immVertex2f(pos, float(scene->r.efra), v2d->cur.ymax); immEnd(); immUnbindProgram(); diff --git a/source/blender/editors/space_clip/space_clip.cc b/source/blender/editors/space_clip/space_clip.cc index 56142b4a4ab..b30a1d6f305 100644 --- a/source/blender/editors/space_clip/space_clip.cc +++ b/source/blender/editors/space_clip/space_clip.cc @@ -66,8 +66,8 @@ static void init_preview_region(const Scene *scene, if (sc->view == SC_VIEW_DOPESHEET) { region->v2d.tot.xmin = -10.0f; - region->v2d.tot.ymin = (float)(-area->winy) / 3.0f; - region->v2d.tot.xmax = (float)(area->winx); + region->v2d.tot.ymin = float(-area->winy) / 3.0f; + region->v2d.tot.xmax = float(area->winx); region->v2d.tot.ymax = 0.0f; region->v2d.cur = region->v2d.tot; @@ -90,7 +90,7 @@ static void init_preview_region(const Scene *scene, else { region->v2d.tot.xmin = 0.0f; region->v2d.tot.ymin = -10.0f; - region->v2d.tot.xmax = (float)scene->r.efra; + region->v2d.tot.xmax = float(scene->r.efra); region->v2d.tot.ymax = 10.0f; region->v2d.cur = region->v2d.tot; @@ -766,12 +766,12 @@ static void movieclip_main_area_set_view2d(const bContext *C, ARegion *region) y1 -= sc->zoom * sc->yof; /* relative display right */ - region->v2d.cur.xmin = (region->winrct.xmin - (float)x1) / sc->zoom; - region->v2d.cur.xmax = region->v2d.cur.xmin + ((float)winx / sc->zoom); + region->v2d.cur.xmin = (region->winrct.xmin - float(x1)) / sc->zoom; + region->v2d.cur.xmax = region->v2d.cur.xmin + (float(winx) / sc->zoom); /* relative display left */ - region->v2d.cur.ymin = (region->winrct.ymin - (float)y1) / sc->zoom; - region->v2d.cur.ymax = region->v2d.cur.ymin + ((float)winy / sc->zoom); + region->v2d.cur.ymin = (region->winrct.ymin - float(y1)) / sc->zoom; + region->v2d.cur.ymax = region->v2d.cur.ymin + (float(winy) / sc->zoom); /* normalize 0.0..1.0 */ region->v2d.cur.xmin /= w; diff --git a/source/blender/editors/space_clip/tracking_ops_track.cc b/source/blender/editors/space_clip/tracking_ops_track.cc index 50e2fb48a5d..d13378c0507 100644 --- a/source/blender/editors/space_clip/tracking_ops_track.cc +++ b/source/blender/editors/space_clip/tracking_ops_track.cc @@ -92,7 +92,7 @@ static void track_init_markers(SpaceClip *sc, frames_limit = track->frames_limit; } else { - frames_limit = min_ii(frames_limit, (int)track->frames_limit); + frames_limit = min_ii(frames_limit, int(track->frames_limit)); } } } @@ -232,8 +232,8 @@ static void track_markers_startjob( } exec_time = PIL_check_seconds_timer() - start_time; - if (tmj->delay > (float)exec_time) { - PIL_sleep_ms(tmj->delay - (float)exec_time); + if (tmj->delay > float(exec_time)) { + PIL_sleep_ms(tmj->delay - float(exec_time)); } } else if (!BKE_autotrack_context_step(tmj->context)) { @@ -241,7 +241,7 @@ static void track_markers_startjob( } *do_update = true; - *progress = (float)(framenr - tmj->sfra) / (tmj->efra - tmj->sfra); + *progress = float(framenr - tmj->sfra) / (tmj->efra - tmj->sfra); if (tmj->backwards) { framenr--; diff --git a/source/blender/editors/space_view3d/view3d_select.cc b/source/blender/editors/space_view3d/view3d_select.cc index cb8941b3c86..e2cfc6fad0b 100644 --- a/source/blender/editors/space_view3d/view3d_select.cc +++ b/source/blender/editors/space_view3d/view3d_select.cc @@ -2987,7 +2987,7 @@ static bool ed_wpaint_vertex_select_pick(bContext *C, /** * Cursor selection for the Curves object. - * + * * \returns true if the selection changed. */ static bool ed_curves_select_pick(bContext &C, const int mval[2], const SelectPick_Params ¶ms)