mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 14:20:21 +00:00
inspector: Handle more digits in fps overlay
The fps used to get garbled when hitting >=10,000fps. That's quite unlikely to happen for long periods, but it can happen for short bursts (like after alt-tabbing). So just handle more digits to make the display survive those corner cases.
This commit is contained in:
parent
5b83ffa4a0
commit
23c2122c13
@ -83,7 +83,7 @@ gtk_fps_info_new (GtkWidget *widget)
|
|||||||
|
|
||||||
info = g_new0 (GtkFpsInfo, 1);
|
info = g_new0 (GtkFpsInfo, 1);
|
||||||
|
|
||||||
layout = gtk_widget_create_pango_layout (widget, "0000.00 fps");
|
layout = gtk_widget_create_pango_layout (widget, "000000.00 fps");
|
||||||
attrs = pango_attr_list_new ();
|
attrs = pango_attr_list_new ();
|
||||||
pango_attr_list_insert (attrs, pango_attr_font_features_new ("tnum=1"));
|
pango_attr_list_insert (attrs, pango_attr_font_features_new ("tnum=1"));
|
||||||
pango_layout_set_attributes (layout, attrs);
|
pango_layout_set_attributes (layout, attrs);
|
||||||
@ -211,8 +211,8 @@ gtk_fps_overlay_snapshot (GtkInspectorOverlay *overlay,
|
|||||||
gboolean bg_drawn = FALSE;
|
gboolean bg_drawn = FALSE;
|
||||||
float bg_x = 0;
|
float bg_x = 0;
|
||||||
|
|
||||||
g_snprintf (fps_string, sizeof (fps_string), "%7.2f fps", fps);
|
g_snprintf (fps_string, sizeof (fps_string), "%9.2f fps", fps);
|
||||||
for (int i = 0; i < 7; i++)
|
for (int i = 0; i < 9; i++)
|
||||||
{
|
{
|
||||||
if (fps_string[i] == ' ')
|
if (fps_string[i] == ' ')
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user