Cleanup: GPv3: Use constexpr for compile time constant

This commit is contained in:
Falk David
2024-06-04 15:52:21 +02:00
parent fabc274089
commit 8a1b239f5c

View File

@@ -38,8 +38,6 @@
namespace blender::ed::sculpt_paint::greasepencil {
static constexpr float POINT_OVERRIDE_THRESHOLD_PX = 3.0f;
static float brush_radius_to_pixel_radius(const RegionView3D *rv3d,
const Scene *scene,
const Brush *brush,
@@ -560,7 +558,8 @@ struct PaintOperationExecutor {
/* Overwrite last point if it's very close. */
const IndexRange points_range = curves.points_by_curve()[curves.curves_range().last()];
const bool is_first_sample = (points_range.size() == 1);
if (math::distance(coords, prev_coords) < POINT_OVERRIDE_THRESHOLD_PX) {
constexpr float point_override_threshold_px = 2.0f;
if (math::distance(coords, prev_coords) < point_override_threshold_px) {
/* Don't move the first point of the stroke. */
if (!is_first_sample) {
curves.positions_for_write()[last_active_point] = position;
@@ -611,7 +610,7 @@ struct PaintOperationExecutor {
}
/* Only start smoothing if there are enough points. */
const int64_t min_active_smoothing_points_num = 8;
constexpr int64_t min_active_smoothing_points_num = 8;
const IndexRange smooth_window = self.screen_space_coords_orig_.index_range().drop_front(
self.active_smooth_start_index_);
if (smooth_window.size() < min_active_smoothing_points_num) {