mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-02 18:03:07 +00:00
Bump resvg/usvg/tiny-skia dependencies
This commit is contained in:
parent
cecdb330f8
commit
65e4e7bf15
4 changed files with 11 additions and 12 deletions
|
@ -55,9 +55,9 @@ fontdue = { version = "0.7.1" }
|
||||||
# for processing and embedding the rendered image (texture)
|
# for processing and embedding the rendered image (texture)
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
image = "0.24"
|
image = "0.24"
|
||||||
tiny-skia = "0.6.1"
|
tiny-skia = "0.8.2"
|
||||||
resvg = "0.23"
|
resvg = "0.25"
|
||||||
usvg = "0.23"
|
usvg = "0.25"
|
||||||
|
|
||||||
[target.'cfg(not(any(target_family = "windows", target_os = "macos", target_os = "ios", target_arch = "wasm32")))'.dependencies]
|
[target.'cfg(not(any(target_family = "windows", target_os = "macos", target_os = "ios", target_arch = "wasm32")))'.dependencies]
|
||||||
libc = { version = "0.2" }
|
libc = { version = "0.2" }
|
||||||
|
|
|
@ -282,7 +282,7 @@ fn load_image(
|
||||||
))
|
))
|
||||||
})?;
|
})?;
|
||||||
// TODO: ideally we should find the size used for that `Image`
|
// TODO: ideally we should find the size used for that `Image`
|
||||||
let original_size = tree.svg_node().size;
|
let original_size = tree.size;
|
||||||
let width = original_size.width() * scale_factor;
|
let width = original_size.width() * scale_factor;
|
||||||
let height = original_size.height() * scale_factor;
|
let height = original_size.height() * scale_factor;
|
||||||
|
|
||||||
|
|
|
@ -73,9 +73,9 @@ integer-sqrt = { version = "0.1.5" }
|
||||||
image = { version = "0.24.0", optional = true, default-features = false, features = [ "png", "jpeg" ] }
|
image = { version = "0.24.0", optional = true, default-features = false, features = [ "png", "jpeg" ] }
|
||||||
clru = { version = "0.6.0", optional = true }
|
clru = { version = "0.6.0", optional = true }
|
||||||
|
|
||||||
resvg = { version= "0.23", optional = true, default-features = false }
|
resvg = { version= "0.25", optional = true, default-features = false }
|
||||||
usvg = { version= "0.23", optional = true, default-features = false, features = ["text"] }
|
usvg = { version= "0.25", optional = true, default-features = false, features = ["text"] }
|
||||||
tiny-skia = { version= "0.6.1", optional = true, default-features = false }
|
tiny-skia = { version= "0.8.2", optional = true, default-features = false }
|
||||||
|
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
instant = { version = "0.1", features = [ "wasm-bindgen", "now" ] }
|
instant = { version = "0.1", features = [ "wasm-bindgen", "now" ] }
|
||||||
|
@ -83,7 +83,7 @@ wasm-bindgen = { version = "0.2" }
|
||||||
web-sys = { version = "0.3", features = [ "HtmlImageElement" ] }
|
web-sys = { version = "0.3", features = [ "HtmlImageElement" ] }
|
||||||
|
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
usvg = { version= "0.23", optional = true, default-features = false, features = ["text", "memmap-fonts"] }
|
usvg = { version= "0.25", optional = true, default-features = false, features = ["text", "memmap-fonts"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
slint = { path = "../../api/rs/slint", default-features = false, features = ["std", "compat-0-3-0"] }
|
slint = { path = "../../api/rs/slint", default-features = false, features = ["std", "compat-0-3-0"] }
|
||||||
|
@ -94,4 +94,4 @@ fontdb = { version = "0.9.3" }
|
||||||
|
|
||||||
image = { version = "0.24.0", default-features = false, features = [ "png" ] }
|
image = { version = "0.24.0", default-features = false, features = [ "png" ] }
|
||||||
pin-weak = "1"
|
pin-weak = "1"
|
||||||
tiny-skia = "0.6.1"
|
tiny-skia = "0.8.2"
|
||||||
|
|
|
@ -31,7 +31,7 @@ impl core::fmt::Debug for ParsedSVG {
|
||||||
|
|
||||||
impl ParsedSVG {
|
impl ParsedSVG {
|
||||||
pub fn size(&self) -> crate::graphics::IntSize {
|
pub fn size(&self) -> crate::graphics::IntSize {
|
||||||
let size = self.svg_tree.svg_node().size.to_screen_size();
|
let size = self.svg_tree.size.to_screen_size();
|
||||||
[size.width(), size.height()].into()
|
[size.width(), size.height()].into()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,8 +46,7 @@ impl ParsedSVG {
|
||||||
) -> Result<SharedImageBuffer, usvg::Error> {
|
) -> Result<SharedImageBuffer, usvg::Error> {
|
||||||
let tree = &self.svg_tree;
|
let tree = &self.svg_tree;
|
||||||
let fit = usvg::FitTo::Size(size.width, size.height);
|
let fit = usvg::FitTo::Size(size.width, size.height);
|
||||||
let size =
|
let size = fit.fit_to(tree.size.to_screen_size()).ok_or(usvg::Error::InvalidSize)?;
|
||||||
fit.fit_to(tree.svg_node().size.to_screen_size()).ok_or(usvg::Error::InvalidSize)?;
|
|
||||||
let mut buffer = SharedPixelBuffer::new(size.width(), size.height());
|
let mut buffer = SharedPixelBuffer::new(size.width(), size.height());
|
||||||
let skia_buffer =
|
let skia_buffer =
|
||||||
tiny_skia::PixmapMut::from_bytes(buffer.make_mut_bytes(), size.width(), size.height())
|
tiny_skia::PixmapMut::from_bytes(buffer.make_mut_bytes(), size.width(), size.height())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue