mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-ui: add fit-width zoom helper
This commit is contained in:
@ -515,3 +515,15 @@ sysprof_zoom_manager_get_width_for_duration (SysprofZoomManager *self,
|
||||
|
||||
return (gdouble)duration / (gdouble)NSEC_PER_SEC * DEFAULT_PIXELS_PER_SEC * self->zoom;
|
||||
}
|
||||
|
||||
gdouble
|
||||
sysprof_zoom_manager_fit_zoom_for_duration (SysprofZoomManager *self,
|
||||
gint64 duration,
|
||||
gint width)
|
||||
{
|
||||
g_return_val_if_fail (SYSPROF_IS_ZOOM_MANAGER (self), 1.0);
|
||||
g_return_val_if_fail (duration >= 0, 1.0);
|
||||
|
||||
return ((gdouble)width / DEFAULT_PIXELS_PER_SEC) /
|
||||
((gdouble)duration / (gdouble)NSEC_PER_SEC);
|
||||
}
|
||||
|
||||
@ -70,5 +70,9 @@ gint sysprof_zoom_manager_get_width_for_duration (SysprofZoomMana
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gint64 sysprof_zoom_manager_get_duration_for_width (SysprofZoomManager *self,
|
||||
gint width);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gdouble sysprof_zoom_manager_fit_zoom_for_duration (SysprofZoomManager *self,
|
||||
gint64 duration,
|
||||
gint width);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
Reference in New Issue
Block a user