From 5ddfe830472eaa5cd92db9d6fc40062b1f54ec49 Mon Sep 17 00:00:00 2001 From: Evan Paterakis Date: Fri, 27 Sep 2024 21:04:13 +0300 Subject: [PATCH] feat: avoid snapshoting it altogether --- src/Widgets/AudioPlayer/Visualizer.vala | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Widgets/AudioPlayer/Visualizer.vala b/src/Widgets/AudioPlayer/Visualizer.vala index c680be61..d4815b15 100644 --- a/src/Widgets/AudioPlayer/Visualizer.vala +++ b/src/Widgets/AudioPlayer/Visualizer.vala @@ -77,14 +77,16 @@ public class Tuba.Widgets.Audio.Visualizer : Gtk.Widget { var point = Graphene.Point ().init (new_center_w, new_center_h); snapshot.translate (point); - float res = (float) level * (int.min (MAX_CIRCLE_HEIGHT, win_h) - SQR) + SQR; + if (animations_enabled) { + float res = (float) level * (int.min (MAX_CIRCLE_HEIGHT, win_h) - SQR) + SQR; - var rect = Graphene.Rect ().init (- res / 2, - res / 2, res, res); - var rounded_rect = Gsk.RoundedRect ().init_from_rect (rect, 9999); + var rect = Graphene.Rect ().init (- res / 2, - res / 2, res, res); + var rounded_rect = Gsk.RoundedRect ().init_from_rect (rect, 9999); - snapshot.push_rounded_clip (rounded_rect); - snapshot.append_color (color, rect); - snapshot.pop (); + snapshot.push_rounded_clip (rounded_rect); + snapshot.append_color (color, rect); + snapshot.pop (); + } if (cover_texture != null) { var cover_rect = Graphene.Rect ().init (- SQR / 2, - SQR / 2, SQR, SQR);