Avoid a division in time_now_d(). Minor optimizations.

This commit is contained in:
Henrik Rydgård committed 2020-10-10 19:05:46 +02:00
1 parent 1e923d52f3
commit e97baa503a
4 files changed
+8 -8

No files matched your search

+2 -1
View File
@@ -22,8 +22,9 @@ void OnScreenMessagesView::Draw(UIContext &dc) {
float y = 10.0f;
// Then draw them all.
const std::list<OnScreenMessages::Message> &messages = osm.Messages();
double now = time_now_d();
for (auto iter = messages.begin(); iter != messages.end(); ++iter) {
float alpha = (iter->endTime - time_now_d()) * 4.0f;
float alpha = (iter->endTime - now) * 4.0f;
if (alpha > 1.0) alpha = 1.0f;
if (alpha < 0.0) alpha = 0.0f;
// Messages that are wider than the screen are left-aligned instead of centered.