Browse Source

Update SVG crates (#2670)

* Update resvg, tiny-skia and usv to latest

* Remove default features from svg crates

Users can always opt-in to them themselves

* Update png 0.17.6 -> 0.17.7
pull/2671/head
Emil Ernerfeldt 2 years ago
committed by GitHub
parent
commit
06d753c289
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 207
      Cargo.lock
  2. 6
      crates/egui_extras/Cargo.toml
  3. 7
      crates/egui_extras/src/image.rs

207
Cargo.lock

@ -76,7 +76,7 @@ checksum = "620160ad7d0aec2b4ae487bc8fbf0367982651d27bf8908a49d03548cfce73ec"
dependencies = [
"accesskit",
"accesskit_consumer",
"arrayvec 0.7.2",
"arrayvec",
"once_cell",
"parking_lot",
"paste",
@ -222,12 +222,6 @@ version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
[[package]]
name = "arrayvec"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]]
name = "arrayvec"
version = "0.7.2"
@ -1148,12 +1142,9 @@ dependencies = [
[[package]]
name = "data-url"
version = "0.1.1"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a30bfce702bcfa94e906ef82421f2c0e61c076ad76030c16ee5d2e9a32fe193"
dependencies = [
"matches",
]
checksum = "8d7439c3735f405729d52c3fbbe4de140eaf938a1fe47d227c27f8254d4302a5"
[[package]]
name = "dconf_rs"
@ -1439,7 +1430,7 @@ dependencies = [
"image",
"resvg",
"serde",
"tiny-skia 0.6.6",
"tiny-skia",
"tracing",
"usvg",
]
@ -1638,27 +1629,6 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "fontconfig-parser"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82cea2adebf32a9b104b8ffb308b5fb3b456f04cc76c294c3c85025c8a5d75f4"
dependencies = [
"roxmltree",
]
[[package]]
name = "fontdb"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52186a39c335aa6f79fc0bf1c3cf854870b6ad4e50a7bb8a59b4ba1331f478a"
dependencies = [
"fontconfig-parser",
"log",
"memmap2",
"ttf-parser 0.17.1",
]
[[package]]
name = "foreign-types"
version = "0.3.2"
@ -1806,16 +1776,6 @@ dependencies = [
"wasi 0.11.0+wasi-snapshot-preview1",
]
[[package]]
name = "gif"
version = "0.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3edd93c6756b4dfaf2709eafcc345ba2636565295c198a9cfbf75fa5e3e00b06"
dependencies = [
"color_quant",
"weezl",
]
[[package]]
name = "gimli"
version = "0.27.1"
@ -2150,6 +2110,12 @@ dependencies = [
"png",
]
[[package]]
name = "imagesize"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df19da1e92fbfec043ca97d622955381b1f3ee72a180ec999912df31b1ccd951"
[[package]]
name = "indexmap"
version = "1.9.2"
@ -2262,7 +2228,7 @@ version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a53776d271cfb873b17c618af0298445c88afc52837f3e948fa3fafd131f449"
dependencies = [
"arrayvec 0.7.2",
"arrayvec",
"serde",
]
@ -2358,12 +2324,6 @@ dependencies = [
"libc",
]
[[package]]
name = "matches"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
[[package]]
name = "memchr"
version = "2.5.0"
@ -2753,7 +2713,7 @@ version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18904d3c65493a9f0d7542293d1a7f69bfdc309a6b9ef4f46dc3e58b0577edc5"
dependencies = [
"ttf-parser 0.17.1",
"ttf-parser",
]
[[package]]
@ -3025,9 +2985,9 @@ dependencies = [
[[package]]
name = "rctree"
version = "0.4.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ae028b272a6e99d9f8260ceefa3caa09300a8d6c8d2b2001316474bc52122e9"
checksum = "3b42e27ef78c35d3998403c1d26f3efd9e135d3e5121b0a4845cc5cc27547f4f"
[[package]]
name = "redox_syscall"
@ -3092,19 +3052,15 @@ checksum = "f1382d1f0a252c4bf97dc20d979a2fdd05b024acd7c2ed0f7595d7817666a157"
[[package]]
name = "resvg"
version = "0.23.0"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34489194784b86c03c3d688258e2ba73f3c82700ba4673ee2ecad5ae540b9438"
checksum = "c115863f2d3621999cf187e318bc92b16402dfeff6a48c74df700d77381394c1"
dependencies = [
"gif",
"jpeg-decoder",
"log",
"pico-args",
"png",
"rgb",
"svgfilters",
"svgtypes",
"tiny-skia 0.6.6",
"tiny-skia",
"usvg",
]
@ -3178,9 +3134,9 @@ dependencies = [
[[package]]
name = "roxmltree"
version = "0.14.1"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "921904a62e410e37e215c40381b7117f830d9d89ba60ab5236170541dd25646b"
checksum = "6b9de9831a129b122e7e61f242db509fa9d0838008bf0b29bb0624669edfe48a"
dependencies = [
"xmlparser",
]
@ -3219,22 +3175,6 @@ dependencies = [
"webpki",
]
[[package]]
name = "rustybuzz"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a617c811f5c9a7060fe511d35d13bf5b9f0463ce36d63ce666d05779df2b4eba"
dependencies = [
"bitflags",
"bytemuck",
"smallvec",
"ttf-parser 0.15.2",
"unicode-bidi-mirroring",
"unicode-ccc",
"unicode-general-category",
"unicode-script",
]
[[package]]
name = "ruzstd"
version = "0.3.0"
@ -3252,15 +3192,6 @@ version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
[[package]]
name = "safe_arch"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1ff3d6d9696af502cc3110dacce942840fb06ff4514cad92236ecc455f2ce05"
dependencies = [
"bytemuck",
]
[[package]]
name = "safemem"
version = "0.3.3"
@ -3322,7 +3253,7 @@ dependencies = [
"log",
"memmap2",
"smithay-client-toolkit",
"tiny-skia 0.8.2",
"tiny-skia",
]
[[package]]
@ -3543,6 +3474,9 @@ name = "strict-num"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9df65f20698aeed245efdde3628a6b559ea1239bbb871af1b6e3b58c413b2bd1"
dependencies = [
"float-cmp",
]
[[package]]
name = "strsim"
@ -3558,16 +3492,6 @@ dependencies = [
"egui_extras",
]
[[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.8.2"
@ -3747,20 +3671,6 @@ dependencies = [
"time-core",
]
[[package]]
name = "tiny-skia"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d049bfef0eaa2521e75d9ffb5ce86ad54480932ae19b85f78bec6f52c4d30d78"
dependencies = [
"arrayref",
"arrayvec 0.5.2",
"bytemuck",
"cfg-if",
"png",
"safe_arch",
]
[[package]]
name = "tiny-skia"
version = "0.8.2"
@ -3768,7 +3678,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ae12c22601b6853f4d93abb178e13bf0e1cc8e2454100c85d4d3a59ac71b3f7"
dependencies = [
"arrayref",
"arrayvec 0.7.2",
"arrayvec",
"bytemuck",
"cfg-if",
"png",
@ -3889,12 +3799,6 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "ttf-parser"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd"
[[package]]
name = "ttf-parser"
version = "0.17.1"
@ -3966,24 +3870,6 @@ version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
[[package]]
name = "unicode-bidi-mirroring"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56d12260fb92d52f9008be7e4bca09f584780eb2266dc8fecc6a192bec561694"
[[package]]
name = "unicode-ccc"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc2520efa644f8268dce4dcd3050eaa7fc044fca03961e9998ac7e2e92b77cf1"
[[package]]
name = "unicode-general-category"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07547e3ee45e28326cc23faac56d44f58f16ab23e413db526debce3b0bfd2742"
[[package]]
name = "unicode-ident"
version = "1.0.5"
@ -3999,18 +3885,6 @@ dependencies = [
"tinyvec",
]
[[package]]
name = "unicode-script"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d817255e1bed6dfd4ca47258685d14d2bdcfbc64fdc9e3819bd5848057b8ecc"
[[package]]
name = "unicode-vo"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94"
[[package]]
name = "unicode-width"
version = "0.1.10"
@ -4065,29 +3939,22 @@ dependencies = [
[[package]]
name = "usvg"
version = "0.23.0"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28a82565b5c96dcbb58c9bdbb6aa3642abd395a6a6b480658532c6f74c3c4b7a"
checksum = "8b5b7c2b30845b3348c067ca3d09e20cc6e327c288f0ca4c48698712abf432e9"
dependencies = [
"base64",
"data-url",
"flate2",
"float-cmp",
"fontdb",
"imagesize",
"kurbo",
"log",
"pico-args",
"rctree",
"roxmltree",
"rustybuzz",
"simplecss",
"siphasher",
"strict-num",
"svgtypes",
"ttf-parser 0.15.2",
"unicode-bidi",
"unicode-script",
"unicode-vo",
"xmlwriter",
]
[[package]]
@ -4340,12 +4207,6 @@ dependencies = [
"webpki",
]
[[package]]
name = "weezl"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb"
[[package]]
name = "wepoll-ffi"
version = "0.1.2"
@ -4361,7 +4222,7 @@ version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d14c6bfcf3b10f4273f522a95994553c0a5f2934976e62e61a720ae4bc2eb8f2"
dependencies = [
"arrayvec 0.7.2",
"arrayvec",
"cfg-if",
"js-sys",
"log",
@ -4385,7 +4246,7 @@ version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be1f61be28e557a6ecb2506cac06c63fae3b6d302a006f38195a7a80995abeb9"
dependencies = [
"arrayvec 0.7.2",
"arrayvec",
"bit-vec",
"bitflags",
"codespan-reporting",
@ -4409,7 +4270,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82e95792925fe3d58950b9a5c2a191caa145e2bc570e2d233f0d7320f6a8e814"
dependencies = [
"android_system_properties",
"arrayvec 0.7.2",
"arrayvec",
"ash",
"bit-set",
"bitflags",
@ -4819,12 +4680,6 @@ version = "0.13.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d25c75bf9ea12c4040a97f829154768bbbce366287e2dc044af160cd79a13fd"
[[package]]
name = "xmlwriter"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9"
[[package]]
name = "yaml-rust"
version = "0.4.5"

6
crates/egui_extras/Cargo.toml

@ -58,9 +58,9 @@ document-features = { version = "0.2", optional = true }
image = { version = "0.24", optional = true, default-features = false }
# svg feature
resvg = { version = "0.23", optional = true }
tiny-skia = { version = "0.6", optional = true } # must be updated in lock-step with resvg
usvg = { version = "0.23", optional = true }
resvg = { version = "0.28", optional = true, default-features = false }
tiny-skia = { version = "0.8", optional = true, default-features = false } # must be updated in lock-step with resvg
usvg = { version = "0.28", optional = true, default-features = false }
# feature "tracing"
tracing = { version = "0.1", optional = true, default-features = false, features = [

7
crates/egui_extras/src/image.rs

@ -231,12 +231,11 @@ pub fn load_svg_bytes_with_size(
svg_bytes: &[u8],
fit_to: FitTo,
) -> Result<egui::ColorImage, String> {
let mut opt = usvg::Options::default();
opt.fontdb.load_system_fonts();
let opt = usvg::Options::default();
let rtree = usvg::Tree::from_data(svg_bytes, &opt.to_ref()).map_err(|err| err.to_string())?;
let rtree = usvg::Tree::from_data(svg_bytes, &opt).map_err(|err| err.to_string())?;
let pixmap_size = rtree.svg_node().size.to_screen_size();
let pixmap_size = rtree.size.to_screen_size();
let [w, h] = match fit_to {
FitTo::Original => [pixmap_size.width(), pixmap_size.height()],
FitTo::Size(w, h) => [w, h],

Loading…
Cancel
Save