[core] Use constexpr when possible

Signed-off-by: x7z4w <x7z4w@noreply.codeberg.org>
This commit is contained in:
x7z4w
2025-10-24 08:36:38 +00:00
parent 936e05283c
commit 42f059f8f7
90 changed files with 258 additions and 259 deletions

View File

@@ -128,21 +128,21 @@ uint32_t VisualParams::GetTileSize() const
uint32_t VisualParams::GetTouchRectRadius() const
{
ASSERT_INITED;
float const kRadiusInPixels = 20.0f;
float constexpr kRadiusInPixels = 20.0f;
return static_cast<uint32_t>(kRadiusInPixels * GetVisualScale());
}
double VisualParams::GetDragThreshold() const
{
ASSERT_INITED;
double const kDragThresholdInPixels = 10.0;
double constexpr kDragThresholdInPixels = 10.0;
return kDragThresholdInPixels * GetVisualScale();
}
double VisualParams::GetScaleThreshold() const
{
ASSERT_INITED;
double const kScaleThresholdInPixels = 2.0;
double constexpr kScaleThresholdInPixels = 2.0;
return kScaleThresholdInPixels * GetVisualScale();
}
@@ -305,7 +305,7 @@ void ExtractZoomFactors(ScreenBase const & s, double & zoom, int & index, float
double GetNormalizedZoomLevel(double screenScale, int minZoom)
{
double const kMaxZoom = scales::GetUpperStyleScale() + 1.0;
double constexpr kMaxZoom = scales::GetUpperStyleScale() + 1.0;
return math::Clamp((GetZoomLevel(screenScale) - minZoom) / (kMaxZoom - minZoom), 0.0, 1.0);
}