diff --git a/Cargo.lock b/Cargo.lock index 411742d37..570654610 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -636,7 +636,7 @@ dependencies = [ [[package]] name = "gtk-rlottie" version = "0.1.0" -source = "git+https://github.com/YuraIz/gtk-rlottie-rs?branch=cache-rework#94ef26622551f7a9e286d79e8cc9a77960a883ae" +source = "git+https://github.com/YuraIz/gtk-rlottie-rs?branch=cache-rework#bc597c38c71fda27cb267e602eacee7d4860fc61" dependencies = [ "flate2", "gtk4", diff --git a/src/components/label_with_widgets.rs b/src/components/label_with_widgets.rs index 2514f3c30..d00d01570 100644 --- a/src/components/label_with_widgets.rs +++ b/src/components/label_with_widgets.rs @@ -129,23 +129,30 @@ mod imp { if self.widgets.borrow().is_empty() { self.parent_snapshot(snapshot) } else { - let (texture, bounds) = { - let snapshot = gtk::Snapshot::new(); + let widget = self.obj(); + + let width = widget.width(); + let heigth = widget.height(); + + let bounds = gtk::graphene::Rect::new(1.0, 0.0, width as f32, heigth as f32); + + let texture = { + let s = widget.scale_factor() as f32; + + let bounds = bounds.scale(s, s); + let snapshot = gtk::Snapshot::new(); + snapshot.scale(s, s); self.parent_snapshot(&snapshot); let node = snapshot.to_node().unwrap(); - let bounds = node.bounds(); let renderer = gsk::CairoRenderer::new(); - renderer.realize(None).unwrap(); - let texture = renderer.render_texture(node, Some(&bounds)); - renderer.unrealize(); - (texture, bounds) + texture }; snapshot.append_texture(&texture, &bounds)