gdk/frame_clock.rs
1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use crate::FrameClock;
4use glib::translate::*;
5
6impl FrameClock {
7 /// Using the frame history stored in the frame clock, finds the last
8 /// known presentation time and refresh interval, and assuming that
9 /// presentation times are separated by the refresh interval,
10 /// predicts a presentation time that is a multiple of the refresh
11 /// interval after the last presentation time, and later than `base_time`.
12 /// ## `base_time`
13 /// base time for determining a presentaton time
14 ///
15 /// # Returns
16 ///
17 ///
18 /// ## `refresh_interval_return`
19 /// a location to store the
20 /// determined refresh interval, or [`None`]. A default refresh interval of
21 /// 1/60th of a second will be stored if no history is present.
22 ///
23 /// ## `presentation_time_return`
24 /// a location to store the next
25 /// candidate presentation time after the given base time.
26 /// 0 will be will be stored if no history is present.
27 #[doc(alias = "gdk_frame_clock_get_refresh_info")]
28 #[doc(alias = "get_refresh_info")]
29 pub fn refresh_info(&self, base_time: i64) -> (i64, i64) {
30 unsafe {
31 let mut refresh_interval = 0;
32 let mut presentation_time = 0;
33 ffi::gdk_frame_clock_get_refresh_info(
34 self.to_glib_none().0,
35 base_time,
36 &mut refresh_interval,
37 &mut presentation_time,
38 );
39 (refresh_interval, presentation_time)
40 }
41 }
42}