rsx/overlays: Add time unit to some measured variables

This commit is contained in:
kd-11 2023-02-03 03:36:07 +03:00 committed by kd-11
parent ddf25b7869
commit 4c59359cf7
2 changed files with 9 additions and 9 deletions

View File

@ -17,21 +17,21 @@ namespace rsx
void animated_icon::update_animation_frame(compiled_resource& result)
{
if (m_last_update_timestamp == 0)
if (m_last_update_timestamp_us == 0)
{
m_last_update_timestamp = rsx::uclock();
m_last_update_timestamp_us = rsx::uclock();
}
else
{
const auto now = rsx::uclock();
m_current_frame_duration += (rsx::uclock() - m_last_update_timestamp);
m_last_update_timestamp = now;
m_current_frame_duration_us += (rsx::uclock() - m_last_update_timestamp_us);
m_last_update_timestamp_us = now;
}
if (m_current_frame_duration > m_frame_duration)
if (m_current_frame_duration_us > m_frame_duration_us)
{
m_current_frame = (m_current_frame + 1) % m_total_frames;
m_current_frame_duration = 0;
m_current_frame_duration_us = 0;
}
// We only care about the uvs (zw) components

View File

@ -24,12 +24,12 @@ namespace rsx
u16 m_spacing_y = 8;
u16 m_row_length = 12; // Number of animation frames in the X direction in case of a 2D grid of frames
u16 m_total_frames = 12; // Total number of available frames
u64 m_frame_duration = 100'000; // Hold duration for each frame
u64 m_frame_duration_us = 100'000; // Hold duration for each frame
// Animation playback variables
int m_current_frame = 0;
u64 m_current_frame_duration = 0;
u64 m_last_update_timestamp = 0;
u64 m_current_frame_duration_us = 0;
u64 m_last_update_timestamp_us = 0;
private:
std::unique_ptr<image_info> m_icon;