Skip to content

Commit e161848

Browse files
committed
perf(inline-emojis): Use rlt with improved cache
1 parent 99db97f commit e161848

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ once_cell = "1"
1919
pretty_env_logger = "0.5"
2020
qrcode-generator = { version = "4", default-features = false }
2121
regex = "1"
22-
rlt = { package = "gtk-rlottie", git = "https://github.com/YuraIz/gtk-rlottie-rs" }
22+
rlt = { package = "gtk-rlottie", git = "https://github.com/YuraIz/gtk-rlottie-rs", branch = "cache-rework" }
2323
tdlib = { version = "0.7", default-features = false }
2424
temp-dir = "0.1"
2525
thiserror = "1"

build-aux/app.drey.PaperPlane.Devel.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
"buildsystem": "meson",
4343
"config-opts": [
4444
"-Dexample=false",
45-
"-Dwerror=false"
45+
"-Dwerror=false",
46+
"-Dcache=false"
4647
],
4748
"sources": [
4849
{

src/components/sticker.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ mod imp {
2929

3030
#[property(get, set = Self::set_longer_side_size)]
3131
pub(super) longer_side_size: Cell<i32>,
32+
#[property(get, set)]
33+
pub(super) skip_odd_frames: Cell<bool>,
3234
}
3335

3436
#[glib::object_subclass]
@@ -183,8 +185,8 @@ impl Sticker {
183185
let widget: gtk::Widget = match format {
184186
StickerFormat::Tgs => {
185187
let animation = rlt::Animation::from_filename(&path);
188+
animation.set_skip_odd_frames(self.skip_odd_frames());
186189
animation.set_loop(looped);
187-
animation.use_cache(looped);
188190
animation.play();
189191
animation.upcast()
190192
}

src/utils.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ pub(crate) async fn custom_emojis(session: crate::Session, ids: Vec<i64>) -> Vec
9999
let sticker = sticker_map[id].clone();
100100
let widget = Sticker::new();
101101
widget.set_longer_side_size(20);
102+
widget.set_skip_odd_frames(true);
102103
widget.update_sticker(sticker, true, session.clone());
103104
widget.upcast()
104105
})

0 commit comments

Comments
 (0)