From 8e9fa1cd2385de3c6374ee96ba34551254cd55e0 Mon Sep 17 00:00:00 2001 From: jaap aarts Date: Thu, 22 Oct 2020 12:10:50 +0200 Subject: [PATCH 1/3] make image features optional --- druid-shell/Cargo.toml | 19 ++++++++++++++++++- druid/Cargo.toml | 17 +++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/druid-shell/Cargo.toml b/druid-shell/Cargo.toml index cf33b1c0ef..fa3dc80230 100644 --- a/druid-shell/Cargo.toml +++ b/druid-shell/Cargo.toml @@ -18,6 +18,23 @@ default = ["gtk"] gtk = ["gio", "gdk", "gdk-sys", "glib", "glib-sys", "gtk-sys", "gtk-rs", "gdk-pixbuf"] x11 = ["x11rb", "nix", "cairo-sys-rs"] +# passing on all the image features. AVIF is not supported because it does not +# support decoding, and thats al we use `Image` for. +image_png = ["piet-common/image_png"] +jpeg = ["piet-common/jpeg"] +jpeg_rayon = ["piet-common/jpeg_rayon"] +gif = ["piet-common/gif"] +bmp = ["piet-common/bmp"] +ico = ["piet-common/ico"] +tiff = ["piet-common/tiff"] +webp = ["piet-common/webp"] +pnm = ["piet-common/pnm"] +dds = ["piet-common/dds"] +tga = ["piet-common/tga"] +farbfeld = ["piet-common/farbfeld"] +dxt = ["piet-common/dxt"] +hdr = ["piet-common/hdr"] + [dependencies] # NOTE: When changing the piet or kurbo versions, ensure that # the kurbo version included in piet is compatible with the kurbo version specified here. @@ -33,7 +50,7 @@ anyhow = "1.0.32" keyboard-types = { version = "0.5.0", default_features = false } # Optional dependencies -image = { version = "0.23.10", optional = true } +image = { version = "0.23.10", optional = true, default_features = false } [target.'cfg(target_os="windows")'.dependencies] scopeguard = "1.1.0" diff --git a/druid/Cargo.toml b/druid/Cargo.toml index dbe2f93fbd..3ea9f29463 100644 --- a/druid/Cargo.toml +++ b/druid/Cargo.toml @@ -26,6 +26,23 @@ image = ["druid-shell/image"] svg = ["usvg", "harfbuzz-sys"] x11 = ["druid-shell/x11"] +# passing on all the image features. AVIF is not supported because it does not +# support decoding, and thats al we use `Image` for. +png = ["druid-shell/image_png"] +jpeg = ["druid-shell/jpeg"] +jpeg_rayon = ["druid-shell/jpeg_rayon"] +gif = ["druid-shell/gif"] +bmp = ["druid-shell/bmp"] +ico = ["druid-shell/ico"] +tiff = ["druid-shell/tiff"] +webp = ["druid-shell/webp"] +pnm = ["druid-shell/pnm"] +dds = ["druid-shell/dds"] +tga = ["druid-shell/tga"] +farbfeld = ["druid-shell/farbfeld"] +dxt = ["druid-shell/dxt"] +hdr = ["druid-shell/hdr"] + [dependencies] druid-shell = { version = "0.6.0", default-features = false, path = "../druid-shell" } druid-derive = { version = "0.3.1", path = "../druid-derive" } From 42d0997143a162bcb7e99a76ff9a1447a8745a35 Mon Sep 17 00:00:00 2001 From: jaap aarts Date: Thu, 22 Oct 2020 13:30:58 +0200 Subject: [PATCH 2/3] add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 425e31cfcb..9a4c43155c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -74,6 +74,7 @@ You can find its changes [documented below](#060---2020-06-01). - `LensWrap` widget moved into widget module ([#1251] by [@cmyr]) - `Delegate::command` now returns `Handled`, not `bool` ([#1298] by [@jneem]) - `TextBox` selects all contents when tabbed to on macOS ([#1283] by [@cmyr]) +- All Image formats are now optional, reducing compile time and binary size by default ([#1340] by [@JAicewizard]) ### Deprecated From e1df5f39a5da0d9530eee8caccf495399537d67e Mon Sep 17 00:00:00 2001 From: jaap aarts Date: Fri, 23 Oct 2020 12:09:13 +0200 Subject: [PATCH 3/3] fix small spelling --- druid-shell/Cargo.toml | 2 +- druid/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/druid-shell/Cargo.toml b/druid-shell/Cargo.toml index fa3dc80230..62f2386f25 100644 --- a/druid-shell/Cargo.toml +++ b/druid-shell/Cargo.toml @@ -19,7 +19,7 @@ gtk = ["gio", "gdk", "gdk-sys", "glib", "glib-sys", "gtk-sys", "gtk-rs", "gdk-pi x11 = ["x11rb", "nix", "cairo-sys-rs"] # passing on all the image features. AVIF is not supported because it does not -# support decoding, and thats al we use `Image` for. +# support decoding, and that's all we use `Image` for. image_png = ["piet-common/image_png"] jpeg = ["piet-common/jpeg"] jpeg_rayon = ["piet-common/jpeg_rayon"] diff --git a/druid/Cargo.toml b/druid/Cargo.toml index 3ea9f29463..42734e0d54 100644 --- a/druid/Cargo.toml +++ b/druid/Cargo.toml @@ -27,7 +27,7 @@ svg = ["usvg", "harfbuzz-sys"] x11 = ["druid-shell/x11"] # passing on all the image features. AVIF is not supported because it does not -# support decoding, and thats al we use `Image` for. +# support decoding, and that's all we use `Image` for. png = ["druid-shell/image_png"] jpeg = ["druid-shell/jpeg"] jpeg_rayon = ["druid-shell/jpeg_rayon"]