remove depencency of `image` crate; add patch file

pull/1986/head
Rika 9 months ago
parent d13444b5ea
commit d661999297
No known key found for this signature in database

@ -0,0 +1,5 @@
---
"clipboard-manager": patch
---
Fix that `read_image` wrongly set the image rgba data with binary PNG data.

@ -37,4 +37,3 @@ tauri = { workspace = true, features = ["wry"] }
[target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] [target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
arboard = "3" arboard = "3"
image = "0.25"

@ -84,7 +84,11 @@ impl<R: Runtime> Clipboard<R> {
match &self.clipboard { match &self.clipboard {
Ok(clipboard) => { Ok(clipboard) => {
let image = clipboard.lock().unwrap().get_image()?; let image = clipboard.lock().unwrap().get_image()?;
let image = Image::new_owned(image.bytes.to_vec(), image.width as u32, image.height as u32); let image = Image::new_owned(
image.bytes.to_vec(),
image.width as u32,
image.height as u32,
);
Ok(image) Ok(image)
} }
Err(e) => Err(crate::Error::Clipboard(e.to_string())), Err(e) => Err(crate::Error::Clipboard(e.to_string())),

@ -15,9 +15,6 @@ pub enum Error {
Clipboard(String), Clipboard(String),
#[error(transparent)] #[error(transparent)]
Tauri(#[from] tauri::Error), Tauri(#[from] tauri::Error),
#[cfg(desktop)]
#[error("invalid image: {0}")]
Image(#[from] image::ImageError),
} }
impl Serialize for Error { impl Serialize for Error {

Loading…
Cancel
Save