Skip to content

Commit

Permalink
Merge pull request #383 from LGFae/remove-most-static-muts
Browse files Browse the repository at this point in the history
Remove most static muts
  • Loading branch information
LGFae authored Dec 31, 2024
2 parents 004dfd8 + e0d2e84 commit 5788693
Show file tree
Hide file tree
Showing 11 changed files with 467 additions and 357 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version = "0.9.5-masterV3"
authors = ["Leonardo Gibrowski Faé <[email protected]>"]
edition = "2021"
license-file = "LICENSE"
rust-version = "1.80"
rust-version = "1.82"

[workspace.dependencies]
common = { path = "common" }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

### Dependencies:

- Up to date stable rustc compiler and cargo (specifically, MSRV is 1.75.0)
- Up to date stable rustc compiler and cargo (specifically, MSRV is 1.82.0)

To build, clone this repository and run:
```
Expand Down
21 changes: 12 additions & 9 deletions daemon/src/animations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ use std::{

use common::{
compression::Decompressor,
ipc::{self, Animation, BgImg, ImgReq},
ipc::{self, Animation, BgImg, ImgReq, PixelFormat},
mmap::MmappedBytes,
};

use crate::{wallpaper::Wallpaper, wayland::globals};
use crate::{wallpaper::Wallpaper, wayland::ObjectManager};

mod transitions;
use transitions::Effect;
Expand All @@ -31,6 +31,7 @@ impl TransitionAnimator {
pub fn new(
mut wallpapers: Vec<Rc<RefCell<Wallpaper>>>,
transition: &ipc::Transition,
pixel_format: PixelFormat,
img_req: ImgReq,
animation: Option<Animation>,
) -> Option<Self> {
Expand All @@ -49,7 +50,7 @@ impl TransitionAnimator {
return None;
}
let fps = Duration::from_nanos(1_000_000_000 / transition.fps as u64);
let effect = Effect::new(transition, dim);
let effect = Effect::new(transition, pixel_format, dim);
Some(Self {
wallpapers,
effect,
Expand All @@ -69,7 +70,7 @@ impl TransitionAnimator {
self.now = Instant::now();
}

pub fn frame(&mut self) -> bool {
pub fn frame(&mut self, objman: &mut ObjectManager, pixel_format: PixelFormat) -> bool {
let Self {
wallpapers,
effect,
Expand All @@ -78,7 +79,7 @@ impl TransitionAnimator {
..
} = self;
if !*over {
*over = effect.execute(wallpapers, img.bytes());
*over = effect.execute(objman, pixel_format, wallpapers, img.bytes());
false
} else {
true
Expand Down Expand Up @@ -121,7 +122,7 @@ impl ImageAnimator {
self.now = Instant::now();
}

pub fn frame(&mut self) {
pub fn frame(&mut self, objman: &mut ObjectManager, pixel_format: PixelFormat) {
let Self {
wallpapers,
animation,
Expand All @@ -134,9 +135,11 @@ impl ImageAnimator {

let mut j = 0;
while j < wallpapers.len() {
let result = wallpapers[j].borrow_mut().canvas_change(|canvas| {
decompressor.decompress(frame, canvas, globals::pixel_format())
});
let result = wallpapers[j]
.borrow_mut()
.canvas_change(objman, pixel_format, |canvas| {
decompressor.decompress(frame, canvas, pixel_format)
});

if let Err(e) = result {
error!("failed to unpack frame: {e}");
Expand Down
Loading

0 comments on commit 5788693

Please sign in to comment.