aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/helpers/BezierCurve.cpp
diff options
context:
space:
mode:
authorTom Englund <[email protected]>2024-07-31 21:00:14 +0200
committerGitHub <[email protected]>2024-07-31 21:00:14 +0200
commit548968279926a73d7ff19a9a185c977c50d56756 (patch)
tree67136e6e5144512d3fbfcf5b7c5e38f35c0750c3 /src/helpers/BezierCurve.cpp
parente989a0bcffac81092ed2a7e371f5225c113f689d (diff)
downloadHyprland-548968279926a73d7ff19a9a185c977c50d56756.tar.gz
Hyprland-548968279926a73d7ff19a9a185c977c50d56756.zip
internal: some minor fd/socket cleanups and make logging thread safe (#7123)
* bezier: dont loop on float values Using a floating-point loop variable with a fixed increment can cause precision errors over time due to the nature of floating-point arithmetic. and cause undesired effects. ex iteration 1 = 0.10000000149011611938 iteration 2 = 0.20000000298023223877 eventually.. iteration 8 = 0.80000001192092895508 iteration 9 = 0.89999997615814208984 * hyprctl: close sockets on destruction store socketpath and close the fd and unlink the socket path on exit. * eventloopmgr: close the timerfd close the timerfd on exit. * debug: make logging thread safe instead of opening and closing the logfile on each write open it on init and close it on compositor exit. also add a mutex so accidently using logging from a thread like the watchdog or similiar doesnt cause issues. * xwl: clean up fd logic check if the fd is actually opened before closing, and close the pipesource FD on exit.
Diffstat (limited to 'src/helpers/BezierCurve.cpp')
-rw-r--r--src/helpers/BezierCurve.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/helpers/BezierCurve.cpp b/src/helpers/BezierCurve.cpp
index e79863a3..dd0ff2b0 100644
--- a/src/helpers/BezierCurve.cpp
+++ b/src/helpers/BezierCurve.cpp
@@ -30,8 +30,10 @@ void CBezierCurve::setup(std::vector<Vector2D>* pVec) {
const auto POINTSSIZE = m_aPointsBaked.size() * sizeof(m_aPointsBaked[0]) / 1000.f;
const auto BEGINCALC = std::chrono::high_resolution_clock::now();
- for (float i = 0.1f; i < 1.f; i += 0.1f)
+ for (int j = 1; j < 10; ++j) {
+ float i = j / 10.0f;
getYForPoint(i);
+ }
const auto ELAPSEDCALCAVG = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - BEGINCALC).count() / 1000.f / 10.f;
Debug::log(LOG, "Created a bezier curve, baked {} points, mem usage: {:.2f}kB, time to bake: {:.2f}µs. Estimated average calc time: {:.2f}µs.", BAKEDPOINTS, POINTSSIZE,