From 5e8e2dac02192c3353cf091c5573eca1d981cf46 Mon Sep 17 00:00:00 2001 From: Jeron Aldaron Lau Date: Mon, 29 May 2023 10:39:35 -0500 Subject: [PATCH] Update resvg and use re-export of tiny-skia from resvg --- Cargo.lock | 113 ++++++++++---------------- alloy/Cargo.toml | 3 +- alloy/src/image_cache/image_loader.rs | 8 +- 3 files changed, 47 insertions(+), 77 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6fcadf7b..9bcc58b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -53,7 +53,6 @@ dependencies = [ "serde", "sys-info", "thiserror", - "tiny-skia", "toml 0.7.4", "trash", "winres", @@ -148,9 +147,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.1" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f1e31e207a6b8fb791a38ea3105e6cb541f55e4d029902d3039a4ad07cc4105" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" [[package]] name = "bit_field" @@ -1260,12 +1259,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if 1.0.0", -] +checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" [[package]] name = "malloc_buf" @@ -1373,14 +1369,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "eebffdb73fe72e917997fad08bdbf31ac50b0fa91cec93e69a0662e4264d454c" dependencies = [ "libc", "log", "wasi", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -1707,9 +1703,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b" [[package]] name = "open" @@ -1822,7 +1818,7 @@ checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -1871,9 +1867,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.58" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa1fb82fc0c281dd9671101b66b771ebbe1eaf967b96ac8740dcba4b70005ca8" +checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" dependencies = [ "unicode-ident", ] @@ -1889,9 +1885,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -1995,9 +1991,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.2" +version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1a59b5d8e97dee33696bf13c5ba8ab85341c002922fba050069326b9c498974" +checksum = "81ca098a9821bd52d6b24fd8b10bd081f47d39c22778cafaa75a2857a62c6390" dependencies = [ "aho-corasick", "memchr", @@ -2012,9 +2008,9 @@ checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" [[package]] name = "resvg" -version = "0.33.0" +version = "0.34.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df5f3de3bb51d8a4766a1ef5d85851f2737716dea899516248d25e313a51b0d" +checksum = "b0e3d65cea36eefb28a020edb6e66341764e00cd4b426e0c1f0599b1adaa78f5" dependencies = [ "gif", "jpeg-decoder", @@ -2022,7 +2018,6 @@ dependencies = [ "pico-args", "png", "rgb", - "svgfilters", "svgtypes", "tiny-skia", "usvg", @@ -2037,19 +2032,6 @@ dependencies = [ "bytemuck", ] -[[package]] -name = "rosvgtree" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad747e7384940e7bf33b15ba433b7bad9f44c0c6d5287a67c2cb22cd1743d497" -dependencies = [ - "log", - "roxmltree", - "simplecss", - "siphasher", - "svgtypes", -] - [[package]] name = "roxmltree" version = "0.18.0" @@ -2143,7 +2125,7 @@ checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -2265,9 +2247,9 @@ checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0" [[package]] name = "strict-num" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9df65f20698aeed245efdde3628a6b559ea1239bbb871af1b6e3b58c413b2bd1" +checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" dependencies = [ "float-cmp", ] @@ -2284,16 +2266,6 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" -[[package]] -name = "svgfilters" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "639abcebc15fdc2df179f37d6f5463d660c1c79cd552c12343a4600827a04bce" -dependencies = [ - "float-cmp", - "rgb", -] - [[package]] name = "svgtypes" version = "0.11.0" @@ -2317,9 +2289,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.16" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6f671d4b5ffdb8eadec19c0ae67fe2639df8684bd7bc4b83d986b8db549cf01" +checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" dependencies = [ "proc-macro2", "quote", @@ -2368,7 +2340,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -2384,9 +2356,9 @@ dependencies = [ [[package]] name = "tiny-skia" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce2986c82f77818c7b9144c70818fdde98db15308e329ae2f7204d767808fd3c" +checksum = "7db11798945fa5c3e5490c794ccca7c6de86d3afdd54b4eb324109939c6f37bc" dependencies = [ "arrayref", "arrayvec", @@ -2399,9 +2371,9 @@ dependencies = [ [[package]] name = "tiny-skia-path" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7acb0ccda1ac91084353a56d0b69b0e29c311fd809d2088b1ed2f9ae1841c47" +checksum = "2f60aa35c89ac2687ace1a2556eaaea68e8c0d47408a2e3e7f5c98a489e7281c" dependencies = [ "arrayref", "bytemuck", @@ -2574,9 +2546,9 @@ dependencies = [ [[package]] name = "usvg" -version = "0.33.0" +version = "0.34.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae32eb823aab35fc343b19c4d354f70e713b442ce34cdfa8497bf6c39af8a342" +checksum = "d2304b933107198a910c1f3219acb65246f2b148f862703cffd51c6e62156abe" dependencies = [ "base64", "log", @@ -2589,26 +2561,27 @@ dependencies = [ [[package]] name = "usvg-parser" -version = "0.33.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7529174e721c8078d62b08399258469b1d68b4e5f2983b347d6a9d39779366c" +checksum = "12b940fea80394e3b14cb21c83fa1b8f8a41023c25929bba68bb84a76193ebed" dependencies = [ "data-url", "flate2", "imagesize", "kurbo", "log", - "rosvgtree", - "strict-num", + "roxmltree", + "simplecss", + "siphasher", "svgtypes", "usvg-tree", ] [[package]] name = "usvg-text-layout" -version = "0.33.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e672fbc19261c6553113cc04ff2ff38ae52fadbd90f2d814040857795fb5c50" +checksum = "69dfd6119f431aa7e969b4a69f9cc8b9ae37b8ae85bb26780ccfa3beaf8b71eb" dependencies = [ "fontdb", "kurbo", @@ -2622,14 +2595,14 @@ dependencies = [ [[package]] name = "usvg-tree" -version = "0.33.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a56e9cd3be5eb6d6744477e95b82d52d393fc1dba4b5b090912c33af337c20b" +checksum = "3185eb13b6e3d3cf1817d29612251cc308d5a7e5e6235362e67efe832435c6d9" dependencies = [ - "kurbo", "rctree", "strict-num", "svgtypes", + "tiny-skia-path", ] [[package]] @@ -2675,7 +2648,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", "wasm-bindgen-shared", ] @@ -2697,7 +2670,7 @@ checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3120,7 +3093,7 @@ dependencies = [ "lazy_static", "libc", "log", - "mio 0.8.6", + "mio 0.8.7", "ndk 0.5.0", "ndk-glue 0.5.2", "ndk-sys", diff --git a/alloy/Cargo.toml b/alloy/Cargo.toml index fb86c9f4..997aced0 100644 --- a/alloy/Cargo.toml +++ b/alloy/Cargo.toml @@ -63,8 +63,7 @@ lexical-sort = "0.3" trash = { version = "3.0", default-features = false } kamadak-exif = "0.5" arboard = "3.2" -resvg = "0.33" -tiny-skia = "0.9" +resvg = "0.34" log = "0.4" env_logger = "0.10" pico-args = "0.5" diff --git a/alloy/src/image_cache/image_loader.rs b/alloy/src/image_cache/image_loader.rs index 0071da14..a260680f 100644 --- a/alloy/src/image_cache/image_loader.rs +++ b/alloy/src/image_cache/image_loader.rs @@ -16,6 +16,7 @@ use gelatin::image::{ AnimationDecoder, ImageFormat, }; use resvg::{ + tiny_skia::{Pixmap, Transform}, usvg::{self, TreeParsing}, Tree, }; @@ -190,12 +191,9 @@ pub fn load_svg(path: &std::path::Path) -> Result { let (width, height) = ((width * zoom) as u32, (height * zoom) as u32); let zoom = zoom as f32; // These unwrapped Options are fine as long as the dimensions are correct - let mut pixmap = tiny_skia::Pixmap::new(width, height).unwrap(); + let mut pixmap = Pixmap::new(width, height).unwrap(); - tree.render( - tiny_skia::Transform::from_scale(zoom, zoom), - &mut pixmap.as_mut(), - ); + tree.render(Transform::from_scale(zoom, zoom), &mut pixmap.as_mut()); Ok(image::RgbaImage::from_raw(width, height, pixmap.take()).unwrap()) }