diff --git a/crates/Cargo.toml b/crates/Cargo.toml index 72c69885c..d5103844a 100644 --- a/crates/Cargo.toml +++ b/crates/Cargo.toml @@ -138,3 +138,11 @@ i-slint-core = { path = "vendor/i-slint-core-1.16.1" } # case the glyph draws at regular weight instead of not at all. No effect # on fonts/instances that already render. femtovg = { path = "vendor/femtovg-0.23.2" } +# macOS Skia renderer: skia bug 310510989 makes new_from_data fail for TTC +# faces at index > 0, and for some system collections (AppleSDGothicNeo.ttc, +# where EVERY weight sits at index > 0) the upstream read/write-fonts rebuild +# workaround ALSO fails — every Korean glyph run at non-regular weights drew +# nothing. The patch adds a second-chance workaround: resolve the same face +# through CoreText by family name + OS/2 weight, guarded by cmap glyph-id +# spot checks so a wrong match is rejected instead of drawing wrong glyphs. +i-slint-renderer-skia = { path = "vendor/i-slint-renderer-skia-1.16.1" } diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/.cargo_vcs_info.json b/crates/vendor/i-slint-renderer-skia-1.16.1/.cargo_vcs_info.json new file mode 100644 index 000000000..b23a8e182 --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/.cargo_vcs_info.json @@ -0,0 +1,6 @@ +{ + "git": { + "sha1": "e9c1ca295f9356af71f1e251c287de18406b46f6" + }, + "path_in_vcs": "internal/renderers/skia" +} \ No newline at end of file diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/Cargo.lock b/crates/vendor/i-slint-renderer-skia-1.16.1/Cargo.lock new file mode 100644 index 000000000..33b66dadc --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/Cargo.lock @@ -0,0 +1,3800 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "as-raw-xcb-connection" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" + +[[package]] +name = "ash" +version = "0.38.0+1.3.281" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" +dependencies = [ + "libloading", +] + +[[package]] +name = "auto_enums" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65398a2893f41bce5c9259f6e1a4f03fbae40637c1bdc755b4f387f48c613b03" +dependencies = [ + "derive_utils", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bindgen" +version = "0.72.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895" +dependencies = [ + "bitflags 2.11.1", + "cexpr", + "clang-sys", + "itertools", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash 2.1.2", + "shlex", + "syn", +] + +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "bytemuck" +version = "1.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "byteorder-lite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" + +[[package]] +name = "cc" +version = "1.2.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43c5703da9466b66a946814e1adf53ea2c90f10063b86290cc9eb67ce3478a20" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "cgl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" +dependencies = [ + "libc", +] + +[[package]] +name = "chrono" +version = "0.4.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "clru" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "197fd99cb113a8d5d9b6376f3aa817f32c1078f2343b714fff7d2ca44fdf67d5" +dependencies = [ + "hashbrown 0.16.1", +] + +[[package]] +name = "codespan-reporting" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe6d2e5af09e8c8ad56c969f2157a3d4238cebc7c55f0a517728c38f7b200f81" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + +[[package]] +name = "const-field-offset" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9713489fbc45a2d113f58d17448c73115d533ed27fd2f2d0e5e5c69663eaf19b" +dependencies = [ + "const-field-offset-macro", + "field-offset", +] + +[[package]] +name = "const-field-offset-macro" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b5dc851b7ea80cc4f69aa28632385ffd3e0f88014d53db3f2e5a781896ca783" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "convert_case" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics-types" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.9.4", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" +dependencies = [ + "bitflags 2.11.1", + "core-foundation 0.10.1", + "libc", +] + +[[package]] +name = "core_maths" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30" +dependencies = [ + "libm", +] + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "critical-section" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" + +[[package]] +name = "crossbeam-queue" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "ctor-lite" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e162d0c2e2068eb736b71e5597eff0b9944e6b973cd9f37b6a288ab9bf20e300" + +[[package]] +name = "data-url" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376" + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn", + "unicode-xid", +] + +[[package]] +name = "derive_utils" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "362f47930db19fe7735f527e6595e4900316b893ebf6d48ad3d31be928d57dd6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags 2.11.1", + "objc2", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "dlib" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" +dependencies = [ + "libloading", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "drm" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80bc8c5c6c2941f70a55c15f8d9f00f9710ebda3ffda98075f996a0e6c92756f" +dependencies = [ + "bitflags 2.11.1", + "bytemuck", + "drm-ffi", + "drm-fourcc", + "libc", + "rustix 0.38.44", +] + +[[package]] +name = "drm-ffi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51a91c9b32ac4e8105dec255e849e0d66e27d7c34d184364fb93e469db08f690" +dependencies = [ + "drm-sys", + "rustix 1.1.4", +] + +[[package]] +name = "drm-fourcc" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0aafbcdb8afc29c1a7ee5fbe53b5d62f4565b35a042a662ca9fecd0b54dae6f4" + +[[package]] +name = "drm-sys" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8e1361066d91f5ffccff060a3c3be9c3ecde15be2959c1937595f7a82a9f8" +dependencies = [ + "libc", + "linux-raw-sys 0.9.4", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "euclid" +version = "0.22.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06" +dependencies = [ + "num-traits", +] + +[[package]] +name = "fastrand" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "field-offset" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" +dependencies = [ + "memoffset", + "rustc_version", +] + +[[package]] +name = "filetime" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f98844151eee8917efc50bd9e8318cb963ae8b297431495d3f758616ea5c57db" +dependencies = [ + "cfg-if", + "libc", + "libredox", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "flate2" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "float-cmp" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "font-types" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b38ad915f6dadd993ced50848a8291a543bd41ca62bc10740d5e64e2ab4cfd7" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "fontdb" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "457e789b3d1202543297a350643cf459f836cade38934e7a4cf6a39e7cde2905" +dependencies = [ + "log", + "slotmap", + "tinyvec", + "ttf-parser", +] + +[[package]] +name = "fontique" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23358480a54a886d51b306718d5ca743fdfe238e5df38ef650f4e72f29c5d9e9" +dependencies = [ + "hashbrown 0.16.1", + "linebender_resource_handle", + "memmap2", + "objc2", + "objc2-core-foundation", + "objc2-core-text", + "objc2-foundation", + "parlance", + "read-fonts", + "roxmltree", + "smallvec", + "windows 0.62.2", + "windows-core 0.62.2", + "yeslogic-fontconfig-sys", +] + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "gethostname" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" +dependencies = [ + "rustix 1.1.4", + "windows-link", +] + +[[package]] +name = "getopts" +version = "0.2.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfe4fbac503b8d1f88e6676011885f34b7174f46e59956bba534ba83abded4df" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "gif" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159" +dependencies = [ + "color_quant", + "weezl", +] + +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + +[[package]] +name = "glob" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" + +[[package]] +name = "glow" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "glutin" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12124de845cacfebedff80e877bb37b5b75c34c5a4c89e47e1cdd67fb6041325" +dependencies = [ + "bitflags 2.11.1", + "cfg_aliases", + "cgl", + "dispatch2", + "glutin_egl_sys", + "glutin_glx_sys", + "glutin_wgl_sys", + "libloading", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", + "once_cell", + "raw-window-handle", + "wayland-sys", + "windows-sys 0.52.0", + "x11-dl", +] + +[[package]] +name = "glutin_egl_sys" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4680ba6195f424febdc3ba46e7a42a0e58743f2edb115297b86d7f8ecc02d2" +dependencies = [ + "gl_generator", + "windows-sys 0.52.0", +] + +[[package]] +name = "glutin_glx_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7bb2938045a88b612499fbcba375a77198e01306f52272e692f8c1f3751185" +dependencies = [ + "gl_generator", + "x11-dl", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e" +dependencies = [ + "gl_generator", +] + +[[package]] +name = "gpu-alloc" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171" +dependencies = [ + "bitflags 2.11.1", + "gpu-alloc-types", +] + +[[package]] +name = "gpu-alloc-types" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4" +dependencies = [ + "bitflags 2.11.1", +] + +[[package]] +name = "gpu-allocator" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c151a2a5ef800297b4e79efa4f4bec035c5f51d5ae587287c9b952bdf734cacd" +dependencies = [ + "log", + "presser", + "thiserror 1.0.69", + "windows 0.58.0", +] + +[[package]] +name = "gpu-allocator" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795" +dependencies = [ + "ash", + "hashbrown 0.16.1", + "log", + "presser", + "thiserror 2.0.18", + "windows 0.62.2", +] + +[[package]] +name = "gpu-descriptor" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca" +dependencies = [ + "bitflags 2.11.1", + "gpu-descriptor-types", + "hashbrown 0.15.5", +] + +[[package]] +name = "gpu-descriptor-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91" +dependencies = [ + "bitflags 2.11.1", +] + +[[package]] +name = "grid" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9e2d4c0a8296178d8802098410ca05d86b17a10bb5ab559b3fb404c1f948220" + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "bytemuck", + "cfg-if", + "crunchy", + "num-traits", + "zerocopy", +] + +[[package]] +name = "harfrust" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9da2e5ae821f6e96664977bf974d6d6a2d6682f9ccee23e62ec1d134246845f9" +dependencies = [ + "bitflags 2.11.1", + "bytemuck", + "core_maths", + "read-fonts", + "smallvec", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", +] + +[[package]] +name = "hashbrown" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hexf-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" + +[[package]] +name = "htmlparser" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48ce8546b993eaf241d69ded33b1be6d205dd9857ec879d9d18bd05d3676e144" + +[[package]] +name = "i-slint-common" +version = "1.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40cae5cd0a81ce044029ac303256e025f98a4c59495b5189fc22b588da094e01" +dependencies = [ + "derive_more", + "fontique", + "htmlparser", + "pulldown-cmark", + "skrifa", +] + +[[package]] +name = "i-slint-core" +version = "1.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89e4a57afd78d8a1f599a78781dc1413af68545b2bc5ba5e143ecf022c75d5f3" +dependencies = [ + "auto_enums", + "bitflags 2.11.1", + "cfg-if", + "chrono", + "clru", + "const-field-offset", + "derive_more", + "euclid", + "i-slint-common", + "i-slint-core-macros", + "icu_normalizer", + "image", + "lyon_algorithms", + "lyon_extra", + "lyon_geom", + "lyon_path", + "num-traits", + "once_cell", + "parley", + "pin-project", + "pin-weak", + "portable-atomic", + "raw-window-handle", + "resvg", + "rgb", + "scoped-tls-hkt", + "scopeguard", + "skrifa", + "slab", + "strum", + "sys-locale", + "taffy", + "unicode-linebreak", + "unicode-script", + "unicode-segmentation", + "vtable", + "wasm-bindgen", + "web-sys", + "web-time", + "wgpu 27.0.1", + "wgpu 28.0.0", +] + +[[package]] +name = "i-slint-core-macros" +version = "1.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7931356d5238281e6be994ec15241fb2d9e66359776d53b4bd6b2fdd9c257c6e" +dependencies = [ + "quote", + "serde_json", + "syn", +] + +[[package]] +name = "i-slint-renderer-skia" +version = "1.16.1" +dependencies = [ + "ash", + "bytemuck", + "cfg-if", + "cfg_aliases", + "clru", + "const-field-offset", + "derive_more", + "foreign-types", + "glow", + "glutin", + "i-slint-common", + "i-slint-core", + "i-slint-core-macros", + "lyon_path", + "metal 0.31.0", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", + "objc2-metal", + "objc2-quartz-core", + "pin-weak", + "raw-window-handle", + "raw-window-metal", + "read-fonts", + "scoped-tls-hkt", + "skia-safe", + "softbuffer", + "spin_on", + "unicode-segmentation", + "vtable", + "vulkano", + "wgpu 27.0.1", + "wgpu 28.0.0", + "windows 0.58.0", + "windows 0.62.2", + "windows-core 0.58.0", + "windows-core 0.62.2", + "write-fonts", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core 0.62.2", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5a396343c7208121dc86e35623d3dfe19814a7613cfd14964994cdc9c9a2e26" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_locale_data", + "icu_provider", + "potential_utf", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +dependencies = [ + "displaydoc", + "litemap", + "serde", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locale_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fdcc9ac77c6d74ff5cf6e65ef3181d6af32003b16fce3a77fb451d2f695993" + +[[package]] +name = "icu_normalizer" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" + +[[package]] +name = "icu_properties" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" + +[[package]] +name = "icu_provider" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +dependencies = [ + "displaydoc", + "icu_locale_core", + "serde", + "stable_deref_trait", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_segmenter" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c0794db0b1a86193ac9c48768d0e6c52c54448e0870ad87907d456ee0dac964" +dependencies = [ + "icu_collections", + "icu_locale", + "icu_provider", + "icu_segmenter_data", + "potential_utf", + "utf8_iter", + "zerovec", +] + +[[package]] +name = "icu_segmenter_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a2c462a4d927d512f5f882a033ddd62f33a05bb9f230d98f736ac3dc85938f" + +[[package]] +name = "image" +version = "0.25.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" +dependencies = [ + "bytemuck", + "byteorder-lite", + "moxcms", + "num-traits", + "png", + "zune-core", + "zune-jpeg", +] + +[[package]] +name = "image-webp" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3" +dependencies = [ + "byteorder-lite", + "quick-error", +] + +[[package]] +name = "imagesize" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e54e57b4c48b40f7aec75635392b12b3421fa26fe8b4332e63138ed278459c" + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown 0.17.0", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "js-sys" +version = "0.3.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2964e92d1d9dc3364cae4d718d93f227e3abb088e747d92e0395bfdedf1c12ca" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + +[[package]] +name = "kurbo" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7564e90fe3c0d5771e1f0bc95322b21baaeaa0d9213fa6a0b61c99f8b17b3bfb" +dependencies = [ + "arrayvec", + "euclid", + "smallvec", +] + +[[package]] +name = "libc" +version = "0.2.185" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ff2c0fe9bc6cb6b14a0592c2ff4fa9ceb83eea9db979b0487cd054946a2b8f" + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e02f3bb43d335493c96bf3fd3a321600bf6bd07ed34bc64118e9293bdffea46c" +dependencies = [ + "bitflags 2.11.1", + "libc", + "plain", + "redox_syscall 0.7.4", +] + +[[package]] +name = "linebender_resource_handle" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" + +[[package]] +name = "litrs" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "lyon_algorithms" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9815fac08e6fd96733a11dce4f9d15a3f338e96a2e2311ee21e1b738efc2bc0f" +dependencies = [ + "lyon_path", + "num-traits", +] + +[[package]] +name = "lyon_extra" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7755f08423275157ad1680aaecc9ccb7e0cc633da3240fea2d1522935cc15c72" +dependencies = [ + "lyon_path", + "thiserror 2.0.18", +] + +[[package]] +name = "lyon_geom" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4336502e29e32af93cf2dad2214ed6003c17ceb5bd499df77b1de663b9042b92" +dependencies = [ + "arrayvec", + "euclid", + "num-traits", +] + +[[package]] +name = "lyon_path" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c463f9c428b7fc5ec885dcd39ce4aa61e29111d0e33483f6f98c74e89d8621e" +dependencies = [ + "lyon_geom", + "num-traits", +] + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "memmap2" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714098028fe011992e1c3962653c96b2d578c4b4bce9036e15ff220319b1e0e3" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "metal" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f569fb946490b5743ad69813cb19629130ce9374034abe31614a36402d18f99e" +dependencies = [ + "bitflags 2.11.1", + "block", + "core-graphics-types 0.1.3", + "foreign-types", + "log", + "objc", + "paste", +] + +[[package]] +name = "metal" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00c15a6f673ff72ddcc22394663290f870fb224c1bfce55734a75c414150e605" +dependencies = [ + "bitflags 2.11.1", + "block", + "core-graphics-types 0.2.0", + "foreign-types", + "log", + "objc", + "paste", +] + +[[package]] +name = "metal" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7047791b5bc903b8cd963014b355f71dc9864a9a0b727057676c1dcae5cbc15" +dependencies = [ + "bitflags 2.11.1", + "block", + "core-graphics-types 0.2.0", + "foreign-types", + "log", + "objc", + "paste", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "moxcms" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" +dependencies = [ + "num-traits", + "pxfm", +] + +[[package]] +name = "naga" +version = "27.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "066cf25f0e8b11ee0df221219010f213ad429855f57c494f995590c861a9a7d8" +dependencies = [ + "arrayvec", + "bit-set", + "bitflags 2.11.1", + "cfg-if", + "cfg_aliases", + "codespan-reporting", + "half", + "hashbrown 0.16.1", + "hexf-parse", + "indexmap", + "libm", + "log", + "num-traits", + "once_cell", + "rustc-hash 1.1.0", + "spirv", + "thiserror 2.0.18", + "unicode-ident", +] + +[[package]] +name = "naga" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "618f667225063219ddfc61251087db8a9aec3c3f0950c916b614e403486f1135" +dependencies = [ + "arrayvec", + "bit-set", + "bitflags 2.11.1", + "cfg-if", + "cfg_aliases", + "codespan-reporting", + "half", + "hashbrown 0.16.1", + "hexf-parse", + "indexmap", + "libm", + "log", + "num-traits", + "once_cell", + "rustc-hash 1.1.0", + "spirv", + "thiserror 2.0.18", + "unicode-ident", +] + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags 2.11.1", + "jni-sys 0.3.1", + "log", + "ndk-sys", + "num_enum", + "raw-window-handle", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", +] + +[[package]] +name = "objc2" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-app-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" +dependencies = [ + "bitflags 2.11.1", + "objc2", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.11.1", + "dispatch2", + "objc2", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "bitflags 2.11.1", + "dispatch2", + "objc2", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-core-text" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" +dependencies = [ + "bitflags 2.11.1", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags 2.11.1", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags 2.11.1", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-metal" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" +dependencies = [ + "bitflags 2.11.1", + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +dependencies = [ + "bitflags 2.11.1", + "objc2", + "objc2-core-foundation", + "objc2-foundation", + "objc2-metal", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" +dependencies = [ + "critical-section", + "portable-atomic", +] + +[[package]] +name = "ordered-float" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7d950ca161dc355eaf28f82b11345ed76c6e1f6eb1f4f4479e0323b9e2fbd0e" +dependencies = [ + "num-traits", +] + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.18", + "smallvec", + "windows-link", +] + +[[package]] +name = "parlance" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b6937eda350acc1a5d05872c3cbf99fe78619c269096e2be3d4a350058639d5" + +[[package]] +name = "parley" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6c00ec192e1a402861526eff91a4b4690a2e5a17a4ae2deb772d72b49daf868" +dependencies = [ + "fontique", + "harfrust", + "hashbrown 0.16.1", + "icu_normalizer", + "icu_properties", + "icu_segmenter", + "linebender_resource_handle", + "parlance", + "parley_data", + "skrifa", +] + +[[package]] +name = "parley_data" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "232313eddc02ac27f015e8f8eeb7facce8a896116df7e3eda1bfd9f600a9a39d" +dependencies = [ + "icu_properties", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pico-args" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" + +[[package]] +name = "pin-project" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1749c7ed4bcaf4c3d0a3efc28538844fb29bcdd7d2b67b2be7e20ba861ff517" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b20ed30f105399776b9c883e68e536ef602a16ae6f596d2c473591d6ad64c6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pin-weak" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b330c9d1b92dfe68442ca20b009c717d5f0b1e3cf4965e62f704c3c6e95a1305" + +[[package]] +name = "pkg-config" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" + +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + +[[package]] +name = "png" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" +dependencies = [ + "bitflags 2.11.1", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide", +] + +[[package]] +name = "portable-atomic" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" +dependencies = [ + "critical-section", +] + +[[package]] +name = "portable-atomic-util" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "091397be61a01d4be58e7841595bd4bfedb15f1cd54977d79b8271e94ed799a3" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "potential_utf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" +dependencies = [ + "serde_core", + "writeable", + "zerovec", +] + +[[package]] +name = "presser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "profiling" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3eb8486b569e12e2c32ad3e204dbaba5e4b5b216e9367044f25f1dba42341773" + +[[package]] +name = "pulldown-cmark" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c3a14896dfa883796f1cb410461aef38810ea05f2b2c33c5aded3649095fdad" +dependencies = [ + "bitflags 2.11.1", + "getopts", + "memchr", + "pulldown-cmark-escape", + "unicase", +] + +[[package]] +name = "pulldown-cmark-escape" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "007d8adb5ddab6f8e3f491ac63566a7d5002cc7ed73901f72057943fa71ae1ae" + +[[package]] +name = "pxfm" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5a041e753da8b807c9255f28de81879c78c876392ff2469cde94799b2896b9d" + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + +[[package]] +name = "quick-xml" +version = "0.39.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "958f21e8e7ceb5a1aa7fa87fab28e7c75976e0bfe7e23ff069e0a260f894067d" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "range-alloc" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "raw-window-metal" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135" +dependencies = [ + "objc2", + "objc2-core-foundation", + "objc2-foundation", + "objc2-quartz-core", +] + +[[package]] +name = "read-fonts" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b634fabf032fab15307ffd272149b622260f55974d9fad689292a5d33df02e5" +dependencies = [ + "bytemuck", + "core_maths", + "font-types", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.11.1", +] + +[[package]] +name = "redox_syscall" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f450ad9c3b1da563fb6948a8e0fb0fb9269711c9c73d9ea1de5058c79c8d643a" +dependencies = [ + "bitflags 2.11.1", +] + +[[package]] +name = "regex" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" + +[[package]] +name = "renderdoc-sys" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" + +[[package]] +name = "resvg" +version = "0.47.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9be183ad6a216aa96f33e4c8033b0988b8b3ea6fd2359d19af5bac4643fd8e81" +dependencies = [ + "gif", + "image-webp", + "log", + "pico-args", + "rgb", + "svgtypes", + "tiny-skia", + "usvg", + "zune-jpeg", +] + +[[package]] +name = "rgb" +version = "0.8.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "roxmltree" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1964b10c76125c36f8afe190065a4bf9a87bf324842c05701330bba9f1cacbb" +dependencies = [ + "memchr", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hash" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.11.1", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +dependencies = [ + "bitflags 2.11.1", + "errno", + "libc", + "linux-raw-sys 0.12.1", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "rustybuzz" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3c7c96f8a08ee34eff8857b11b49b07d71d1c3f4e88f8a88d4c9e9f90b1702" +dependencies = [ + "bitflags 2.11.1", + "bytemuck", + "core_maths", + "log", + "smallvec", + "ttf-parser", + "unicode-bidi-mirroring", + "unicode-ccc", + "unicode-properties", + "unicode-script", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scoped-tls-hkt" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9603871ffe5df3ac39cb624790c296dbd47a400d202f56bf3e414045099524d" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_spanned" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" +dependencies = [ + "serde_core", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "simd-adler32" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" + +[[package]] +name = "simplecss" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9c6883ca9c3c7c90e888de77b7a5c849c779d25d74a1269b0218b14e8b136c" +dependencies = [ + "log", +] + +[[package]] +name = "siphasher" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e" + +[[package]] +name = "skia-bindings" +version = "0.90.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6f96e00735f14a781aac8a6870c862b8cc831df6d8e4ad77ab78e11411b9af" +dependencies = [ + "bindgen", + "cc", + "flate2", + "heck 0.5.0", + "pkg-config", + "regex", + "serde_json", + "tar", + "toml", +] + +[[package]] +name = "skia-safe" +version = "0.90.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a71c01d325d40b1031dee67d251a5e0132e79e2a9ec272149a4f4a0d4b8b3be" +dependencies = [ + "bitflags 2.11.1", + "skia-bindings", + "windows 0.62.2", +] + +[[package]] +name = "skrifa" +version = "0.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fbdfe3d2475fbd7ddd1f3e5cf8288a30eb3e5f95832829570cd88115a7434ac" +dependencies = [ + "bytemuck", + "read-fonts", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "slabbin" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9db491c0d4152a069911a0fbdaca959691bf0b9d7110d98a7ed1c8e59b79ab30" + +[[package]] +name = "slotmap" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" +dependencies = [ + "version_check", +] + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "softbuffer" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aac18da81ebbf05109ab275b157c22a653bb3c12cf884450179942f81bcbf6c3" +dependencies = [ + "as-raw-xcb-connection", + "bytemuck", + "drm", + "fastrand", + "js-sys", + "memmap2", + "ndk", + "objc2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "objc2-quartz-core", + "raw-window-handle", + "redox_syscall 0.5.18", + "rustix 1.1.4", + "tiny-xlib", + "tracing", + "wasm-bindgen", + "wayland-backend", + "wayland-client", + "wayland-sys", + "web-sys", + "windows-sys 0.61.2", + "x11rb", +] + +[[package]] +name = "spin_on" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "076e103ed41b9864aa838287efe5f4e3a7a0362dd00671ae62a212e5e4612da2" +dependencies = [ + "pin-utils", +] + +[[package]] +name = "spirv" +version = "0.3.0+sdk-1.3.268.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" +dependencies = [ + "bitflags 2.11.1", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strict-num" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" +dependencies = [ + "float-cmp", +] + +[[package]] +name = "strum" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "svgtypes" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "695b5790b3131dafa99b3bbfd25a216edb3d216dad9ca208d4657bfb8f2abc3d" +dependencies = [ + "kurbo", + "siphasher", +] + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sys-locale" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4" +dependencies = [ + "js-sys", + "libc", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "taffy" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41ba83ebaf2954d31d05d67340fd46cebe99da2b7133b0dd68d70c65473a437b" +dependencies = [ + "arrayvec", + "grid", + "serde", + "slotmap", +] + +[[package]] +name = "tar" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22692a6476a21fa75fdfc11d452fda482af402c008cdbaf3476414e122040973" +dependencies = [ + "filetime", + "libc", + "xattr", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl 2.0.18", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "tiny-skia" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47ffee5eaaf5527f630fb0e356b90ebdec84d5d18d937c5e440350f88c5a91ea" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "log", + "png", + "tiny-skia-path", +] + +[[package]] +name = "tiny-skia-path" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edca365c3faccca67d06593c5980fa6c57687de727a03131735bb85f01fdeeb9" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", +] + +[[package]] +name = "tiny-xlib" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0324504befd01cab6e0c994f34b2ffa257849ee019d3fb3b64fb2c858887d89e" +dependencies = [ + "as-raw-xcb-connection", + "ctor-lite", + "libloading", + "pkg-config", + "tracing", +] + +[[package]] +name = "tinystr" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +dependencies = [ + "displaydoc", + "serde_core", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "toml" +version = "0.9.12+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned", + "toml_datetime 0.7.5+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow 0.7.15", +] + +[[package]] +name = "toml_datetime" +version = "0.7.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_datetime" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.25.11+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b59c4d22ed448339746c59b905d24568fcbb3ab65a500494f7b8c3e97739f2b" +dependencies = [ + "indexmap", + "toml_datetime 1.1.1+spec-1.1.0", + "toml_parser", + "winnow 1.0.1", +] + +[[package]] +name = "toml_parser" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" +dependencies = [ + "winnow 1.0.1", +] + +[[package]] +name = "toml_writer" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" + +[[package]] +name = "ttf-parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" +dependencies = [ + "core_maths", +] + +[[package]] +name = "unicase" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" + +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + +[[package]] +name = "unicode-bidi-mirroring" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfa6e8c60bb66d49db113e0125ee8711b7647b5579dc7f5f19c42357ed039fe" + +[[package]] +name = "unicode-ccc" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce61d488bcdc9bc8b5d1772c404828b17fc481c0a582b5581e95fb233aef503e" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-linebreak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" + +[[package]] +name = "unicode-properties" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" + +[[package]] +name = "unicode-script" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "383ad40bb927465ec0ce7720e033cb4ca06912855fc35db31b5755d0de75b1ee" + +[[package]] +name = "unicode-segmentation" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9629274872b2bfaf8d66f5f15725007f635594914870f65218920345aa11aa8c" + +[[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.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "usvg" +version = "0.47.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d46cf96c5f498d36b7a9693bc6a7075c0bb9303189d61b2249b0dc3d309c07de" +dependencies = [ + "base64", + "data-url", + "flate2", + "fontdb", + "imagesize", + "kurbo", + "log", + "pico-args", + "roxmltree", + "rustybuzz", + "simplecss", + "siphasher", + "strict-num", + "svgtypes", + "tiny-skia-path", + "ttf-parser", + "unicode-bidi", + "unicode-script", + "unicode-vo", + "xmlwriter", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vk-parse" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3859da4d7b98bec73e68fb65815d47a263819c415c90eed42b80440a02cbce8c" +dependencies = [ + "xml-rs", +] + +[[package]] +name = "vtable" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ea953f65593feb5287b022b83c35046d1ff49c7417b6f5851a079d8a231fe31" +dependencies = [ + "const-field-offset", + "portable-atomic", + "stable_deref_trait", + "vtable-macro", +] + +[[package]] +name = "vtable-macro" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "482a37f9777480673d3a99c80ac2edc69f92382230440946855fa27ebc47cba6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "vulkano" +version = "0.35.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee487adf7c13e5aa46d4d7fac6ffb8e172eb7e6472aaf815e9ade4992f8f2414" +dependencies = [ + "ash", + "bytemuck", + "crossbeam-queue", + "foldhash 0.1.5", + "half", + "heck 0.4.1", + "indexmap", + "libloading", + "nom", + "once_cell", + "parking_lot", + "proc-macro2", + "quote", + "raw-window-handle", + "raw-window-metal", + "serde", + "serde_json", + "slabbin", + "smallvec", + "thread_local", + "vk-parse", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf938a0bacb0469e83c1e148908bd7d5a6010354cf4fb73279b7447422e3a89" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeff24f84126c0ec2db7a449f0c2ec963c6a49efe0698c4242929da037ca28ed" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d08065faf983b2b80a79fd87d8254c409281cf7de75fc4b773019824196c904" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd04d9e306f1907bd13c6361b5c6bfc7b3b3c095ed3f8a9246390f8dbdee129" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wayland-backend" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2857dd20b54e916ec7253b3d6b4d5c4d7d4ca2c33c2e11c6c76a99bd8744755d" +dependencies = [ + "cc", + "downcast-rs", + "rustix 1.1.4", + "scoped-tls", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-client" +version = "0.31.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645c7c96bb74690c3189b5c9cb4ca1627062bb23693a4fad9d8c3de958260144" +dependencies = [ + "bitflags 2.11.1", + "rustix 1.1.4", + "wayland-backend", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.31.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c324a910fd86ebdc364a3e61ec1f11737d3b1d6c273c0239ee8ff4bc0d24b4a" +dependencies = [ + "proc-macro2", + "quick-xml", + "quote", +] + +[[package]] +name = "wayland-sys" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be" +dependencies = [ + "dlib", + "log", + "once_cell", + "pkg-config", +] + +[[package]] +name = "web-sys" +version = "0.3.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f2dfbb17949fa2088e5d39408c48368947b86f7834484e87b73de55bc14d97d" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "weezl" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" + +[[package]] +name = "wgpu" +version = "27.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfe68bac7cde125de7a731c3400723cadaaf1703795ad3f4805f187459cd7a77" +dependencies = [ + "arrayvec", + "bitflags 2.11.1", + "cfg-if", + "cfg_aliases", + "document-features", + "hashbrown 0.16.1", + "log", + "portable-atomic", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wgpu-core 27.0.3", + "wgpu-hal 27.0.4", + "wgpu-types 27.0.1", +] + +[[package]] +name = "wgpu" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9cb534d5ffd109c7d1135f34cdae29e60eab94855a625dcfe1705f8bc7ad79f" +dependencies = [ + "arrayvec", + "bitflags 2.11.1", + "bytemuck", + "cfg-if", + "cfg_aliases", + "document-features", + "hashbrown 0.16.1", + "log", + "portable-atomic", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wgpu-core 28.0.1", + "wgpu-hal 28.0.1", + "wgpu-types 28.0.0", +] + +[[package]] +name = "wgpu-core" +version = "27.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27a75de515543b1897b26119f93731b385a19aea165a1ec5f0e3acecc229cae7" +dependencies = [ + "arrayvec", + "bit-set", + "bit-vec", + "bitflags 2.11.1", + "bytemuck", + "cfg_aliases", + "document-features", + "hashbrown 0.16.1", + "indexmap", + "log", + "naga 27.0.3", + "once_cell", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "rustc-hash 1.1.0", + "smallvec", + "thiserror 2.0.18", + "wgpu-core-deps-apple 27.0.0", + "wgpu-core-deps-windows-linux-android 27.0.0", + "wgpu-hal 27.0.4", + "wgpu-types 27.0.1", +] + +[[package]] +name = "wgpu-core" +version = "28.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d23f4642f53f666adcfd2d3218ab174d1e6681101aef18696b90cbe64d1c10f9" +dependencies = [ + "arrayvec", + "bit-set", + "bit-vec", + "bitflags 2.11.1", + "bytemuck", + "cfg_aliases", + "document-features", + "hashbrown 0.16.1", + "indexmap", + "log", + "naga 28.0.0", + "once_cell", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "rustc-hash 1.1.0", + "smallvec", + "thiserror 2.0.18", + "wgpu-core-deps-apple 28.0.0", + "wgpu-core-deps-windows-linux-android 28.0.0", + "wgpu-hal 28.0.1", + "wgpu-types 28.0.0", +] + +[[package]] +name = "wgpu-core-deps-apple" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0772ae958e9be0c729561d5e3fd9a19679bcdfb945b8b1a1969d9bfe8056d233" +dependencies = [ + "wgpu-hal 27.0.4", +] + +[[package]] +name = "wgpu-core-deps-apple" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87b7b696b918f337c486bf93142454080a32a37832ba8a31e4f48221890047da" +dependencies = [ + "wgpu-hal 28.0.1", +] + +[[package]] +name = "wgpu-core-deps-windows-linux-android" +version = "27.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71197027d61a71748e4120f05a9242b2ad142e3c01f8c1b47707945a879a03c3" +dependencies = [ + "wgpu-hal 27.0.4", +] + +[[package]] +name = "wgpu-core-deps-windows-linux-android" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68ca976e72b2c9964eb243e281f6ce7f14a514e409920920dcda12ae40febaae" +dependencies = [ + "wgpu-hal 28.0.1", +] + +[[package]] +name = "wgpu-hal" +version = "27.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b21cb61c57ee198bc4aff71aeadff4cbb80b927beb912506af9c780d64313ce" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set", + "bitflags 2.11.1", + "block", + "bytemuck", + "cfg-if", + "cfg_aliases", + "core-graphics-types 0.2.0", + "gpu-alloc", + "gpu-allocator 0.27.0", + "gpu-descriptor", + "hashbrown 0.16.1", + "libc", + "libloading", + "log", + "metal 0.32.0", + "naga 27.0.3", + "objc", + "once_cell", + "ordered-float", + "parking_lot", + "portable-atomic", + "portable-atomic-util", + "profiling", + "range-alloc", + "raw-window-handle", + "renderdoc-sys", + "smallvec", + "thiserror 2.0.18", + "wgpu-types 27.0.1", + "windows 0.58.0", + "windows-core 0.58.0", +] + +[[package]] +name = "wgpu-hal" +version = "28.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d6cb474beb218824dcc9e1ce679d973f719262789bfb27407da560cac20eeb" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set", + "bitflags 2.11.1", + "block", + "bytemuck", + "cfg-if", + "cfg_aliases", + "core-graphics-types 0.2.0", + "gpu-allocator 0.28.0", + "gpu-descriptor", + "hashbrown 0.16.1", + "libc", + "libloading", + "log", + "metal 0.33.0", + "naga 28.0.0", + "objc", + "once_cell", + "ordered-float", + "parking_lot", + "portable-atomic", + "portable-atomic-util", + "profiling", + "range-alloc", + "raw-window-handle", + "renderdoc-sys", + "smallvec", + "thiserror 2.0.18", + "wgpu-types 28.0.0", + "windows 0.62.2", + "windows-core 0.62.2", +] + +[[package]] +name = "wgpu-types" +version = "27.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afdcf84c395990db737f2dd91628706cb31e86d72e53482320d368e52b5da5eb" +dependencies = [ + "bitflags 2.11.1", + "bytemuck", + "log", +] + +[[package]] +name = "wgpu-types" +version = "28.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e18308757e594ed2cd27dddbb16a139c42a683819d32a2e0b1b0167552f5840c" +dependencies = [ + "bitflags 2.11.1", + "bytemuck", + "log", +] + +[[package]] +name = "windows" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" +dependencies = [ + "windows-core 0.58.0", + "windows-targets", +] + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core 0.62.2", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core 0.62.2", +] + +[[package]] +name = "windows-core" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" +dependencies = [ + "windows-implement 0.58.0", + "windows-interface 0.58.0", + "windows-result 0.2.0", + "windows-strings 0.1.0", + "windows-targets", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement 0.60.2", + "windows-interface 0.59.3", + "windows-link", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core 0.62.2", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core 0.62.2", + "windows-link", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result 0.2.0", + "windows-targets", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" + +[[package]] +name = "winnow" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09dac053f1cd375980747450bfc7250c264eaae0583872e845c0c7cd578872b5" +dependencies = [ + "memchr", +] + +[[package]] +name = "write-fonts" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f12725b0845073e20b04e79b500dbfb465904d7cbd84883a1f1bbd084debc515" +dependencies = [ + "font-types", + "indexmap", + "kurbo", + "log", + "read-fonts", +] + +[[package]] +name = "writeable" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "x11rb" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414" +dependencies = [ + "as-raw-xcb-connection", + "gethostname", + "libc", + "libloading", + "once_cell", + "rustix 1.1.4", + "x11rb-protocol", +] + +[[package]] +name = "x11rb-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" + +[[package]] +name = "xattr" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156" +dependencies = [ + "libc", + "rustix 1.1.4", +] + +[[package]] +name = "xml-rs" +version = "0.8.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ae8337f8a065cfc972643663ea4279e04e7256de865aa66fe25cec5fb912d3f" + +[[package]] +name = "xmlwriter" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" + +[[package]] +name = "yeslogic-fontconfig-sys" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "503a066b4c037c440169d995b869046827dbc71263f6e8f3be6d77d4f3229dbd" +dependencies = [ + "dlib", + "once_cell", + "pkg-config", +] + +[[package]] +name = "yoke" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69faa1f2a1ea75661980b013019ed6687ed0e83d069bc1114e2cc74c6c04c4df" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "zerovec" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +dependencies = [ + "serde", + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" + +[[package]] +name = "zune-core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb8a0807f7c01457d0379ba880ba6322660448ddebc890ce29bb64da71fb40f9" + +[[package]] +name = "zune-jpeg" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296" +dependencies = [ + "zune-core", +] diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/Cargo.toml b/crates/vendor/i-slint-renderer-skia-1.16.1/Cargo.toml new file mode 100644 index 000000000..7638d1289 --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/Cargo.toml @@ -0,0 +1,369 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies. +# +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. + +[package] +edition = "2024" +rust-version = "1.88" +name = "i-slint-renderer-skia" +version = "1.16.1" +authors = ["Slint Developers "] +build = "build.rs" +autolib = false +autobins = false +autoexamples = false +autotests = false +autobenches = false +description = "Skia based renderer for Slint" +homepage = "https://slint.dev" +readme = "README.md" +license = "GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0" +repository = "https://github.com/slint-ui/slint" + +[package.metadata.docs.rs] +rustdoc-args = ["--generate-link-to-definition"] + +[features] +default = ["softbuffer"] +kms = ["softbuffer/kms"] +opengl = [] +unstable-wgpu-27 = [ + "i-slint-core/unstable-wgpu-27", + "wgpu-27", +] +unstable-wgpu-28 = [ + "i-slint-core/unstable-wgpu-28", + "wgpu-28", +] +vulkan = [ + "skia-safe/vulkan", + "dep:ash", + "vulkano", +] +wayland = [ + "glutin/wayland", + "softbuffer/wayland", + "softbuffer/wayland-dlopen", +] +wgpu-27 = [ + "i-slint-core/wgpu-27", + "dep:wgpu-27", + "dep:spin_on", + "dep:metal", + "dep:foreign-types", + "dep:ash", + "dep:windows_58", + "dep:windows-core", + "dep:windows-core_58", +] +wgpu-28 = [ + "i-slint-core/wgpu-28", + "dep:wgpu-28", + "dep:spin_on", + "dep:metal", + "dep:foreign-types", + "dep:ash", + "dep:windows-core", +] +x11 = [ + "glutin/x11", + "glutin/glx", + "softbuffer/x11", + "softbuffer/x11-dlopen", +] + +[lib] +name = "i_slint_renderer_skia" +path = "lib.rs" + +[dependencies.ash] +version = "^0.38.0" +optional = true + +[dependencies.cfg-if] +version = "1" + +[dependencies.clru] +version = "0.6.0" + +[dependencies.const-field-offset] +version = "0.2" + +[dependencies.derive_more] +version = "2.0.0" +features = [ + "deref", + "deref_mut", + "into", + "from", + "add", + "add_assign", + "mul", + "not", + "display", +] +default-features = false + +[dependencies.glow] +version = "0.17" + +[dependencies.i-slint-common] +version = "=1.16.1" +features = ["default"] +default-features = false + +[dependencies.i-slint-core] +version = "=1.16.1" +features = [ + "default", + "box-shadow-cache", + "shared-parley", +] +default-features = false + +[dependencies.i-slint-core-macros] +version = "=1.16.1" +features = ["default"] +default-features = false + +[dependencies.lyon_path] +version = "1.0" +default-features = false + +[dependencies.pin-weak] +version = "1" + +[dependencies.raw-window-handle] +version = "0.6" +features = ["std"] + +[dependencies.scoped-tls-hkt] +version = "0.1" + +[dependencies.skia-safe] +version = "0.90" +features = ["gl"] + +[dependencies.spin_on] +version = "0.1" +optional = true + +[dependencies.unicode-segmentation] +version = "1.12.0" + +[dependencies.vtable] +version = "0.4" + +[dependencies.vulkano] +version = "0.35.0" +optional = true +default-features = false + +[dependencies.wgpu-27] +version = "27" +optional = true +default-features = false +package = "wgpu" + +[dependencies.wgpu-28] +version = "28" +optional = true +default-features = false +package = "wgpu" + +[build-dependencies.cfg_aliases] +version = "0.2.0" + +[target.aarch64-apple-ios-sim.dependencies.objc2] +version = "0.6.0" +features = ["disable-encoding-assertions"] + +[target.'cfg(any(not(target_vendor = "apple"), target_os = "macos"))'.dependencies.glutin] +version = "0.32.0" +features = [ + "egl", + "wgl", +] +default-features = false + +[target.'cfg(any(target_os = "ios", target_os="macos", target_os="windows", target_os="android", target_os="linux"))'.dependencies.skia-safe] +version = "0.90" +features = ["textlayout"] + +[target.'cfg(not(any(target_vendor = "apple", target_family = "windows")))'.dependencies.skia-safe] +version = "0.90" +features = [ + "gl", + "vulkan", +] + +[target.'cfg(not(any(target_vendor = "apple", target_family = "windows")))'.dependencies.wgpu-27] +version = "27" +features = ["vulkan"] +optional = true +default-features = false +package = "wgpu" + +[target.'cfg(not(any(target_vendor = "apple", target_family = "windows")))'.dependencies.wgpu-28] +version = "28" +features = ["vulkan"] +optional = true +default-features = false +package = "wgpu" + +[target.'cfg(not(target_os = "android"))'.dependencies.bytemuck] +version = "1.13.1" + +[target.'cfg(not(target_os = "android"))'.dependencies.softbuffer] +version = "0.4.4" +optional = true +default-features = false + +[target.'cfg(target_family = "windows")'.dependencies.skia-safe] +version = "0.90" +features = ["d3d"] + +[target.'cfg(target_family = "windows")'.dependencies.wgpu-27] +version = "27" +features = ["dx12"] +optional = true +default-features = false +package = "wgpu" + +[target.'cfg(target_family = "windows")'.dependencies.wgpu-28] +version = "28" +features = ["dx12"] +optional = true +default-features = false +package = "wgpu" + +[target.'cfg(target_family = "windows")'.dependencies.windows] +version = "0.62" +features = [ + "Win32", + "Win32_System_Com", + "Win32_Graphics", + "Win32_Graphics_Dxgi", + "Win32_Graphics_Direct3D12", + "Win32_Graphics_Direct3D", + "Win32_Foundation", + "Win32_Graphics_Dxgi_Common", + "Win32_System_Threading", + "Win32_Security", +] + +[target.'cfg(target_family = "windows")'.dependencies.windows-core] +version = "0.62.0" +optional = true + +[target.'cfg(target_family = "windows")'.dependencies.windows-core_58] +version = "0.58.0" +optional = true +package = "windows-core" + +[target.'cfg(target_family = "windows")'.dependencies.windows_58] +version = "0.58.0" +features = [ + "Win32", + "Win32_System_Com", + "Win32_Graphics", + "Win32_Graphics_Dxgi", + "Win32_Graphics_Direct3D12", + "Win32_Graphics_Direct3D", + "Win32_Foundation", + "Win32_Graphics_Dxgi_Common", + "Win32_System_Threading", + "Win32_Security", +] +optional = true +package = "windows" + +[target.'cfg(target_vendor = "apple")'.dependencies.foreign-types] +version = "0.5.0" +optional = true + +[target.'cfg(target_vendor = "apple")'.dependencies.metal] +version = "0.31" +optional = true + +[target.'cfg(target_vendor = "apple")'.dependencies.objc2] +version = "0.6.0" + +[target.'cfg(target_vendor = "apple")'.dependencies.objc2-app-kit] +version = "0.3.2" +features = [ + "std", + "NSResponder", + "NSView", +] +default-features = false + +[target.'cfg(target_vendor = "apple")'.dependencies.objc2-core-foundation] +version = "0.3.2" +features = ["CFCGTypes"] +default-features = false + +[target.'cfg(target_vendor = "apple")'.dependencies.objc2-foundation] +version = "0.3.2" +features = [ + "std", + "NSGeometry", +] +default-features = false + +[target.'cfg(target_vendor = "apple")'.dependencies.objc2-metal] +version = "0.3.2" +features = [ + "std", + "MTLCommandQueue", + "MTLCommandBuffer", + "MTLResource", + "MTLTexture", + "MTLTypes", +] +default-features = false + +[target.'cfg(target_vendor = "apple")'.dependencies.objc2-quartz-core] +version = "0.3.2" +features = [ + "std", + "objc2-metal", + "CALayer", + "CAMetalLayer", + "objc2-core-foundation", +] +default-features = false + +[target.'cfg(target_vendor = "apple")'.dependencies.raw-window-metal] +version = "1.0" + +[target.'cfg(target_vendor = "apple")'.dependencies.read-fonts] +version = "0.37" + +[target.'cfg(target_vendor = "apple")'.dependencies.skia-safe] +version = "0.90" +features = ["metal"] + +[target.'cfg(target_vendor = "apple")'.dependencies.wgpu-27] +version = "27" +features = ["metal"] +optional = true +default-features = false +package = "wgpu" + +[target.'cfg(target_vendor = "apple")'.dependencies.wgpu-28] +version = "28" +features = ["metal"] +optional = true +default-features = false +package = "wgpu" + +[target.'cfg(target_vendor = "apple")'.dependencies.write-fonts] +version = "0.45" diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/Cargo.toml.orig b/crates/vendor/i-slint-renderer-skia-1.16.1/Cargo.toml.orig new file mode 100644 index 000000000..03a59d911 --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/Cargo.toml.orig @@ -0,0 +1,135 @@ +# Copyright © SixtyFPS GmbH +# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +[package] +name = "i-slint-renderer-skia" +description = "Skia based renderer for Slint" +authors.workspace = true +edition = "2024" +homepage.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true +version.workspace = true +build = "build.rs" + +[lib] +path = "lib.rs" + +# Note, these features need to be kept in sync (along with their defaults) in +# the C++ crate's CMakeLists.txt +[features] +wayland = ["glutin/wayland", "softbuffer/wayland", "softbuffer/wayland-dlopen"] +x11 = ["glutin/x11", "glutin/glx", "softbuffer/x11", "softbuffer/x11-dlopen"] +opengl = [] +vulkan = ["skia-safe/vulkan", "dep:ash", "vulkano"] +kms = ["softbuffer/kms"] +# wgpu-{27,28} enables the wgpu surface module for internal use (e.g. linuxkms DRM rendering). +# unstable-wgpu-* additionally exposes public API integration (GraphicsAPI, texture import). +wgpu-27 = [ + "i-slint-core/wgpu-27", + "dep:wgpu-27", + "dep:spin_on", + "dep:metal", + "dep:foreign-types", + "dep:ash", + "dep:windows_58", + "dep:windows-core", + "dep:windows-core_58", +] +unstable-wgpu-27 = ["i-slint-core/unstable-wgpu-27", "wgpu-27"] +wgpu-28 = [ + "i-slint-core/wgpu-28", + "dep:wgpu-28", + "dep:spin_on", + "dep:metal", + "dep:foreign-types", + "dep:ash", + "dep:windows-core", +] +unstable-wgpu-28 = ["i-slint-core/unstable-wgpu-28", "wgpu-28"] +default = ["softbuffer"] + +[dependencies] +i-slint-core = { workspace = true, features = ["default", "box-shadow-cache", "shared-parley"] } +i-slint-core-macros = { workspace = true, features = ["default"] } +i-slint-common = { workspace = true, features = ["default"] } + +const-field-offset = { version = "0.2", path = "../../../helper_crates/const-field-offset" } +vtable = { workspace = true } + +cfg-if = "1" +derive_more = { workspace = true } +lyon_path = { workspace = true } +pin-weak = "1" +scoped-tls-hkt = "0.1" +raw-window-handle = { version = "0.6", features = ["std"] } +clru = { workspace = true } + +skia-safe = { version = "0.90", features = ["gl"] } +glow = { workspace = true } +unicode-segmentation = { workspace = true } + +ash = { version = "^0.38.0", optional = true } +vulkano = { version = "0.35.0", optional = true, default-features = false } + +wgpu-27 = { workspace = true, optional = true } +wgpu-28 = { workspace = true, optional = true } +spin_on = { version = "0.1", optional = true } + +[target.'cfg(any(not(target_vendor = "apple"), target_os = "macos"))'.dependencies] +glutin = { workspace = true, default-features = false, features = ["egl", "wgl"] } + +[target.'cfg(not(target_os = "android"))'.dependencies] +# software renderer fallback +softbuffer = { workspace = true, default-features = false, optional = true } +bytemuck = { workspace = true } + +[target.'cfg(target_family = "windows")'.dependencies] +windows = { workspace = true, features = ["Win32", "Win32_System_Com", "Win32_Graphics", "Win32_Graphics_Dxgi", "Win32_Graphics_Direct3D12", "Win32_Graphics_Direct3D", "Win32_Foundation", "Win32_Graphics_Dxgi_Common", "Win32_System_Threading", "Win32_Security"] } +# Separate builds of the windows crate are needed until https://github.com/gfx-rs/wgpu/pull/6876 is +# merged and released. +windows_58 = { package = "windows", version = "0.58.0", optional = true, features = ["Win32", "Win32_System_Com", "Win32_Graphics", "Win32_Graphics_Dxgi", "Win32_Graphics_Direct3D12", "Win32_Graphics_Direct3D", "Win32_Foundation", "Win32_Graphics_Dxgi_Common", "Win32_System_Threading", "Win32_Security"] } +windows-core = { workspace = true, optional = true } +windows-core_58 = { package = "windows-core", version = "0.58.0", optional = true } +skia-safe = { version = "0.90", features = ["d3d"] } +wgpu-27 = { workspace = true, optional = true, features = ["dx12"] } +wgpu-28 = { workspace = true, optional = true, features = ["dx12"] } + +[target.'cfg(target_vendor = "apple")'.dependencies] +objc2 = { version = "0.6.0" } +objc2-metal = { version = "0.3.2", default-features = false, features = ["std", "MTLCommandQueue", "MTLCommandBuffer", "MTLResource", "MTLTexture", "MTLTypes"] } +objc2-foundation = { version = "0.3.2", default-features = false, features = ["std", "NSGeometry"] } +objc2-quartz-core = { version = "0.3.2", default-features = false, features = ["std", "objc2-metal", "CALayer", "CAMetalLayer", "objc2-core-foundation"] } +objc2-app-kit = { version = "0.3.2", default-features = false, features = ["std", "NSResponder", "NSView"] } +objc2-core-foundation = { version = "0.3.2", default-features = false, features = ["CFCGTypes"] } +skia-safe = { version = "0.90", features = ["metal"] } +raw-window-metal = "1.0" + +metal = { version = "0.31", optional = true } +foreign-types = { version = "0.5.0", optional = true } +wgpu-27 = { workspace = true, optional = true, features = ["metal"] } +wgpu-28 = { workspace = true, optional = true, features = ["metal"] } + +read-fonts = { workspace = true } +# Pinned to 0.45 to align with read-fonts from parley and avoid duplicated dependencies +write-fonts = { version = "0.45" } + +[target.'cfg(not(any(target_vendor = "apple", target_family = "windows")))'.dependencies] +skia-safe = { version = "0.90", features = ["gl", "vulkan"] } +wgpu-27 = { workspace = true, optional = true, features = ["vulkan"] } +wgpu-28 = { workspace = true, optional = true, features = ["vulkan"] } + +[target.'cfg(any(target_os = "ios", target_os="macos", target_os="windows", target_os="android", target_os="linux"))'.dependencies] +# Text layout is enabled here just so that we can make use of the pre-built Skia libraries. +skia-safe = { version = "0.90", features = ["textlayout"] } + +[target.aarch64-apple-ios-sim.dependencies] +# Disabling encoding assertions until https://github.com/madsmtm/objc2/issues/795 is fixed. +objc2 = { version = "0.6.0", features = ["disable-encoding-assertions"] } + +[build-dependencies] +cfg_aliases = { workspace = true } + +[package.metadata.docs.rs] +rustdoc-args = ["--generate-link-to-definition"] diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/LICENSES/GPL-3.0-only.txt b/crates/vendor/i-slint-renderer-skia-1.16.1/LICENSES/GPL-3.0-only.txt new file mode 100644 index 000000000..d41c0bd98 --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/LICENSES/GPL-3.0-only.txt @@ -0,0 +1,232 @@ +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright © 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for software and other kinds of works. + +The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. + +Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +“This License” refers to version 3 of the GNU General Public License. + +“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. + +“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations. + +To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work. + +A “covered work” means either the unmodified Program or a work based on the Program. + +To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. + +To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. + +1. Source Code. +The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work. + +A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. + +The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. + +The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same work. + +2. Basic Permissions. +All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. +No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. + +When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. + +4. Conveying Verbatim Copies. +You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. +You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”. + + c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. + +A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. + +6. Conveying Non-Source Forms. +You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: + + a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. + + d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. + +A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. + +“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. + +If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). + +The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. + +7. Additional Terms. +“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or authors of the material; or + + e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. + +All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. + +8. Termination. +You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). + +However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. + +Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. + +9. Acceptance Not Required for Having Copies. +You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. +Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. + +An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. + +11. Patents. +A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”. + +A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. + +In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. + +If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. + +A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. +If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. +Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. + +14. Revised Versions of this License. +The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. + +Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. + +15. Disclaimer of Warranty. +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. +If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”. + +You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . + +The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/LICENSES/LicenseRef-Slint-Royalty-free-2.0.md b/crates/vendor/i-slint-renderer-skia-1.16.1/LICENSES/LicenseRef-Slint-Royalty-free-2.0.md new file mode 100644 index 000000000..f08700973 --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/LICENSES/LicenseRef-Slint-Royalty-free-2.0.md @@ -0,0 +1,43 @@ +# Slint Royalty-free Desktop, Mobile, and Web Applications License + +Version 2.0 + +## Preamble + +Slint is a toolkit that can be used to build user interfaces for applications. Slint (hereafter referred to as **Software**) is made available under different licenses by SixtyFPS GmbH incorporated at Oranienburger Str. 44, 16540 Hohen Neuendorf, Germany (**SixtyFPS**). The **Slint Royalty-free Desktop, Mobile, and Web Applications License** is suitable for those who develop desktop, mobile, or web applications and do not want to use open source components under copyleft licenses. + +## 1. Grant of Rights + +SixtyFPS hereby grants You a world-wide, royalty-free, non-exclusive license to use, reproduce, make available, modify, display, perform, distribute the Software as part of a Desktop, Mobile, or Web Application. + +A **Desktop Application** is a computer program that is designed to run on a general-purpose computer (PC or notebook), typically installed and executed locally on the computer's operating system. + +A **Mobile Application** is a computer program that is designed to run on a general-purpose mobile computer (mobile phone or tablet), typically installed and executed locally on the computer's operating system. + +A **Web Application** is a computer program that is designed to run in the sandbox environment provided by a web browser. + +Desktop Application, Mobile Application, and Web Application are hereafter referred to as **Application**. + +## 2. License Conditions - Attribution + +You may distribute the Software as part of an Application, modified or unmodified, provided that You do either of the following: + +(a) Display the [`AboutSlint`](https://docs.slint.dev/latest/docs/slint/reference/std-widgets/misc/aboutslint/) widget in an "About" screen or dialog that is accessible from the top level menu of the Application. In the absence of such a screen or dialog, display the widget in the "Splash Screen" of the Application. + +(b) Display the [Slint attribution badge](https://github.com/slint-ui/slint/tree/master/logo/MadeWithSlint-logo-whitebg.png) on a public webpage, preferably where the binaries of your Application can be downloaded from, in such a way that it can be easily found by any visitor to that page. + +## 3. Limitations + +The License does not permit to distribute or make the Software publicly available alone and without integration into an Application. For this purpose you may use the Software under the GNU General Public License, version 3. + +The License does not permit the use of the Software within Embedded Systems. An **Embedded System** is a computer system designed to perform a specific task within a larger mechanical or electrical system. + +The License does not permit the distribution of Application that exposes the APIs, in part or in total, of the Software. + +You may not remove or alter any license notices (including copyright notices, disclaimers of warranty, or limitations of liability) contained within the source code form of the Software. + +## 4. Warranty and Liability + +SixtyFPS is only liable for conflicting rights of third parties if SixtyFPS was aware of these rights without informing you. Unless required by applicable law or agreed to in writing, SixtyFPS provides the Software on an "as is" basis, without warranties or conditions of any kind, either express or implied, including, without limitation, any warranties or conditions of merchantability, or fitness for a particular purpose. + +Unless required by law, SixtyFPS won't be liable for any direct, indirect, incidental, or consequential damages arising in any way out of the use of the Software. diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/LICENSES/LicenseRef-Slint-Software-3.0.md b/crates/vendor/i-slint-renderer-skia-1.16.1/LICENSES/LicenseRef-Slint-Software-3.0.md new file mode 100644 index 000000000..c6f5b8e08 --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/LICENSES/LicenseRef-Slint-Software-3.0.md @@ -0,0 +1,117 @@ +# Slint Software License + +Version 3.0.5 + +## Preamble + +Slint is a toolkit that can be used to build user interfaces for applications. Slint (hereafter referred to as **Software**) is made available under different licenses by SixtyFPS GmbH incorporated at Oranienburger Str. 44, 16540 Hohen Neuendorf, Germany (**SixtyFPS**). The **Slint Software License** is suitable for those who do not want to use open source components under copyleft licenses. + +## 1. Grant of Rights + +SixtyFPS hereby grants You a world-wide, non-exclusive license to use, reproduce, make available, modify, display, perform, distribute the Software as part of a Desktop, Mobile, or Web Application or as part of an Embedded System (each of which is defined below). + +A **Desktop Application** is a computer program that is designed to run on a general-purpose computer (PC or notebook), typically installed and executed locally on the computer's operating system. + +A **Mobile Application** is a computer program that is designed to run on a general-purpose mobile computer (mobile phone or tablet), typically installed and executed locally on the computer's operating system. + +A **Web Application** is a computer program that is designed to run in the sandbox environment provided by a web browser. + +An **Embedded System** is a computer system designed to perform a specific task within a larger mechanical or electrical system. + +Desktop Application, Mobile Application, and Web Application are hereafter referred to as **Application**. + +## 2. License Conditions + +The grant of rights in section 1 are conditional, provided that You do all of the following: + +(a) You have purchased an appropriate **Paid License Plan** ([see Annex 1](#annex-1-paid-license-plans)) and the required amount of seats to cover all individual users of the Software associated with the designing, developing, or testing your Application or Embedded System. For clarity, each individual user is counted as one seat. + +(b) In the case that You are distributing the Software as part of an Embedded System, You have purchased an appropriate quantity of **Royalties**, one Royalty for each Embedded System. Royalties become due and payable upon manufacture of the Embedded System, regardless of whether such is subsequently sold, shipped, returned, replaced under warranty, or recalled. Payment of royalties is non-refundable under any circumstances. Royalties are not necessary for non-commercial projects, personal projects, and open source projects. + +## 3. Limitations + +The License does not permit to distribute or make the Software publicly available alone and without integration into an Application or into an Embedded System. For this purpose you may use the Software under the GNU General Public License, version 3. + +The License is limited to only the versions of Software that were made available to you under the Paid License Plan. For all other versions, you may use the Software under either the GNU General Public License, version 3 or the Slint Royalty-free Desktop, Mobile, and Web Applications License. + +The License does not permit the distribution of Application that exposes the APIs, in part or in total, of the Software. + +You may not remove or alter any license notices (including copyright notices, disclaimers of warranty, or limitations of liability) contained within the source code form of the Software. + +## 4. Audit Rights + +SixtyFPS or an independent certified auditor on SixtyFPS's behalf, may, upon its reasonable request, with 30 (thirty) days written notice, and at its sole expense, examine your books and records solely with respect to your use of the Software. Any such audit shall be conducted during regular business hours at your facilities and shall not unreasonably interfere with your business activities. The auditor shall not remove, copy, or redistribute any electronic material during an audit. If an audit reveals that you are using the Software in a way that is in material violation of the terms of this License, then you shall pay SixtyFPS reasonable costs of conducting the audit. The auditor shall only be allowed to report violations of the terms of this License, with a copy to you. You shall be provided the right to provide comments to the report before it is finalized. + +## 5. Termination + +(a) SixtyFPS may terminate this License if You materially breach any obligation hereunder, provided You have been provided notice of such breach and an opportunity to cure such breach during a period of not less than sixty (60) days following such notice. + +(b) You may terminate this License with or without cause upon no less than thirty (30) days advance written notice to SixtyFPS. + +(c) Upon termination of this License, You will immediately cease using, reproducing, making available, modifying, displaying, performing, distributing the Software and pay immediately any unpaid Fees and contractual penalties. + +(d) Sections 3 through 8 of this License will survive any termination of the License to the extent necessary to implement their objectives. + +## 6. Assignment + +You may assign this License, in whole or in part (whether by operation of law or otherwise), with prior consent from SixtyFPS, which shall not be unreasonably withheld or delayed. SixtyFPS may assign any of its rights or delegate any of its obligations hereunder with prior notice to You, provided that the successor maintains at least the same level of security, confidentiality, and data protection measures as in place at the time of assignment or delegation. Any attempt to assign this License other than in accordance with this Section 6 shall be null and void. + +## 7. Severability + +In the event that any provision of this License will, for any reason, be determined by any court of competent jurisdiction to be invalid, illegal or unenforceable in any respect, such invalidity, illegality or unenforceability will be interpreted as closely as possible so as not affect any other provision of this License, and such provision will further be modified by said court to permit its enforcement to the maximum extent permitted by law. + +## 8. Governing Law + +This Agreement shall be construed, interpreted, and governed by the laws of the Federal Republic of Germany. + +## Annex 1: Paid License Plans + +### Enterprise Plan + +The following is included as part of the plan + +(a) No restriction on the number of applications that are developed with Slint. + +(b) Live Preview. + +(c) Standard Support that includes addressing technical queries, troubleshooting, and rectifying bugs or errors (faults) present in the latest official stable release. + +(d) Perpetual Fallback License that allows continued use of a specific Slint version, including all bugfix updates (i.e., all Z releases within the X.Y.Z version), without an active subscription. This license applies only to those versions of Slint for which at least 12 consecutive months of subscription have been paid. + +(e) GUI Test Framework. + +### Small Enterprise Plan + +This plan is limited to individual companies with a staff headcount between 10 and 50 and either a turnover or balance sheet total of 10 million EUR or less. If You are a Small Enterprise, You are required to submit the self-assessment report generated from the EU SME Self-Assessment Tool (https://ec.europa.eu/info/funding-tenders/opportunities/portal/sme/public/organisation-name). + +The following is included as part of the plan + +(a) No restriction on the number of applications that are developed with Slint. + +(b) Live Preview. + +(c) Standard Support that includes addressing technical queries, troubleshooting, and rectifying bugs or errors (faults) present in the latest official stable release. + +The following can be purchased as an Add-On + +(a) Perpetual Fallback License that allows continued use of a specific Slint version, including all bugfix updates (i.e., all Z releases within the X.Y.Z version), without an active subscription. This license applies only to those versions of Slint for which at least 12 consecutive months of subscription have been paid. + +(b) GUI Test Framework. + +### Startup & Individual Plan + +This plan is limited to individuals and individual companies with a staff headcount of less than 10 and either a turnover or balance sheet total of 2 million EUR or less. If You are a Startup, you are required to submit the self-assessment report generated from the EU SME Self-Assessment Tool (https://ec.europa.eu/info/funding-tenders/opportunities/portal/sme/public/organisation-name). + +The following is included as part of the plan + +(a) No restriction on the number of applications that are developed with Slint. + +(b) Live Preview. + +The following can be purchased as an Add-On + +(a) Standard Support that includes addressing technical queries, troubleshooting, and rectifying bugs or errors (faults) present in the latest official stable release. + +(b) Perpetual Fallback License that allows continued use of a specific Slint version, including all bugfix updates (i.e., all Z releases within the X.Y.Z version), without an active subscription. This license applies only to those versions of Slint for which at least 12 consecutive months of subscription have been paid. + +(c) GUI Test Framework. diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/README.md b/crates/vendor/i-slint-renderer-skia-1.16.1/README.md new file mode 100644 index 000000000..fb83b3675 --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/README.md @@ -0,0 +1,7 @@ + +**NOTE**: This library is an **internal** crate of the [Slint project](https://slint.dev). +This crate should **not be used directly** by applications using Slint. +You should use the `slint` crate instead. + +**WARNING**: This crate does not follow the semver convention for versioning and can +only be used with `version = "=x.y.z"` in Cargo.toml. diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/build.rs b/crates/vendor/i-slint-renderer-skia-1.16.1/build.rs new file mode 100644 index 000000000..a61397609 --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/build.rs @@ -0,0 +1,16 @@ +// Copyright © SixtyFPS GmbH +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +use cfg_aliases::cfg_aliases; + +fn main() { + // Setup cfg aliases + cfg_aliases! { + skia_backend_opengl: { any(feature = "opengl", not(any(target_vendor = "apple", target_family = "windows", target_arch = "wasm32"))) }, + skia_backend_metal: { all(target_vendor = "apple", not(feature = "opengl")) }, + skia_backend_vulkan: { feature = "vulkan" }, + skia_backend_software: { not(target_os = "android") }, + } + + println!("cargo:rustc-check-cfg=cfg(slint_nightly_test)"); +} diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/cached_image.rs b/crates/vendor/i-slint-renderer-skia-1.16.1/cached_image.rs new file mode 100644 index 000000000..918e59f37 --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/cached_image.rs @@ -0,0 +1,151 @@ +// Copyright © SixtyFPS GmbH +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +use crate::PhysicalSize; +use i_slint_core::graphics::{ + Image, ImageCacheKey, ImageInner, IntRect, IntSize, OpaqueImage, OpaqueImageVTable, + SharedImageBuffer, cache as core_cache, +}; +use i_slint_core::items::ImageFit; +use i_slint_core::lengths::{LogicalSize, ScaleFactor}; + +struct SkiaCachedImage { + image: skia_safe::Image, + cache_key: ImageCacheKey, +} + +i_slint_core::OpaqueImageVTable_static! { + static SKIA_CACHED_IMAGE_VT for SkiaCachedImage +} + +impl OpaqueImage for SkiaCachedImage { + fn size(&self) -> IntSize { + IntSize::new(self.image.width() as u32, self.image.height() as u32) + } + + fn cache_key(&self) -> ImageCacheKey { + self.cache_key.clone() + } +} + +pub(crate) fn as_skia_image( + image: Image, + target_size_fn: &dyn Fn() -> LogicalSize, + image_fit: ImageFit, + scale_factor: ScaleFactor, + canvas: &skia_safe::Canvas, + surface: Option<&dyn crate::Surface>, +) -> Option { + let image_inner: &ImageInner = (&image).into(); + match image_inner { + ImageInner::None => None, + ImageInner::EmbeddedImage { buffer, cache_key } => { + let result = image_buffer_to_skia_image(buffer); + if let Some(img) = result.as_ref() { + core_cache::replace_cached_image( + cache_key.clone(), + ImageInner::BackendStorage(vtable::VRc::into_dyn(vtable::VRc::new( + SkiaCachedImage { image: img.clone(), cache_key: cache_key.clone() }, + ))), + ) + } + result + } + ImageInner::Svg(svg) => { + // Query target_width/height here again to ensure that changes will invalidate the item rendering cache. + let svg_size = svg.size(); + let fit = i_slint_core::graphics::fit( + image_fit, + target_size_fn() * scale_factor, + IntRect::from_size(svg_size.cast()), + scale_factor, + Default::default(), // We only care about the size, so alignments don't matter + Default::default(), + ); + let target_size = PhysicalSize::new( + svg_size.cast::().width * fit.source_to_target_x, + svg_size.cast::().height * fit.source_to_target_y, + ); + let pixels = match svg.render(Some(target_size.cast())).ok()? { + SharedImageBuffer::RGB8(_) => unreachable!(), + SharedImageBuffer::RGBA8(_) => unreachable!(), + SharedImageBuffer::RGBA8Premultiplied(pixels) => pixels, + }; + + let image_info = skia_safe::ImageInfo::new( + skia_safe::ISize::new(pixels.width() as i32, pixels.height() as i32), + skia_safe::ColorType::RGBA8888, + skia_safe::AlphaType::Premul, + None, + ); + + skia_safe::images::raster_from_data( + &image_info, + skia_safe::Data::new_copy(pixels.as_bytes()), + pixels.width() as usize * 4, + ) + } + ImageInner::StaticTextures(_) => todo!(), + ImageInner::BackendStorage(x) => { + vtable::VRc::borrow(x).downcast::().map(|x| x.image.clone()) + } + ImageInner::BorrowedOpenGLTexture(texture) => { + surface.and_then(|surface| surface.import_opengl_texture(canvas, texture)) + } + ImageInner::NineSlice(n) => as_skia_image( + n.image(), + target_size_fn, + ImageFit::Preserve, + scale_factor, + canvas, + surface, + ), + #[cfg(any(feature = "unstable-wgpu-27", feature = "unstable-wgpu-28"))] + ImageInner::WGPUTexture(any_wgpu_texture) => { + surface.and_then(|surface| surface.import_wgpu_texture(canvas, any_wgpu_texture)) + } + #[allow(unreachable_patterns)] + _ => None, + } +} + +fn image_buffer_to_skia_image(buffer: &SharedImageBuffer) -> Option { + let (data, bpl, size, color_type, alpha_type) = match buffer { + SharedImageBuffer::RGB8(pixels) => { + // RGB888 with one byte per component is not supported by Skia right now. Convert once to RGBA8 :-( + let rgba = pixels + .as_bytes() + .chunks(3) + .flat_map(|rgb| IntoIterator::into_iter([rgb[0], rgb[1], rgb[2], 255])) + .collect::>(); + ( + skia_safe::Data::new_copy(&rgba), + pixels.width() as usize * 4, + pixels.size(), + skia_safe::ColorType::RGBA8888, + skia_safe::AlphaType::Unpremul, + ) + } + SharedImageBuffer::RGBA8(pixels) => ( + skia_safe::Data::new_copy(pixels.as_bytes()), + pixels.width() as usize * 4, + pixels.size(), + skia_safe::ColorType::RGBA8888, + skia_safe::AlphaType::Unpremul, + ), + SharedImageBuffer::RGBA8Premultiplied(pixels) => ( + skia_safe::Data::new_copy(pixels.as_bytes()), + pixels.width() as usize * 4, + pixels.size(), + skia_safe::ColorType::RGBA8888, + skia_safe::AlphaType::Premul, + ), + }; + let image_info = skia_safe::ImageInfo::new( + skia_safe::ISize::new(size.width as i32, size.height as i32), + color_type, + alpha_type, + None, + ); + skia_safe::images::raster_from_data(&image_info, data, bpl) +} diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/d3d_surface.rs b/crates/vendor/i-slint-renderer-skia-1.16.1/d3d_surface.rs new file mode 100644 index 000000000..8e3319f8d --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/d3d_surface.rs @@ -0,0 +1,442 @@ +// Copyright © SixtyFPS GmbH +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +use i_slint_core::api::{PhysicalSize as PhysicalWindowSize, Window}; +use i_slint_core::graphics::RequestedGraphicsAPI; +use i_slint_core::partial_renderer::DirtyRegion; +use i_slint_core::platform::PlatformError; +use std::cell::RefCell; +use std::sync::Arc; +use windows::Win32::Graphics::Direct3D::D3D_FEATURE_LEVEL_11_0; +use windows::Win32::Graphics::Dxgi::Common::DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN; +use windows::core::Interface; + +use windows::Win32::Foundation::{DXGI_STATUS_OCCLUDED, HANDLE, HWND, S_OK}; +use windows::Win32::Graphics::Direct3D12::{ + D3D12_COMMAND_LIST_TYPE_DIRECT, D3D12_COMMAND_QUEUE_DESC, D3D12_FENCE_FLAG_NONE, + D3D12_RESOURCE_STATE_PRESENT, D3D12CreateDevice, ID3D12CommandQueue, ID3D12Device, ID3D12Fence, + ID3D12Resource, +}; +use windows::Win32::Graphics::Dxgi::{ + Common::{DXGI_FORMAT, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_SAMPLE_DESC}, + CreateDXGIFactory2, DXGI_ADAPTER_FLAG, DXGI_ADAPTER_FLAG_NONE, DXGI_ADAPTER_FLAG_SOFTWARE, + DXGI_CREATE_FACTORY_FLAGS, DXGI_PRESENT, DXGI_SWAP_CHAIN_DESC1, DXGI_SWAP_CHAIN_FLAG, + DXGI_SWAP_EFFECT_FLIP_DISCARD, DXGI_USAGE_RENDER_TARGET_OUTPUT, IDXGIFactory4, IDXGISwapChain3, +}; +use windows::Win32::System::Threading::{CreateEventW, INFINITE, WaitForSingleObjectEx}; + +use crate::SkiaSharedContext; + +trait MapToPlatformError { + fn map_platform_error(self, msg: &str) -> std::result::Result; +} + +impl MapToPlatformError for windows::core::Result { + fn map_platform_error(self, msg: &str) -> std::result::Result { + match self { + Ok(r) => Ok(r), + Err(hr) => Err(format!("{} failed. {:x}", msg, hr.code().0).into()), + } + } +} + +const DEFAULT_SURFACE_FORMAT: DXGI_FORMAT = DXGI_FORMAT_R8G8B8A8_UNORM; + +struct SwapChain { + command_queue: ID3D12CommandQueue, + swap_chain: IDXGISwapChain3, + surfaces: Option<[skia_safe::Surface; 2]>, + current_buffer_index: usize, + fence: ID3D12Fence, + fence_values: [u64; 2], + fence_event: HANDLE, + gr_context: skia_safe::gpu::DirectContext, +} + +impl SwapChain { + fn new( + command_queue: ID3D12CommandQueue, + device: &ID3D12Device, + mut gr_context: skia_safe::gpu::DirectContext, + window_handle: raw_window_handle::WindowHandle<'_>, + size: PhysicalWindowSize, + dxgi_factory: &IDXGIFactory4, + ) -> Result { + let swap_chain_desc = DXGI_SWAP_CHAIN_DESC1 { + Width: size.width, + Height: size.height, + Format: DEFAULT_SURFACE_FORMAT, + BufferCount: 2, + BufferUsage: DXGI_USAGE_RENDER_TARGET_OUTPUT, + SwapEffect: DXGI_SWAP_EFFECT_FLIP_DISCARD, + SampleDesc: DXGI_SAMPLE_DESC { Count: 1, ..Default::default() }, + ..Default::default() + }; + + let hwnd = match window_handle.as_raw() { + raw_window_handle::RawWindowHandle::Win32(raw_window_handle::Win32WindowHandle { + hwnd, + .. + }) => HWND(hwnd.get() as _), + _ => { + return Err( + format!("Metal surface is only supported with Win32WindowHandle").into() + ); + } + }; + + let swap_chain1 = unsafe { + dxgi_factory.CreateSwapChainForHwnd(&command_queue, hwnd, &swap_chain_desc, None, None) + } + .map_platform_error("unable to create D3D swap chain")?; + + let swap_chain: IDXGISwapChain3 = + swap_chain1.cast().map_platform_error("unable to cast swap chain 1 to v3")?; + + let fence = unsafe { device.CreateFence(0, D3D12_FENCE_FLAG_NONE) } + .map_platform_error("unable to create D3D12 fence")?; + + let fence_values = [0, 0]; + + let fence_event = unsafe { CreateEventW(None, false, false, None) } + .map_platform_error("error creating fence event")?; + + let current_buffer_index = unsafe { swap_chain.GetCurrentBackBufferIndex() } as usize; + + let surfaces = Some(Self::create_surfaces( + &swap_chain, + &mut gr_context, + size.width as _, + size.height as _, + )?); + + Ok(Self { + command_queue, + swap_chain, + surfaces, + current_buffer_index, + fence, + fence_event, + fence_values, + gr_context, + }) + } + + fn render_and_present( + &mut self, + callback: impl FnOnce(&mut skia_safe::Surface, &mut skia_safe::gpu::DirectContext, u8) -> T, + pre_present_callback: &RefCell>>, + ) -> Result { + let current_fence_value = self.fence_values[self.current_buffer_index]; + + self.current_buffer_index = unsafe { self.swap_chain.GetCurrentBackBufferIndex() } as usize; + self.wait_for_buffer(self.current_buffer_index)?; + + self.fence_values[self.current_buffer_index] = current_fence_value + 1; + + let surface = &mut (*self.surfaces.as_mut().unwrap())[self.current_buffer_index]; + + // TODO: pass correct buffer age + let result = callback(surface, &mut self.gr_context, 0); + + let info = Default::default(); + self.gr_context.flush_surface_with_access( + surface, + skia_safe::surface::BackendSurfaceAccess::Present, + &info, + ); + self.gr_context.submit(None); + + if let Some(pre_present_callback) = pre_present_callback.borrow_mut().as_mut() { + pre_present_callback(); + } + + let present_result = unsafe { self.swap_chain.Present(1, DXGI_PRESENT(0)) }; + if present_result != S_OK && present_result != DXGI_STATUS_OCCLUDED { + return Err(format!("Error presenting d3d swap chain: {:x}", present_result.0).into()); + } + + unsafe { + self.command_queue.Signal(&self.fence, self.fence_values[self.current_buffer_index]) + } + .map_platform_error("error setting up completion signal for d3d12 command queue")?; + + Ok(result) + } + + fn create_surfaces( + swap_chain: &IDXGISwapChain3, + gr_context: &mut skia_safe::gpu::DirectContext, + width: i32, + height: i32, + ) -> Result<[skia_safe::Surface; 2], PlatformError> { + let mut make_surface = |buffer_index| { + let buffer: ID3D12Resource = unsafe { swap_chain.GetBuffer(buffer_index) } + .map_err(|hr| format!("unable to retrieve swap chain back buffer: {hr}"))?; + + debug_assert_eq!(unsafe { buffer.GetDesc().Width }, width as u64); + debug_assert_eq!(unsafe { buffer.GetDesc().Height }, height as u32); + + let texture_info = skia_safe::gpu::d3d::TextureResourceInfo { + resource: buffer, + alloc: None, + resource_state: D3D12_RESOURCE_STATE_PRESENT, + format: DEFAULT_SURFACE_FORMAT, + sample_count: 1, + level_count: 1, + sample_quality_pattern: DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN, + protected: skia_safe::gpu::Protected::No, + }; + let backend_texture = + skia_safe::gpu::BackendRenderTarget::new_d3d((width, height), &texture_info); + + skia_safe::gpu::surfaces::wrap_backend_render_target( + gr_context, + &backend_texture, + skia_safe::gpu::SurfaceOrigin::TopLeft, + skia_safe::ColorType::RGBA8888, + None, + None, + ) + .ok_or_else(|| format!("unable to create d3d skia backend render target")) + }; + + Ok([make_surface(0)?, make_surface(1)?]) + } + + fn resize( + &mut self, + width: u32, + height: u32, + ) -> Result<(), i_slint_core::platform::PlatformError> { + self.gr_context.flush_submit_and_sync_cpu(); + + self.wait_for_buffer(0)?; + self.wait_for_buffer(1)?; + + drop(self.surfaces.take()); + + unsafe { + self.swap_chain.ResizeBuffers( + 0, + width, + height, + DEFAULT_SURFACE_FORMAT, + DXGI_SWAP_CHAIN_FLAG(0), + ) + } + .map_platform_error("Error resizing swap chain buffers")?; + + self.surfaces = Some(Self::create_surfaces( + &self.swap_chain, + &mut self.gr_context, + width as i32, + height as i32, + )?); + Ok(()) + } + + fn wait_for_buffer(&mut self, buffer_index: usize) -> Result<(), PlatformError> { + if unsafe { self.fence.GetCompletedValue() } < self.fence_values[buffer_index] { + unsafe { + self.fence.SetEventOnCompletion(self.fence_values[buffer_index], self.fence_event) + } + .map_platform_error("error setting event on command queue completion")?; + + unsafe { + WaitForSingleObjectEx(self.fence_event, INFINITE, false); + } + } + Ok(()) + } +} + +/// This surface renders into the given window using Direct 3D. The provided display +/// argument is ignored, as it has no meaning on Windows. +pub struct D3DSurface { + swap_chain: RefCell, +} + +impl super::Surface for D3DSurface { + fn new( + _shared_context: &SkiaSharedContext, + window_handle: Arc, + _display_handle: Arc, + size: PhysicalWindowSize, + requested_graphics_api: Option, + ) -> Result { + if requested_graphics_api + .map_or(false, |api| !matches!(api, RequestedGraphicsAPI::Direct3D)) + { + return Err(format!("Requested non-Direct3D rendering with Direct3D renderer").into()); + } + + let factory_flags = 0; + /* + let factory_flags = dxgi1_3::DXGI_CREATE_FACTORY_DEBUG; + + { + let maybe_debug_interface: Result< + ComPtr, + HRESULT, + > = resolve_interface(|iid, ptr| unsafe { d3d12::D3D12GetDebugInterface(iid, ptr) }); + if let Ok(debug) = maybe_debug_interface { + unsafe { debug.EnableDebugLayer() }; + } + } + */ + + let dxgi_factory: IDXGIFactory4 = + unsafe { CreateDXGIFactory2(DXGI_CREATE_FACTORY_FLAGS(factory_flags)) } + .map_platform_error("unable to create DXGIFactory4")?; + + let mut software_adapter_index = None; + let use_warp = std::env::var("SLINT_D3D_USE_WARP").is_ok(); + + let adapter = { + let mut i = 0; + loop { + let adapter = match unsafe { dxgi_factory.EnumAdapters1(i) } { + Ok(adapter) => adapter, + Err(_) => break None, + }; + + let Ok(desc) = (unsafe { adapter.GetDesc1() }) else { + continue; + }; + + let adapter_is_warp = (DXGI_ADAPTER_FLAG(desc.Flags as i32) + & DXGI_ADAPTER_FLAG_SOFTWARE) + != DXGI_ADAPTER_FLAG_NONE; + + if adapter_is_warp { + if software_adapter_index.is_none() { + software_adapter_index = Some(i); + } + + if !use_warp { + i += 1; + // Select warp only if explicitly opted in via SLINT_D3D_USE_WARP + continue; + } + + // found warp adapter, requested warp? give it a try below + } else if use_warp { + // Don't select a non-warp adapter when warp is requested + i += 1; + continue; + } + + // Check to see whether the adapter supports Direct3D 12, but don't + // create the actual device yet. + if unsafe { + D3D12CreateDevice( + &adapter, + D3D_FEATURE_LEVEL_11_0, + std::ptr::null_mut::>(), + ) + } + .is_ok() + { + break Some(adapter); + } + + i += 1; + } + }; + + let adapter = adapter.map_or_else( + || { + let software_adapter_index = software_adapter_index + .ok_or_else(|| format!("unable to locate D3D software adapter"))?; + unsafe { dxgi_factory.EnumAdapters1(software_adapter_index) } + .map_err(|hr| format!("unable to create D3D software adapter: {hr}")) + }, + |adapter| Ok(adapter), + )?; + + let mut device: Option = None; + unsafe { D3D12CreateDevice(&adapter, D3D_FEATURE_LEVEL_11_0, &mut device) } + .map_platform_error("error calling D3D12CreateDevice")?; + let device = device.unwrap(); + + let queue: ID3D12CommandQueue = { + let desc = D3D12_COMMAND_QUEUE_DESC { + Type: D3D12_COMMAND_LIST_TYPE_DIRECT, + ..Default::default() + }; + + unsafe { device.CreateCommandQueue(&desc) } + .map_platform_error("Creating command queue")? + }; + + let backend_context = skia_safe::gpu::d3d::BackendContext { + adapter, + device: device.clone(), + queue: queue.clone(), + memory_allocator: None, + protected_context: skia_safe::gpu::Protected::No, + }; + + let gr_context = unsafe { skia_safe::gpu::DirectContext::new_d3d(&backend_context, None) } + .ok_or_else(|| format!("unable to create Skia D3D DirectContext"))?; + + let window_handle = window_handle + .window_handle() + .map_err(|e| format!("error obtaining window handle for skia d3d renderer: {e}"))?; + + let swap_chain = RefCell::new(SwapChain::new( + queue, + &device, + gr_context, + window_handle, + size, + &dxgi_factory, + )?); + + Ok(Self { swap_chain }) + } + + fn name(&self) -> &'static str { + "d3d" + } + + fn resize_event( + &self, + size: PhysicalWindowSize, + ) -> Result<(), i_slint_core::platform::PlatformError> { + self.swap_chain.borrow_mut().resize(size.width, size.height) + } + + fn render( + &self, + _window: &Window, + _size: PhysicalWindowSize, + callback: &dyn Fn( + &skia_safe::Canvas, + Option<&mut skia_safe::gpu::DirectContext>, + u8, + ) -> Option, + pre_present_callback: &RefCell>>, + ) -> Result<(), i_slint_core::platform::PlatformError> { + self.swap_chain.borrow_mut().render_and_present( + |surface, gr_context, buffer_age| { + callback(surface.canvas(), Some(gr_context), buffer_age); + }, + pre_present_callback, + ) + } + + fn bits_per_pixel(&self) -> Result { + let desc = unsafe { self.swap_chain.borrow().swap_chain.GetDesc() } + .map_platform_error("error getting swap chain description")?; + Ok(match desc.BufferDesc.Format { + DEFAULT_SURFACE_FORMAT => 32, + fmt @ _ => { + return Err( + format!("Skia D3D Renderer: Unsupported buffer format found {fmt:?}").into() + ); + } + }) + } +} diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/font_cache.rs b/crates/vendor/i-slint-renderer-skia-1.16.1/font_cache.rs new file mode 100644 index 000000000..f8f02274a --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/font_cache.rs @@ -0,0 +1,172 @@ +// Copyright © SixtyFPS GmbH +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +use clru::CLruCache; +use i_slint_common::sharedfontique::HashedBlob; +use i_slint_core::textlayout::sharedparley::{fontique, parley}; +use std::cell::RefCell; +use std::collections::hash_map::DefaultHasher; +use std::hash::{Hash, Hasher}; +use std::num::NonZeroUsize; + +const FONT_CACHE_CAPACITY: NonZeroUsize = NonZeroUsize::new(64).unwrap(); + +pub struct FontCache { + font_mgr: skia_safe::FontMgr, + // Use HashedBlob in key to keep strong reference to font data blob, + // preventing eviction from fontique's shared cache (see commit 30a03cf). + // The u64 is a hash of variation settings (0 for base typefaces). + fonts: CLruCache<(HashedBlob, u32, u64), Option>, +} + +impl Default for FontCache { + fn default() -> Self { + Self { font_mgr: skia_safe::FontMgr::new(), fonts: CLruCache::new(FONT_CACHE_CAPACITY) } + } +} + +impl FontCache { + pub fn font_with_variations( + &mut self, + font: &parley::FontData, + synthesis: &fontique::Synthesis, + ) -> Option { + let variation_settings = synthesis.variation_settings(); + + let mut variations_hash = 0u64; + if !variation_settings.is_empty() { + let mut hasher = DefaultHasher::new(); + for &(tag, value) in variation_settings { + tag.to_be_bytes().hash(&mut hasher); + value.to_bits().hash(&mut hasher); + } + variations_hash = hasher.finish(); + } + + let key = (font.data.clone().into(), font.index, variations_hash); + + if let Some(cached) = self.fonts.get(&key) { + return cached.clone(); + } + + let mut typeface = self.load_typeface_internal(font); + + if !variation_settings.is_empty() { + typeface = typeface.and_then(|base| { + let coords: Vec = + variation_settings + .iter() + .map(|&(tag, value)| { + skia_safe::font_arguments::variation_position::Coordinate { + axis: skia_safe::FourByteTag::new(u32::from_be_bytes( + tag.to_be_bytes(), + )), + value, + } + }) + .collect(); + let position = + skia_safe::font_arguments::VariationPosition { coordinates: &coords }; + let args = skia_safe::FontArguments::new().set_variation_design_position(position); + base.clone_with_arguments(&args).or(Some(base)) + }); + } + + self.fonts.put(key, typeface.clone()); + typeface + } + + fn load_typeface_internal(&self, font: &parley::FontData) -> Option { + let typeface = self.font_mgr.new_from_data( + font.data.as_ref(), + if font.index > 0 { Some(font.index as _) } else { None }, + ); + + // Due to https://issues.skia.org/issues/310510989, fonts from true type collections + // with an index > 0 fail to load on macOS. As a workaround, we manually extract the font from the + // collection and load it as a single font. + #[cfg(target_vendor = "apple")] + if font.index > 0 && typeface.is_none() { + if let Some(typeface) = read_fonts::CollectionRef::new(font.data.as_ref()) + .ok() + .and_then(|ttc| ttc.get(font.index).ok()) + .map(|ttf| write_fonts::FontBuilder::new().copy_missing_tables(ttf).build()) + .and_then(|new_ttf| self.font_mgr.new_from_data(&new_ttf, None)) + { + return Some(typeface); + } + // Second-chance workaround (QBZ): for some system collections BOTH + // paths above fail — AppleSDGothicNeo.ttc packs every weight at + // index > 0 and CoreText also rejects the rebuilt sfnt, which + // blanked every Korean glyph run at non-regular weights. Resolve + // the SAME face through CoreText by family name + OS/2 weight; the + // match points at the same installed file, so the glyph ids parley + // shaped with stay valid — enforced by the cmap spot checks (a + // mismatching face is rejected rather than drawing wrong glyphs). + if let Some(typeface) = self.typeface_via_family_match(font) { + return Some(typeface); + } + } + + typeface + } + + /// See `load_typeface_internal`: resolve a TTC face CoreText refuses to + /// load from data by asking the system font manager for the same family + /// at the face's weight, then verify glyph-id agreement via the cmap. + #[cfg(target_vendor = "apple")] + fn typeface_via_family_match(&self, font: &parley::FontData) -> Option { + use read_fonts::TableProvider; + + let face = read_fonts::CollectionRef::new(font.data.as_ref()) + .ok()? + .get(font.index) + .ok()?; + + // Typographic family (name id 16) wins over the legacy family (id 1); + // either resolves through CoreText, localized values included. + let name = face.name().ok()?; + let mut family = String::new(); + for rec in name.name_record() { + let id = rec.name_id().to_u16(); + if id == 1 || id == 16 { + if let Ok(entry) = rec.string(name.string_data()) { + if id == 16 || family.is_empty() { + family = entry.chars().collect(); + } + } + } + } + if family.is_empty() { + return None; + } + + let weight = face.os2().ok().map(|os2| os2.us_weight_class()).unwrap_or(400); + let style = skia_safe::FontStyle::new( + skia_safe::font_style::Weight::from(weight as i32), + skia_safe::font_style::Width::NORMAL, + skia_safe::font_style::Slant::Upright, + ); + let typeface = self.font_mgr.match_family_style(&family, style)?; + + // Glyph-id sanity: the matched face must map the same codepoints to + // the same glyph ids as the face parley shaped with. One disagreement + // disqualifies the match (blank beats wrong glyphs). + let cmap = face.cmap().ok()?; + let skia_font = skia_safe::Font::new(typeface.clone(), 16.0); + let mut verified = 0usize; + for cp in [0x41u32, 0x4E00, 0xAC00, 0x3042] { + if let Some(gid) = cmap.map_codepoint(cp) { + if u32::from(skia_font.unichar_to_glyph(cp as i32)) != gid.to_u32() { + return None; + } + verified += 1; + } + } + (verified > 0).then_some(typeface) + } +} + +thread_local! { + pub static FONT_CACHE: RefCell = RefCell::new(Default::default()) +} diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/itemrenderer.rs b/crates/vendor/i-slint-renderer-skia-1.16.1/itemrenderer.rs new file mode 100644 index 000000000..e284cc509 --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/itemrenderer.rs @@ -0,0 +1,1114 @@ +// Copyright © SixtyFPS GmbH +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +// cSpell: ignore rrect + +use std::pin::Pin; + +use super::{PhysicalBorderRadius, PhysicalLength, PhysicalPoint, PhysicalRect, PhysicalSize}; +use i_slint_core::graphics::ApproxEq; +use i_slint_core::graphics::boxshadowcache::BoxShadowCache; +use i_slint_core::graphics::euclid::num::Zero; +use i_slint_core::graphics::euclid::{self, Vector2D}; +use i_slint_core::item_rendering::{ + CachedRenderingData, ItemCache, ItemRenderer, ItemRendererFeatures, RenderImage, RenderText, +}; +use i_slint_core::items::{ImageFit, ImageRendering, ItemRc, Layer, Opacity, RenderingResult}; +use i_slint_core::lengths::{ + LogicalBorderRadius, LogicalLength, LogicalPoint, LogicalPx, LogicalRect, LogicalSize, + LogicalVector, PhysicalPx, RectLengths, ScaleFactor, SizeLengths, logical_size_from_api, +}; +use i_slint_core::textlayout::sharedparley::{self, GlyphRenderer, fontique}; +use i_slint_core::window::WindowInner; +use i_slint_core::{Brush, Color, SharedString}; +use skia_safe::{Matrix, TileMode}; + +pub type SkiaBoxShadowCache = BoxShadowCache; + +#[derive(Clone, Copy)] +struct RenderState { + alpha: f32, + transform: i_slint_core::lengths::ItemTransform, +} + +pub struct SkiaItemRenderer<'a> { + pub canvas: &'a skia_safe::Canvas, + pub scale_factor: ScaleFactor, + pub window: &'a i_slint_core::api::Window, + surface: Option<&'a dyn crate::Surface>, + state_stack: Vec, + current_state: RenderState, + image_cache: &'a ItemCache>, + layer_cache: &'a ItemCache, skia_safe::Image)>>, + path_cache: &'a ItemCache, skia_safe::Path)>>, + text_layout_cache: &'a sharedparley::TextLayoutCache, + box_shadow_cache: &'a mut SkiaBoxShadowCache, +} + +impl<'a> SkiaItemRenderer<'a> { + pub fn new( + canvas: &'a skia_safe::Canvas, + window: &'a i_slint_core::api::Window, + surface: Option<&'a dyn crate::Surface>, + image_cache: &'a ItemCache>, + layer_cache: &'a ItemCache, skia_safe::Image)>>, + path_cache: &'a ItemCache, skia_safe::Path)>>, + text_layout_cache: &'a sharedparley::TextLayoutCache, + box_shadow_cache: &'a mut SkiaBoxShadowCache, + ) -> Self { + Self { + canvas, + scale_factor: ScaleFactor::new(window.scale_factor()), + window, + surface, + state_stack: Vec::new(), + current_state: RenderState { + alpha: 1.0, + transform: i_slint_core::lengths::ItemTransform::identity(), + }, + image_cache, + layer_cache, + path_cache, + text_layout_cache, + box_shadow_cache, + } + } + + fn default_paint(&self) -> Option { + if self.current_state.alpha.approx_eq(&1.0) { + None + } else { + let mut paint = skia_safe::Paint::default(); + paint.set_alpha_f(self.current_state.alpha); + Some(paint) + } + } + + fn brush_to_paint( + &self, + brush: Brush, + width: PhysicalLength, + height: PhysicalLength, + ) -> Option { + let (mut paint, shader) = + Self::brush_to_shader(self.default_paint().unwrap_or_default(), brush, width, height)?; + paint.set_shader(Some(shader)); + + Some(paint) + } + + fn brush_to_shader( + mut paint: skia_safe::Paint, + brush: Brush, + width: PhysicalLength, + height: PhysicalLength, + ) -> Option<(skia_safe::Paint, skia_safe::Shader)> { + if brush.is_transparent() { + return None; + } + + match brush { + Brush::SolidColor(color) => Some(skia_safe::shaders::color(to_skia_color(&color))), + + Brush::LinearGradient(g) => { + let (start, end) = i_slint_core::graphics::line_for_angle( + g.angle(), + [width.get(), height.get()].into(), + ); + let (colors, pos): (Vec<_>, Vec<_>) = + g.stops().map(|s| (to_skia_color(&s.color), s.position)).unzip(); + + paint.set_dither(true); + + skia_safe::gradient_shader::linear( + (skia_safe::Point::new(start.x, start.y), skia_safe::Point::new(end.x, end.y)), + skia_safe::gradient_shader::GradientShaderColors::Colors(&colors), + Some(&*pos), + TileMode::Clamp, + skia_safe::gradient_shader::Flags::INTERPOLATE_COLORS_IN_PREMUL, + &skia_safe::Matrix::new_identity(), + ) + } + Brush::RadialGradient(g) => { + let (colors, pos): (Vec<_>, Vec<_>) = + g.stops().map(|s| (to_skia_color(&s.color), s.position)).unzip(); + let circle_scale = + 0.5 * (width.get() * width.get() + height.get() * height.get()).sqrt(); + + paint.set_dither(true); + + skia_safe::gradient_shader::radial( + skia_safe::Point::new(0., 0.), + 1., + skia_safe::gradient_shader::GradientShaderColors::Colors(&colors), + Some(&*pos), + TileMode::Clamp, + skia_safe::gradient_shader::Flags::INTERPOLATE_COLORS_IN_PREMUL, + skia_safe::Matrix::scale((circle_scale, circle_scale)) + .post_translate((width.get() / 2., height.get() / 2.)) + as &skia_safe::Matrix, + ) + } + Brush::ConicGradient(g) => { + let (colors, pos): (Vec<_>, Vec<_>) = + g.stops().map(|s| (to_skia_color(&s.color), s.position)).unzip(); + + paint.set_dither(true); + + // Skia's sweep gradient uses 0 degrees at 3 o'clock (east) + // We want 0 degrees at 12 o'clock (north), so we need to rotate by -90 degrees + let center = skia_safe::Point::new(width.get() / 2., height.get() / 2.); + skia_safe::gradient_shader::sweep( + center, + skia_safe::gradient_shader::GradientShaderColors::Colors(&colors), + Some(&*pos), + TileMode::Clamp, + None, // Use None for full 360° sweep + None, + Some(&skia_safe::Matrix::rotate_deg_pivot(-90.0, center)), + ) + } + _ => None, + } + .map(|shader| (paint, shader)) + } + + fn colorize_image( + &mut self, + image: skia_safe::Image, + colorize_brush: Brush, + ) -> Option { + let image_info = skia_safe::ImageInfo::new( + image.dimensions(), + skia_safe::ColorType::RGBA8888, + skia_safe::AlphaType::Premul, + None, + ); + + Self::brush_to_shader( + skia_safe::Paint::default(), // Don't use the renderer's default paint because alpha is applied later + colorize_brush, + PhysicalLength::new(image.width() as f32), + PhysicalLength::new(image.height() as f32), + ) + .map(|(mut paint, colorize_shader)| { + let mut surface = self.canvas.new_surface(&image_info, None)?; + let canvas = surface.canvas(); + canvas.clear(skia_safe::Color::TRANSPARENT); + + paint.set_image_filter(skia_safe::image_filters::blend( + skia_safe::BlendMode::SrcIn, + skia_safe::image_filters::image(image, None, None, None), + skia_safe::image_filters::shader(colorize_shader, None), + None, + )); + canvas.draw_paint(&paint); + Some(surface.image_snapshot()) + })? + } + + fn draw_image_impl( + &mut self, + item_rc: &ItemRc, + item: Pin<&dyn RenderImage>, + dest_rect: PhysicalRect, + ) { + let tiling = item.tiling(); + + // TODO: avoid doing creating an SkImage multiple times when the same source is used in multiple image elements + let skia_image = self.image_cache.get_or_update_cache_entry(item_rc, || { + let image = item.source(); + super::cached_image::as_skia_image( + image, + &|| item.target_size(), + if tiling != Default::default() { ImageFit::Preserve } else { item.image_fit() }, + self.scale_factor, + self.canvas, + self.surface, + ) + .and_then(|skia_image| { + let brush = item.colorize(); + if !brush.is_transparent() { + self.colorize_image(skia_image, brush) + } else { + Some(skia_image) + } + }) + }); + + let Some(skia_image) = skia_image else { return }; + let source = item.source(); + let source_size = source.size(); + if source_size.is_empty() { + // Not sure how this can happen, but we've seen with #6280 + // that somehow we end up with a `skia_safe::Image` but a zero + // source size. + return; + } + let fits = if let i_slint_core::ImageInner::NineSlice(nine) = + <&i_slint_core::ImageInner>::from(&source) + { + i_slint_core::graphics::fit9slice( + source_size.cast(), + nine.1, + dest_rect.size, + self.scale_factor, + item.alignment(), + tiling, + ) + .collect::>() + } else { + vec![i_slint_core::graphics::fit( + item.image_fit(), + dest_rect.size, + item.source_clip().unwrap_or_else(|| euclid::Rect::from_size(source_size.cast())), + self.scale_factor, + item.alignment(), + tiling, + )] + }; + + let _saved_canvas = self.pixel_align_origin_auto_restore(); + for fit in fits { + self.canvas.save(); + + let dst = to_skia_rect(&PhysicalRect::new(fit.offset, fit.size)); + self.canvas.clip_rect(dst, None, None); + let src = skia_safe::IRect::from_xywh( + skia_image.width() * fit.clip_rect.origin.x / source_size.width as i32, + skia_image.height() * fit.clip_rect.origin.y / source_size.height as i32, + skia_image.width() * fit.clip_rect.size.width / source_size.width as i32, + skia_image.height() * fit.clip_rect.size.height / source_size.height as i32, + ); + + let filter_mode: skia_safe::sampling_options::SamplingOptions = + match item.rendering() { + ImageRendering::Pixelated => skia_safe::sampling_options::FilterMode::Nearest, + ImageRendering::Smooth | _ => skia_safe::sampling_options::FilterMode::Linear, + } + .into(); + + if let Some(tiled_offset) = fit.tiled { + let matrix = Matrix::translate(((fit.offset.x as i32), (fit.offset.y as i32))) + * Matrix::scale(( + fit.source_to_target_x * source_size.width as f32 + / skia_image.width() as f32, + fit.source_to_target_y * source_size.height as f32 + / skia_image.height() as f32, + )) + * Matrix::translate((-(tiled_offset.x as i32), -(tiled_offset.y as i32))); + if let Some(shader) = skia_image + .make_subset( + self.canvas + .recording_context() + .as_mut() + .map(|c| c.as_recorder() as &mut dyn skia_safe::Recorder), + src, + skia_safe::image::RequiredProperties::default(), + ) + .and_then(|i| { + i.to_shader((TileMode::Repeat, TileMode::Repeat), filter_mode, &matrix) + }) + { + let mut paint = self.default_paint().unwrap_or_default(); + paint.set_shader(shader); + self.canvas.draw_paint(&paint); + } + } else { + let transform = + skia_safe::Matrix::rect_2_rect(skia_safe::Rect::from(src), dst, None) + .unwrap_or_default(); + self.canvas.concat(&transform); + self.canvas.draw_image_with_sampling_options( + skia_image.clone(), + skia_safe::Point::default(), + filter_mode, + self.default_paint().as_ref(), + ); + } + + self.canvas.restore(); + } + } + + fn render_and_blend_layer(&mut self, item_rc: &ItemRc) -> RenderingResult { + let window_adapter = self.window().window_adapter(); + let current_clip = self.get_current_clip(); + if let Some((layer_offset, layer_image)) = self.render_layer(item_rc, &|| { + // We don't need to include the size of the "layer" item itself, since it has no content. + // But intersect with the union of the clip with the geometry to make sure we don't + // render insanely large surface. + i_slint_core::properties::evaluate_no_tracking(|| { + i_slint_core::item_rendering::item_children_bounding_rect(item_rc, &window_adapter) + .intersection(¤t_clip.union(&item_rc.geometry())) + .unwrap_or_default() + }) + }) { + self.canvas.translate(skia_safe::Vector::from((layer_offset.x, layer_offset.y))); + let _saved_canvas = self.pixel_align_origin_auto_restore(); + self.canvas.draw_image_with_sampling_options( + layer_image, + skia_safe::Point::default(), + skia_safe::sampling_options::FilterMode::Linear, + self.default_paint().as_ref(), + ); + } + RenderingResult::ContinueRenderingWithoutChildren + } + + fn render_layer( + &mut self, + item_rc: &ItemRc, + layer_bounding_rect_fn: &dyn Fn() -> LogicalRect, + ) -> Option<(Vector2D, skia_safe::Image)> { + self.layer_cache.get_or_update_cache_entry(item_rc, || { + let bounding_rect = layer_bounding_rect_fn(); + let physical_origin = bounding_rect.origin * self.scale_factor; + let layer_size = bounding_rect.size * self.scale_factor; + + let image_info = skia_safe::ImageInfo::new( + to_skia_size(&layer_size).to_ceil(), + skia_safe::ColorType::RGBA8888, + skia_safe::AlphaType::Premul, + None, + ); + let mut surface = self.canvas.new_surface(&image_info, None)?; + let canvas = surface.canvas(); + canvas.clear(skia_safe::Color::TRANSPARENT); + + let mut sub_renderer = SkiaItemRenderer::new( + canvas, + self.window, + self.surface, + self.image_cache, + self.layer_cache, + self.path_cache, + self.text_layout_cache, + self.box_shadow_cache, + ); + sub_renderer.translate(-bounding_rect.origin.to_vector()); + + i_slint_core::item_rendering::render_item_children( + &mut sub_renderer, + item_rc.item_tree(), + item_rc.index() as isize, + &WindowInner::from_pub(self.window).window_adapter(), + ); + + Some((physical_origin.to_vector(), surface.image_snapshot())) + }) + } + + // Same as pixel_align_origin_auto_restore() but can be used across function calls where + // `&self` is needed. Returns true if the caller must call `restore()` on `self.canvas`. + fn save_canvas_and_pixel_align_origin(&self) -> bool { + let local_to_device = self.canvas.local_to_device_as_3x3(); + if !local_to_device.is_translate() || local_to_device.is_identity() { + return false; + } + let Some(device_to_local) = local_to_device.invert() else { + return false; + }; + let mut target_point = local_to_device.map_point(skia_safe::Point::default()); + + target_point.x = target_point.x.round(); + target_point.y = target_point.y.round(); + + self.canvas.save(); + + self.canvas.translate(device_to_local.map_point(target_point)); + + true + } + + fn pixel_align_origin_auto_restore(&self) -> Option> { + let local_to_device = self.canvas.local_to_device_as_3x3(); + if !local_to_device.is_translate() || local_to_device.is_identity() { + return None; + } + let device_to_local = local_to_device.invert()?; + let mut target_point = local_to_device.map_point(skia_safe::Point::default()); + + target_point.x = target_point.x.round(); + target_point.y = target_point.y.round(); + + let restore_point = skia_safe::AutoCanvasRestore::guard(self.canvas, true); + + self.canvas.translate(device_to_local.map_point(target_point)); + + Some(restore_point) + } +} + +impl ItemRenderer for SkiaItemRenderer<'_> { + fn draw_rectangle( + &mut self, + rect: Pin<&dyn i_slint_core::item_rendering::RenderRectangle>, + _self_rc: &i_slint_core::items::ItemRc, + size: LogicalSize, + _cache: &CachedRenderingData, + ) { + let geometry = PhysicalRect::from(size * self.scale_factor); + if geometry.is_empty() { + return; + } + + let paint = match self.brush_to_paint( + rect.background(), + geometry.width_length(), + geometry.height_length(), + ) { + Some(paint) => paint, + None => return, + }; + self.canvas.draw_rect(to_skia_rect(&geometry), &paint); + } + + fn draw_border_rectangle( + &mut self, + rect: Pin<&dyn i_slint_core::item_rendering::RenderBorderRectangle>, + _self_rc: &i_slint_core::items::ItemRc, + size: LogicalSize, + _: &CachedRenderingData, + ) { + let mut geometry = PhysicalRect::from(size * self.scale_factor); + if geometry.is_empty() { + return; + } + + let border_color = rect.border_color(); + let opaque_border = border_color.is_opaque(); + let mut border_width = if border_color.is_transparent() { + PhysicalLength::new(0.) + } else { + rect.border_width() * self.scale_factor + }; + + // Radius of rounded rect if we were to just fill the rectangle, without a border. + let mut fill_radius = rect.border_radius() * self.scale_factor; + // Skia's border radius on stroke is in the middle of the border. But we want it to be the radius of the rectangle itself. + // This is incorrect if fill_radius < border_width/2, but this can't be fixed. Better to have a radius a bit too big than no radius at all + fill_radius = fill_radius.outer(border_width / 2. + PhysicalLength::new(0.01)); + let stroke_border_radius = fill_radius.inner(border_width / 2.); + + let (background_rect, border_rect) = if opaque_border { + // In CSS the border is entirely towards the inside of the boundary + // geometry, while in femtovg the line with for a stroke is 50% in- + // and 50% outwards. We choose the CSS model, so the inner rectangle + // is adjusted accordingly. + adjust_rect_and_border_for_inner_drawing(&mut geometry, &mut border_width); + + let rounded_rect = to_skia_rrect(&geometry, &stroke_border_radius); + + (rounded_rect, rounded_rect) + } else { + let background_rect = to_skia_rrect(&geometry, &fill_radius); + + // In CSS the border is entirely towards the inside of the boundary + // geometry, while in femtovg the line with for a stroke is 50% in- + // and 50% outwards. We choose the CSS model, so the inner rectangle + // is adjusted accordingly. + adjust_rect_and_border_for_inner_drawing(&mut geometry, &mut border_width); + + let border_rect = to_skia_rrect(&geometry, &stroke_border_radius); + + (background_rect, border_rect) + }; + + if let Some(mut fill_paint) = self.brush_to_paint( + rect.background(), + geometry.width_length(), + geometry.height_length(), + ) { + fill_paint.set_style(skia_safe::PaintStyle::Fill); + if !background_rect.is_rect() { + fill_paint.set_anti_alias(true); + } + self.canvas.draw_rrect(background_rect, &fill_paint); + } + + if border_width.get() > 0.0 + && let Some(mut border_paint) = + self.brush_to_paint(border_color, geometry.width_length(), geometry.height_length()) + { + border_paint.set_style(skia_safe::PaintStyle::Stroke); + border_paint.set_stroke_width(border_width.get()); + if !border_rect.is_rect() { + border_paint.set_anti_alias(true); + } + self.canvas.draw_rrect(border_rect, &border_paint); + } + } + + fn draw_window_background( + &mut self, + _rect: Pin<&dyn i_slint_core::item_rendering::RenderRectangle>, + _self_rc: &ItemRc, + _size: LogicalSize, + _cache: &CachedRenderingData, + ) { + // The background is drawn directly by FemtoVG renderer (via clear_color, if necessary). + } + + fn draw_image( + &mut self, + image: Pin<&dyn RenderImage>, + self_rc: &ItemRc, + size: LogicalSize, + _cache: &CachedRenderingData, + ) { + let geometry = PhysicalRect::from(size * self.scale_factor); + if geometry.is_empty() { + return; + } + self.draw_image_impl(self_rc, image, geometry); + } + + fn draw_text( + &mut self, + text: Pin<&dyn RenderText>, + self_rc: &i_slint_core::items::ItemRc, + size: LogicalSize, + _cache: &CachedRenderingData, + ) { + let restore = self.save_canvas_and_pixel_align_origin(); + sharedparley::draw_text(self, text, Some(self_rc), size, Some(self.text_layout_cache)); + if restore { + self.canvas.restore(); + } + } + + fn draw_text_input( + &mut self, + text_input: Pin<&i_slint_core::items::TextInput>, + self_rc: &i_slint_core::items::ItemRc, + size: LogicalSize, + ) { + let restore = self.save_canvas_and_pixel_align_origin(); + sharedparley::draw_text_input(self, text_input, self_rc, size, None); + if restore { + self.canvas.restore(); + } + } + + fn draw_path( + &mut self, + path: Pin<&i_slint_core::items::Path>, + item_rc: &i_slint_core::items::ItemRc, + size: LogicalSize, + ) { + let geometry = PhysicalRect::from(size * self.scale_factor); + + let (physical_offset, skpath): (crate::euclid::Vector2D, _) = + match self.path_cache.get_or_update_cache_entry(item_rc, || { + let (logical_offset, path_events): (crate::euclid::Vector2D, _) = + path.fitted_path_events(item_rc)?; + + let mut skpath = skia_safe::Path::new(); + + for x in path_events.iter() { + match x { + lyon_path::Event::Begin { at } => { + skpath.move_to(to_skia_point( + LogicalPoint::from_untyped(at) * self.scale_factor, + )); + } + lyon_path::Event::Line { from: _, to } => { + skpath.line_to(to_skia_point( + LogicalPoint::from_untyped(to) * self.scale_factor, + )); + } + lyon_path::Event::Quadratic { from: _, ctrl, to } => { + skpath.quad_to( + to_skia_point(LogicalPoint::from_untyped(ctrl) * self.scale_factor), + to_skia_point(LogicalPoint::from_untyped(to) * self.scale_factor), + ); + } + + lyon_path::Event::Cubic { from: _, ctrl1, ctrl2, to } => { + skpath.cubic_to( + to_skia_point( + LogicalPoint::from_untyped(ctrl1) * self.scale_factor, + ), + to_skia_point( + LogicalPoint::from_untyped(ctrl2) * self.scale_factor, + ), + to_skia_point(LogicalPoint::from_untyped(to) * self.scale_factor), + ); + } + lyon_path::Event::End { last: _, first: _, close } => { + if close { + skpath.close(); + } + } + } + } + + (logical_offset * self.scale_factor, skpath).into() + }) { + Some(offset_and_path) => offset_and_path, + None => return, + }; + + self.canvas.translate((physical_offset.x, physical_offset.y)); + + let anti_alias = path.anti_alias(); + + // For Path elements with conic gradients, we need to handle the viewbox transformation + let viewbox_width = path.viewbox_width(); + let viewbox_height = path.viewbox_height(); + + let paint = if viewbox_width > 0.0 && viewbox_height > 0.0 { + // If there's a viewbox, we need to create the gradient in viewbox space + // and then transform it to the actual size + let scale_x = geometry.width() / viewbox_width; + let scale_y = geometry.height() / viewbox_height; + + let paint = self.default_paint().unwrap_or_default(); + if let Some((mut paint, shader)) = Self::brush_to_shader( + paint, + path.fill(), + PhysicalLength::new(viewbox_width), + PhysicalLength::new(viewbox_height), + ) { + // Apply the viewbox transformation to the shader + let transform = skia_safe::Matrix::scale((scale_x, scale_y)); + paint.set_shader(shader.with_local_matrix(&transform)); + Some(paint) + } else { + None + } + } else { + self.brush_to_paint(path.fill(), geometry.width_length(), geometry.height_length()) + }; + + if let Some(mut fill_paint) = paint { + fill_paint.set_anti_alias(anti_alias); + self.canvas.draw_path(&skpath, &fill_paint); + } + if let Some(mut border_paint) = + self.brush_to_paint(path.stroke(), geometry.width_length(), geometry.height_length()) + { + border_paint.set_anti_alias(anti_alias); + border_paint.set_stroke_width((path.stroke_width() * self.scale_factor).get()); + border_paint.set_stroke_cap(match path.stroke_line_cap() { + i_slint_core::items::LineCap::Round => skia_safe::PaintCap::Round, + i_slint_core::items::LineCap::Square => skia_safe::PaintCap::Square, + i_slint_core::items::LineCap::Butt | _ => skia_safe::PaintCap::Butt, + }); + border_paint.set_stroke_join(match path.stroke_line_join() { + i_slint_core::items::LineJoin::Round => skia_safe::PaintJoin::Round, + i_slint_core::items::LineJoin::Bevel => skia_safe::PaintJoin::Bevel, + i_slint_core::items::LineJoin::Miter | _ => skia_safe::PaintJoin::Miter, + }); + border_paint.set_stroke_miter(path.stroke_miter_limit()); + border_paint.set_stroke(true); + self.canvas.draw_path(&skpath, &border_paint); + } + } + + fn draw_box_shadow( + &mut self, + box_shadow: Pin<&i_slint_core::items::BoxShadow>, + self_rc: &i_slint_core::items::ItemRc, + _size: LogicalSize, + ) { + let offset = LogicalPoint::from_lengths(box_shadow.offset_x(), box_shadow.offset_y()) + * self.scale_factor; + + if offset.x == 0. && offset.y == 0. && box_shadow.blur() == LogicalLength::zero() { + return; + } + + let cached_shadow_image = self.box_shadow_cache.get_box_shadow( + self_rc, + self.image_cache, + box_shadow, + self.scale_factor, + |shadow_options| { + let shadow_size: skia_safe::Size = ( + shadow_options.width.get() + shadow_options.blur.get() * 2., + shadow_options.height.get() + shadow_options.blur.get() * 2., + ) + .into(); + + let image_info = skia_safe::ImageInfo::new( + shadow_size.to_ceil(), + skia_safe::ColorType::RGBA8888, + skia_safe::AlphaType::Premul, + None, + ); + + let rounded_rect = skia_safe::RRect::new_rect_xy( + skia_safe::Rect::from_xywh( + shadow_options.blur.get(), + shadow_options.blur.get(), + shadow_options.width.get(), + shadow_options.height.get(), + ), + shadow_options.radius.get(), + shadow_options.radius.get(), + ); + + let mut paint = skia_safe::Paint::default(); + paint.set_color(to_skia_color(&shadow_options.color)); + paint.set_anti_alias(true); + paint.set_mask_filter(skia_safe::MaskFilter::blur( + skia_safe::BlurStyle::Normal, + shadow_options.blur.get() / 2., + None, + )); + + let mut surface = self.canvas.new_surface(&image_info, None)?; + let canvas = surface.canvas(); + canvas.clear(skia_safe::Color::TRANSPARENT); + canvas.draw_rrect(rounded_rect, &paint); + Some(surface.image_snapshot()) + }, + ); + + let cached_shadow_image = match cached_shadow_image { + Some(img) => img, + None => return, + }; + + let blur = box_shadow.blur() * self.scale_factor; + self.canvas.draw_image( + cached_shadow_image, + to_skia_point(offset - PhysicalPoint::from_lengths(blur, blur).to_vector()), + self.default_paint().as_ref(), + ); + } + + fn combine_clip( + &mut self, + rect: LogicalRect, + radius: LogicalBorderRadius, + border_width: LogicalLength, + ) -> bool { + let mut rect = rect * self.scale_factor; + let mut border_width = border_width * self.scale_factor; + // In CSS the border is entirely towards the inside of the boundary + // geometry, while in femtovg the line with for a stroke is 50% in- + // and 50% outwards. We choose the CSS model, so the inner rectangle + // is adjusted accordingly. + adjust_rect_and_border_for_inner_drawing(&mut rect, &mut border_width); + + let radius = radius * self.scale_factor; + let rounded_rect = to_skia_rrect(&rect, &radius); + self.canvas.clip_rrect(rounded_rect, None, true); + self.canvas.local_clip_bounds().is_some() + } + + fn get_current_clip(&self) -> LogicalRect { + from_skia_rect(&self.canvas.local_clip_bounds().unwrap_or_default()) / self.scale_factor + } + + fn translate(&mut self, distance: LogicalVector) { + self.current_state.transform = self.current_state.transform.pre_translate(distance.cast()); + let distance = distance * self.scale_factor; + self.canvas.translate(skia_safe::Vector::from((distance.x, distance.y))); + } + + fn current_transform(&self) -> i_slint_core::lengths::ItemTransform { + self.current_state.transform + } + + fn rotate(&mut self, angle_in_degrees: f32) { + self.current_state.transform = + self.current_state.transform.pre_rotate(euclid::Angle::degrees(angle_in_degrees)); + self.canvas.rotate(angle_in_degrees, None); + } + + fn scale(&mut self, x_factor: f32, y_factor: f32) { + self.current_state.transform = self.current_state.transform.pre_scale(x_factor, y_factor); + self.canvas.scale((x_factor, y_factor)); + } + + fn apply_opacity(&mut self, opacity: f32) { + self.current_state.alpha *= opacity; + } + + fn save_state(&mut self) { + self.canvas.save(); + self.state_stack.push(self.current_state); + } + + fn restore_state(&mut self) { + self.current_state = self.state_stack.pop().unwrap(); + self.canvas.restore(); + } + + fn scale_factor(&self) -> f32 { + self.scale_factor.get() + } + + fn draw_cached_pixmap( + &mut self, + item_rc: &i_slint_core::items::ItemRc, + update_fn: &dyn Fn(&mut dyn FnMut(u32, u32, &[u8])), + ) { + let skia_image = self.image_cache.get_or_update_cache_entry(item_rc, || { + let mut cached_image = None; + update_fn(&mut |width: u32, height: u32, data: &[u8]| { + let image_info = skia_safe::ImageInfo::new( + skia_safe::ISize::new(width as i32, height as i32), + skia_safe::ColorType::RGBA8888, + skia_safe::AlphaType::Premul, + None, + ); + cached_image = skia_safe::images::raster_from_data( + &image_info, + skia_safe::Data::new_copy(data), + width as usize * 4, + ); + }); + cached_image + }); + let skia_image = match skia_image { + Some(img) => img, + None => return, + }; + let _saved_canvas = self.pixel_align_origin_auto_restore(); + self.canvas.draw_image(skia_image, skia_safe::Point::default(), None); + } + + fn draw_string(&mut self, string: &str, color: i_slint_core::Color) { + sharedparley::draw_text( + self, + std::pin::pin!((SharedString::from(string), Brush::from(color))), + None, + logical_size_from_api(self.window.size().to_logical(self.scale_factor())), + None, + ); + } + + fn draw_image_direct(&mut self, image: i_slint_core::graphics::Image) { + let skia_image = super::cached_image::as_skia_image( + image.clone(), + &|| LogicalSize::from_untyped(image.size().cast()), + ImageFit::Fill, + self.scale_factor, + self.canvas, + self.surface, + ); + + let skia_image = match skia_image { + Some(img) => img, + None => return, + }; + + self.canvas.draw_image( + skia_image, + skia_safe::Point::default(), + self.default_paint().as_ref(), + ); + } + + fn window(&self) -> &i_slint_core::window::WindowInner { + i_slint_core::window::WindowInner::from_pub(self.window) + } + + fn as_any(&mut self) -> Option<&mut dyn core::any::Any> { + None + } + + fn visit_opacity( + &mut self, + opacity_item: Pin<&Opacity>, + item_rc: &ItemRc, + _size: LogicalSize, + ) -> RenderingResult { + let opacity = opacity_item.opacity(); + if Opacity::need_layer(item_rc, opacity) { + self.canvas.save_layer_alpha(None, (opacity * 255.) as u32); + self.state_stack.push(self.current_state); + self.current_state.alpha = 1.0; + + let window_adapter = WindowInner::from_pub(self.window).window_adapter(); + + i_slint_core::item_rendering::render_item_children( + self, + item_rc.item_tree(), + item_rc.index() as isize, + &window_adapter, + ); + + self.current_state = self.state_stack.pop().unwrap(); + self.canvas.restore(); + RenderingResult::ContinueRenderingWithoutChildren + } else { + self.apply_opacity(opacity); + RenderingResult::ContinueRenderingChildren + } + } + + fn visit_layer( + &mut self, + layer_item: Pin<&Layer>, + self_rc: &ItemRc, + _size: LogicalSize, + ) -> RenderingResult { + if layer_item.cache_rendering_hint() { + self.render_and_blend_layer(self_rc) + } else { + self.image_cache.release(self_rc); + RenderingResult::ContinueRenderingChildren + } + } +} + +impl GlyphRenderer for SkiaItemRenderer<'_> { + type PlatformBrush = skia_safe::Paint; + + fn platform_text_fill_brush( + &mut self, + brush: i_slint_core::Brush, + size: LogicalSize, + ) -> Option { + self.brush_to_paint( + brush, + size.width_length() * self.scale_factor, + size.height_length() * self.scale_factor, + ) + } + + fn platform_brush_for_color( + &mut self, + color: &i_slint_core::Color, + ) -> Option { + if color.alpha() == 0 { + None + } else { + let mut paint = self.default_paint().unwrap_or_default(); + paint.set_shader(skia_safe::shaders::color(to_skia_color(color))); + Some(paint) + } + } + + fn platform_text_stroke_brush( + &mut self, + brush: i_slint_core::Brush, + physical_stroke_width: f32, + size: LogicalSize, + ) -> Option { + match self.brush_to_paint( + brush.clone(), + size.width_length() * self.scale_factor, + size.height_length() * self.scale_factor, + ) { + Some(mut stroke_paint) => { + stroke_paint.set_style(skia_safe::PaintStyle::Stroke); + stroke_paint.set_stroke_width(physical_stroke_width); + // Set stroke cap/join/miter to match FemtoVG + stroke_paint.set_stroke_cap(skia_safe::PaintCap::Butt); + stroke_paint.set_stroke_join(skia_safe::PaintJoin::Miter); + stroke_paint.set_stroke_miter(10.0); + Some(stroke_paint) + } + None => None, + } + } + + fn draw_glyph_run( + &mut self, + font: &sharedparley::parley::FontData, + font_size: PhysicalLength, + _normalized_coords: &[i16], + synthesis: &fontique::Synthesis, + brush: Self::PlatformBrush, + y_offset: sharedparley::PhysicalLength, + glyphs_it: &mut dyn Iterator, + ) { + let Some(type_face) = crate::font_cache::FONT_CACHE + .with_borrow_mut(|font_cache| font_cache.font_with_variations(font, synthesis)) + else { + return; + }; + let mut font = skia_safe::Font::from_typeface(type_face, font_size.get()); + font.set_subpixel(true); + + let (glyph_ids, glyph_positions): (Vec<_>, Vec<_>) = glyphs_it + .into_iter() + .map(|g| (g.id as skia_safe::GlyphId, skia_safe::Point::new(g.x, g.y + y_offset.get()))) + .unzip(); + + self.canvas.draw_glyphs_at( + &glyph_ids, + skia_safe::canvas::GlyphPositions::Points(&glyph_positions), + skia_safe::Point::default(), + &font, + &brush, + ); + } + + fn fill_rectangle( + &mut self, + physical_rect: sharedparley::PhysicalRect, + paint: Self::PlatformBrush, + ) { + self.canvas.draw_rect( + skia_safe::Rect::from_xywh( + physical_rect.min_x(), + physical_rect.min_y(), + physical_rect.width(), + physical_rect.height(), + ), + &paint, + ); + } +} + +pub fn from_skia_rect(rect: &skia_safe::Rect) -> PhysicalRect { + let top_left = euclid::Point2D::new(rect.left, rect.top); + let bottom_right = euclid::Point2D::new(rect.right, rect.bottom); + euclid::Box2D::new(top_left, bottom_right).to_rect() +} + +pub fn to_skia_rect(rect: &PhysicalRect) -> skia_safe::Rect { + skia_safe::Rect::from_xywh(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height) +} + +pub fn to_skia_rrect(rect: &PhysicalRect, radius: &PhysicalBorderRadius) -> skia_safe::RRect { + if let Some(radius) = radius.as_uniform() { + skia_safe::RRect::new_rect_xy(to_skia_rect(rect), radius, radius) + } else { + skia_safe::RRect::new_rect_radii( + to_skia_rect(rect), + &[ + skia_safe::Point::new(radius.top_left, radius.top_left), + skia_safe::Point::new(radius.top_right, radius.top_right), + skia_safe::Point::new(radius.bottom_right, radius.bottom_right), + skia_safe::Point::new(radius.bottom_left, radius.bottom_left), + ], + ) + } +} + +impl ItemRendererFeatures for SkiaItemRenderer<'_> { + const SUPPORTS_TRANSFORMATIONS: bool = true; +} + +pub fn to_skia_point(point: PhysicalPoint) -> skia_safe::Point { + skia_safe::Point::new(point.x, point.y) +} + +pub fn to_skia_size(size: &PhysicalSize) -> skia_safe::Size { + skia_safe::Size::new(size.width, size.height) +} + +pub fn to_skia_color(col: &Color) -> skia_safe::Color { + skia_safe::Color::from_argb(col.alpha(), col.red(), col.green(), col.blue()) +} + +fn adjust_rect_and_border_for_inner_drawing( + rect: &mut PhysicalRect, + border_width: &mut PhysicalLength, +) { + // If the border width exceeds the width, just fill the rectangle. + *border_width = border_width.min(rect.width_length() / 2.); + // adjust the size so that the border is drawn within the geometry + + rect.origin += PhysicalSize::from_lengths(*border_width / 2., *border_width / 2.); + rect.size -= PhysicalSize::from_lengths(*border_width, *border_width); +} diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/lib.rs b/crates/vendor/i-slint-renderer-skia-1.16.1/lib.rs new file mode 100644 index 000000000..faff11099 --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/lib.rs @@ -0,0 +1,1134 @@ +// Copyright © SixtyFPS GmbH +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +#![doc = include_str!("README.md")] +#![doc(html_logo_url = "https://slint.dev/logo/slint-logo-square-light.svg")] +#![cfg_attr(slint_nightly_test, feature(non_exhaustive_omitted_patterns_lint))] +#![cfg_attr(slint_nightly_test, warn(non_exhaustive_omitted_patterns))] + +#[cfg(any(target_vendor = "apple", skia_backend_vulkan))] +use std::cell::OnceCell; +use std::cell::{Cell, RefCell}; +use std::pin::Pin; +use std::rc::{Rc, Weak}; +use std::sync::Arc; + +use i_slint_core::Brush; +use i_slint_core::api::{ + GraphicsAPI, PhysicalSize as PhysicalWindowSize, RenderingNotifier, RenderingState, + SetRenderingNotifierError, Window, +}; +use i_slint_core::graphics::RequestedGraphicsAPI; +use i_slint_core::graphics::euclid::{self, Vector2D}; +use i_slint_core::graphics::rendering_metrics_collector::RenderingMetricsCollector; +use i_slint_core::graphics::{BorderRadius, SharedPixelBuffer}; +use i_slint_core::item_rendering::{ItemCache, ItemRenderer}; +use i_slint_core::item_tree::ItemTreeWeak; +use i_slint_core::lengths::{ + LogicalLength, LogicalPoint, LogicalRect, LogicalSize, PhysicalPx, ScaleFactor, +}; +use i_slint_core::partial_renderer::{DirtyRegion, PartialRenderingState}; +use i_slint_core::platform::PlatformError; +use i_slint_core::textlayout::sharedparley; +use i_slint_core::window::{WindowAdapter, WindowInner}; + +type PhysicalLength = euclid::Length; +type PhysicalRect = euclid::Rect; +type PhysicalSize = euclid::Size2D; +type PhysicalPoint = euclid::Point2D; +type PhysicalBorderRadius = BorderRadius; + +mod cached_image; +mod font_cache; +mod itemrenderer; + +#[cfg(skia_backend_software)] +pub mod software_surface; + +#[cfg(target_vendor = "apple")] +pub mod metal_surface; + +#[cfg(target_family = "windows")] +pub mod d3d_surface; + +#[cfg(skia_backend_vulkan)] +pub mod vulkan_surface; + +#[cfg(any(not(target_vendor = "apple"), target_os = "macos"))] +pub mod opengl_surface; + +#[cfg(feature = "wgpu-27")] +pub mod wgpu_27_surface; +#[cfg(feature = "wgpu-28")] +pub mod wgpu_28_surface; + +use i_slint_core::items::{ItemRc, TextWrap}; +use itemrenderer::to_skia_rect; +pub use skia_safe; + +cfg_if::cfg_if! { + if #[cfg(skia_backend_vulkan)] { + type DefaultSurface = vulkan_surface::VulkanSurface; + } else if #[cfg(skia_backend_opengl)] { + type DefaultSurface = opengl_surface::OpenGLSurface; + } else if #[cfg(skia_backend_metal)] { + type DefaultSurface = metal_surface::MetalSurface; + } else if #[cfg(skia_backend_software)] { + type DefaultSurface = software_surface::SoftwareSurface; + } +} + +fn create_default_surface( + context: &SkiaSharedContext, + window_handle: Arc, + display_handle: Arc, + size: PhysicalWindowSize, + requested_graphics_api: Option, +) -> Result, PlatformError> { + match DefaultSurface::new( + context, + window_handle.clone(), + display_handle.clone(), + size, + requested_graphics_api, + ) { + Ok(gpu_surface) => Ok(Box::new(gpu_surface) as Box), + #[cfg(skia_backend_software)] + Err(err) => { + i_slint_core::debug_log!( + "Failed to initialize Skia GPU renderer: {} . Falling back to software rendering", + err + ); + software_surface::SoftwareSurface::new( + context, + window_handle, + display_handle, + size, + None, + ) + .map(|r| Box::new(r) as Box) + } + #[cfg(not(skia_backend_software))] + Err(err) => Err(err), + } +} + +enum DirtyRegionDebugMode { + NoDebug, + Visualize, + Log, +} + +impl Default for DirtyRegionDebugMode { + fn default() -> Self { + match std::env::var("SLINT_SKIA_PARTIAL_RENDERING").as_deref() { + Ok("visualize") => DirtyRegionDebugMode::Visualize, + Ok("log") => DirtyRegionDebugMode::Log, + _ => DirtyRegionDebugMode::NoDebug, + } + } +} + +fn create_partial_renderer_state( + maybe_surface: Option<&dyn Surface>, +) -> Option { + maybe_surface + .map_or_else( + || std::env::var("SLINT_SKIA_PARTIAL_RENDERING").as_deref().is_ok(), + |surface| surface.use_partial_rendering(), + ) + .then(PartialRenderingState::default) +} + +#[derive(Default)] +struct SkiaSharedContextInner { + #[cfg(target_vendor = "apple")] + metal_context: OnceCell, + #[cfg(skia_backend_vulkan)] + vulkan_context: OnceCell, +} + +/// This data structure contains data that's intended to be shared across several instances of SkiaRenderer. +/// For example, for Vulkan rendering, this shares the Vulkan instance. +/// +/// Create an instance once and pass clones of it to the difference constructor functions, to ensure most +/// efficient resource usage. +#[derive(Clone, Default)] +pub struct SkiaSharedContext(#[allow(dead_code)] Rc); + +/// Use the SkiaRenderer when implementing a custom Slint platform where you deliver events to +/// Slint and want the scene to be rendered using Skia as underlying graphics library. +pub struct SkiaRenderer { + maybe_window_adapter: RefCell>>, + rendering_notifier: RefCell>>, + image_cache: ItemCache>, + layer_cache: ItemCache, skia_safe::Image)>>, + path_cache: ItemCache, skia_safe::Path)>>, + text_layout_cache: sharedparley::TextLayoutCache, + rendering_metrics_collector: RefCell>>, + rendering_first_time: Cell, + surface: RefCell>>, + surface_factory: fn( + &SkiaSharedContext, + window_handle: Arc, + display_handle: Arc, + size: PhysicalWindowSize, + requested_graphics_api: Option, + ) -> Result, PlatformError>, + pre_present_callback: RefCell>>, + partial_rendering_state: Option, + dirty_region_debug_mode: DirtyRegionDebugMode, + /// Tracking dirty regions indexed by buffer age - 1. More than 3 back buffers aren't supported, but also unlikely to happen. + dirty_region_history: RefCell<[DirtyRegion; 3]>, + shared_context: SkiaSharedContext, +} + +impl SkiaRenderer { + pub fn default(context: &SkiaSharedContext) -> Self { + Self { + maybe_window_adapter: Default::default(), + rendering_notifier: Default::default(), + image_cache: Default::default(), + layer_cache: Default::default(), + path_cache: Default::default(), + text_layout_cache: Default::default(), + rendering_metrics_collector: Default::default(), + rendering_first_time: Default::default(), + surface: Default::default(), + surface_factory: create_default_surface, + pre_present_callback: Default::default(), + partial_rendering_state: create_partial_renderer_state(None), + dirty_region_debug_mode: Default::default(), + dirty_region_history: Default::default(), + shared_context: context.clone(), + } + } + + #[cfg(skia_backend_software)] + /// Creates a new SkiaRenderer that will always use Skia's software renderer. + pub fn default_software(context: &SkiaSharedContext) -> Self { + Self { + maybe_window_adapter: Default::default(), + rendering_notifier: Default::default(), + image_cache: Default::default(), + layer_cache: Default::default(), + path_cache: Default::default(), + text_layout_cache: Default::default(), + rendering_metrics_collector: Default::default(), + rendering_first_time: Default::default(), + surface: Default::default(), + surface_factory: |context, + window_handle, + display_handle, + size, + requested_graphics_api| { + software_surface::SoftwareSurface::new( + context, + window_handle, + display_handle, + size, + requested_graphics_api, + ) + .map(|r| Box::new(r) as Box) + }, + pre_present_callback: Default::default(), + partial_rendering_state: PartialRenderingState::default().into(), + dirty_region_debug_mode: Default::default(), + dirty_region_history: Default::default(), + shared_context: context.clone(), + } + } + + #[cfg(any(not(target_vendor = "apple"), target_os = "macos"))] + /// Creates a new SkiaRenderer that will always use Skia's OpenGL renderer. + pub fn default_opengl(context: &SkiaSharedContext) -> Self { + Self { + maybe_window_adapter: Default::default(), + rendering_notifier: Default::default(), + image_cache: Default::default(), + layer_cache: Default::default(), + path_cache: Default::default(), + text_layout_cache: Default::default(), + rendering_metrics_collector: Default::default(), + rendering_first_time: Default::default(), + surface: Default::default(), + surface_factory: |context, + window_handle, + display_handle, + size, + requested_graphics_api| { + opengl_surface::OpenGLSurface::new( + context, + window_handle, + display_handle, + size, + requested_graphics_api, + ) + .map(|r| Box::new(r) as Box) + }, + pre_present_callback: Default::default(), + partial_rendering_state: create_partial_renderer_state(None), + dirty_region_debug_mode: Default::default(), + dirty_region_history: Default::default(), + shared_context: context.clone(), + } + } + + #[cfg(target_vendor = "apple")] + /// Creates a new SkiaRenderer that will always use Skia's Metal renderer. + pub fn default_metal(context: &SkiaSharedContext) -> Self { + Self { + maybe_window_adapter: Default::default(), + rendering_notifier: Default::default(), + image_cache: Default::default(), + layer_cache: Default::default(), + path_cache: Default::default(), + text_layout_cache: Default::default(), + rendering_metrics_collector: Default::default(), + rendering_first_time: Default::default(), + surface: Default::default(), + surface_factory: |context, + window_handle, + display_handle, + size, + requested_graphics_api| { + metal_surface::MetalSurface::new( + context, + window_handle, + display_handle, + size, + requested_graphics_api, + ) + .map(|r| Box::new(r) as Box) + }, + pre_present_callback: Default::default(), + partial_rendering_state: create_partial_renderer_state(None), + dirty_region_debug_mode: Default::default(), + dirty_region_history: Default::default(), + shared_context: context.clone(), + } + } + + #[cfg(skia_backend_vulkan)] + /// Creates a new SkiaRenderer that will always use Skia's Vulkan renderer. + pub fn default_vulkan(context: &SkiaSharedContext) -> Self { + Self { + maybe_window_adapter: Default::default(), + rendering_notifier: Default::default(), + image_cache: Default::default(), + layer_cache: Default::default(), + path_cache: Default::default(), + text_layout_cache: Default::default(), + rendering_metrics_collector: Default::default(), + rendering_first_time: Default::default(), + surface: Default::default(), + surface_factory: |context, + window_handle, + display_handle, + size, + requested_graphics_api| { + vulkan_surface::VulkanSurface::new( + context, + window_handle, + display_handle, + size, + requested_graphics_api, + ) + .map(|r| Box::new(r) as Box) + }, + pre_present_callback: Default::default(), + partial_rendering_state: create_partial_renderer_state(None), + dirty_region_debug_mode: Default::default(), + dirty_region_history: Default::default(), + shared_context: context.clone(), + } + } + + #[cfg(target_family = "windows")] + /// Creates a new SkiaRenderer that will always use Skia's Direct3D renderer. + pub fn default_direct3d(context: &SkiaSharedContext) -> Self { + Self { + maybe_window_adapter: Default::default(), + rendering_notifier: Default::default(), + image_cache: Default::default(), + layer_cache: Default::default(), + path_cache: Default::default(), + text_layout_cache: Default::default(), + rendering_metrics_collector: Default::default(), + rendering_first_time: Default::default(), + surface: Default::default(), + surface_factory: |context, + window_handle, + display_handle, + size, + requested_graphics_api| { + d3d_surface::D3DSurface::new( + context, + window_handle, + display_handle, + size, + requested_graphics_api, + ) + .map(|r| Box::new(r) as Box) + }, + pre_present_callback: Default::default(), + partial_rendering_state: create_partial_renderer_state(None), + dirty_region_debug_mode: Default::default(), + dirty_region_history: Default::default(), + shared_context: context.clone(), + } + } + + #[cfg(feature = "unstable-wgpu-27")] + /// Creates a new SkiaRenderer that will always use Skia's Vulkan renderer. + pub fn default_wgpu_27(context: &SkiaSharedContext) -> Self { + Self { + maybe_window_adapter: Default::default(), + rendering_notifier: Default::default(), + image_cache: Default::default(), + layer_cache: Default::default(), + path_cache: Default::default(), + text_layout_cache: Default::default(), + rendering_metrics_collector: Default::default(), + rendering_first_time: Default::default(), + surface: Default::default(), + surface_factory: |context, + window_handle, + display_handle, + size, + requested_graphics_api| { + wgpu_27_surface::WGPUSurface::new( + context, + window_handle, + display_handle, + size, + requested_graphics_api, + ) + .map(|r| Box::new(r) as Box) + }, + pre_present_callback: Default::default(), + partial_rendering_state: create_partial_renderer_state(None), + dirty_region_debug_mode: Default::default(), + dirty_region_history: Default::default(), + shared_context: context.clone(), + } + } + #[cfg(feature = "unstable-wgpu-28")] + /// Creates a new SkiaRenderer that will always use Skia's Vulkan renderer. + pub fn default_wgpu_28(context: &SkiaSharedContext) -> Self { + Self { + maybe_window_adapter: Default::default(), + rendering_notifier: Default::default(), + image_cache: Default::default(), + layer_cache: Default::default(), + path_cache: Default::default(), + text_layout_cache: Default::default(), + rendering_metrics_collector: Default::default(), + rendering_first_time: Default::default(), + surface: Default::default(), + surface_factory: |context, + window_handle, + display_handle, + size, + requested_graphics_api| { + wgpu_28_surface::WGPUSurface::new( + context, + window_handle, + display_handle, + size, + requested_graphics_api, + ) + .map(|r| Box::new(r) as Box) + }, + pre_present_callback: Default::default(), + partial_rendering_state: create_partial_renderer_state(None), + dirty_region_debug_mode: Default::default(), + dirty_region_history: Default::default(), + shared_context: context.clone(), + } + } + + /// Creates a new renderer is associated with the provided window adapter. + pub fn new( + context: &SkiaSharedContext, + window_handle: Arc, + display_handle: Arc, + size: PhysicalWindowSize, + ) -> Result { + Ok(Self::new_with_surface( + context, + create_default_surface(context, window_handle, display_handle, size, None)?, + )) + } + + /// Creates a new renderer with the given surface trait implementation. + pub fn new_with_surface( + context: &SkiaSharedContext, + surface: Box, + ) -> Self { + let partial_rendering_state = create_partial_renderer_state(Some(surface.as_ref())); + Self { + maybe_window_adapter: Default::default(), + rendering_notifier: Default::default(), + image_cache: Default::default(), + layer_cache: Default::default(), + path_cache: Default::default(), + text_layout_cache: Default::default(), + rendering_metrics_collector: Default::default(), + rendering_first_time: Cell::new(true), + surface: RefCell::new(Some(surface)), + surface_factory: |_, _, _, _, _| { + Err("Skia renderer constructed with surface does not support dynamic surface re-creation".into()) + }, + pre_present_callback: Default::default(), + partial_rendering_state, + dirty_region_debug_mode: Default::default(), + dirty_region_history: Default::default(), + shared_context: context.clone(), + } + } + + /// Reset the surface to a new surface. (destroy the previously set surface if any) + pub fn set_surface(&self, surface: Box) { + self.image_cache.clear_all(); + self.path_cache.clear_all(); + self.text_layout_cache.clear_all(); + self.rendering_first_time.set(true); + *self.surface.borrow_mut() = Some(surface); + } + + fn clear_surface(&self) { + let Some(surface) = self.surface.borrow_mut().take() else { + return; + }; + + // If we've rendered a frame before, then we need to invoke the RenderingTearDown notifier. + if !self.rendering_first_time.get() + && let Some(callback) = self.rendering_notifier.borrow_mut().as_mut() + { + surface + .with_active_surface(&mut || { + surface.with_graphics_api(&mut |api| { + callback.notify(RenderingState::RenderingTeardown, &api) + }) + }) + .ok(); + } + + drop(surface); + } + + /// Suspends the renderer by freeing all graphics related resources as well as the underlying + /// rendering surface. Call [`Self::set_window_handle()`] to re-associate the renderer with a new + /// window surface for subsequent rendering. + pub fn suspend(&self) -> Result<(), PlatformError> { + self.image_cache.clear_all(); + self.path_cache.clear_all(); + self.text_layout_cache.clear_all(); + // Destroy the old surface before allocating the new one, to work around + // the vivante drivers using zwp_linux_explicit_synchronization_v1 and + // trying to create a second synchronization object and that's not allowed. + self.clear_surface(); + Ok(()) + } + + /// Reset the surface to the window given the window handle + pub fn set_window_handle( + &self, + window_handle: Arc, + display_handle: Arc, + size: PhysicalWindowSize, + requested_graphics_api: Option, + ) -> Result<(), PlatformError> { + // just in case + self.suspend()?; + let surface = (self.surface_factory)( + &self.shared_context, + window_handle, + display_handle, + size, + requested_graphics_api, + )?; + self.set_surface(surface); + Ok(()) + } + + /// Render the scene in the previously associated window. + pub fn render(&self) -> Result<(), i_slint_core::platform::PlatformError> { + let window_adapter = self.window_adapter()?; + let size = window_adapter.window().size(); + self.internal_render_with_post_callback(0., (0., 0.), size, None) + } + + fn internal_render_with_post_callback( + &self, + rotation_angle_degrees: f32, + translation: (f32, f32), + surface_size: PhysicalWindowSize, + post_render_cb: Option<&dyn Fn(&mut dyn ItemRenderer)>, + ) -> Result<(), i_slint_core::platform::PlatformError> { + let surface = self.surface.borrow(); + let Some(surface) = surface.as_ref() else { return Ok(()) }; + if self.rendering_first_time.take() { + *self.rendering_metrics_collector.borrow_mut() = + RenderingMetricsCollector::new(&format!( + "Skia renderer (skia backend {}; surface: {} bpp)", + surface.name(), + surface.bits_per_pixel()? + )); + + if let Some(callback) = self.rendering_notifier.borrow_mut().as_mut() { + surface.with_graphics_api(&mut |api| { + callback.notify(RenderingState::RenderingSetup, &api) + }) + } + } + + let window_adapter = self.window_adapter()?; + let window = window_adapter.window(); + + surface.render( + window, + surface_size, + &|skia_canvas, gr_context, back_buffer_age| { + self.render_to_canvas( + skia_canvas, + rotation_angle_degrees, + translation, + gr_context, + back_buffer_age, + Some(surface.as_ref()), + window, + post_render_cb, + ) + }, + &self.pre_present_callback, + ) + } + + fn render_to_canvas( + &self, + skia_canvas: &skia_safe::Canvas, + rotation_angle_degrees: f32, + translation: (f32, f32), + gr_context: Option<&mut skia_safe::gpu::DirectContext>, + back_buffer_age: u8, + surface: Option<&dyn Surface>, + window: &i_slint_core::api::Window, + post_render_cb: Option<&dyn Fn(&mut dyn ItemRenderer)>, + ) -> Option { + skia_canvas.rotate(rotation_angle_degrees, None); + skia_canvas.translate(translation); + + let window_inner = WindowInner::from_pub(window); + + let dirty_region = window_inner + .draw_contents(|components| { + self.render_components_to_canvas( + skia_canvas, + gr_context, + back_buffer_age, + surface, + window, + post_render_cb, + components, + ) + }) + .unwrap_or_default(); + + if let Some(callback) = self.rendering_notifier.borrow_mut().as_mut() + && let Some(surface) = surface + { + surface + .with_graphics_api(&mut |api| callback.notify(RenderingState::AfterRendering, &api)) + } + + dirty_region + } + + fn render_components_to_canvas( + &self, + skia_canvas: &skia_safe::Canvas, + mut gr_context: Option<&mut skia_safe::gpu::DirectContext>, + back_buffer_age: u8, + surface: Option<&dyn Surface>, + window: &i_slint_core::api::Window, + post_render_cb: Option<&dyn Fn(&mut dyn ItemRenderer)>, + components: &[(ItemTreeWeak, LogicalPoint)], + ) -> Option { + let window_inner = WindowInner::from_pub(window); + let window_adapter = window_inner.window_adapter(); + + let mut box_shadow_cache = Default::default(); + + self.image_cache.clear_cache_if_scale_factor_changed(window); + self.path_cache.clear_cache_if_scale_factor_changed(window); + self.text_layout_cache.clear_cache_if_scale_factor_changed(window); + + let mut skia_item_renderer = itemrenderer::SkiaItemRenderer::new( + skia_canvas, + window, + surface, + &self.image_cache, + &self.layer_cache, + &self.path_cache, + &self.text_layout_cache, + &mut box_shadow_cache, + ); + + let scale_factor = ScaleFactor::new(window_inner.scale_factor()); + let logical_window_size = i_slint_core::lengths::logical_size_from_api( + window.size().to_logical(window_inner.scale_factor()), + ); + + let mut dirty_region = None; + + { + let mut item_renderer: &mut dyn ItemRenderer = &mut skia_item_renderer; + let mut partial_renderer; + let mut dirty_region_to_visualize = None; + + if let Some(partial_rendering_state) = self.partial_rendering_state() { + partial_renderer = + partial_rendering_state.create_partial_renderer(skia_item_renderer); + + let mut dirty_region_history = self.dirty_region_history.borrow_mut(); + + let buffer_dirty_region = if back_buffer_age > 0 + && back_buffer_age as usize - 1 < dirty_region_history.len() + { + // The dirty region is the union of all the previous dirty regions + Some( + dirty_region_history[0..back_buffer_age as usize - 1] + .iter() + .fold(DirtyRegion::default(), |acc, region| acc.union(region)), + ) + } else { + Some(LogicalRect::from_size(logical_window_size).into()) + }; + + let dirty_region_for_this_frame = partial_rendering_state.apply_dirty_region( + &mut partial_renderer, + components, + logical_window_size, + buffer_dirty_region, + ); + + let mut clip_path = skia_safe::Path::new(); + + for dirty_rect in partial_renderer.dirty_region.iter() { + let physical_rect = (dirty_rect * scale_factor).to_rect().round_out(); + clip_path.add_rect(to_skia_rect(&physical_rect), None); + } + + if matches!(self.dirty_region_debug_mode, DirtyRegionDebugMode::Log) { + let area_to_repaint: f32 = + partial_renderer.dirty_region.iter().map(|b| b.area()).sum(); + i_slint_core::debug_log!( + "repainting {:.2}%", + area_to_repaint * 100. / logical_window_size.area() + ); + } + + dirty_region = partial_renderer.dirty_region.clone().into(); + + dirty_region_history.rotate_right(1); + dirty_region_history[0] = dirty_region_for_this_frame; + + skia_canvas.clip_path(&clip_path, None, false); + + if matches!(self.dirty_region_debug_mode, DirtyRegionDebugMode::Visualize) { + dirty_region_to_visualize = Some(clip_path); + } + + item_renderer = &mut partial_renderer; + } + + if let Some(window_item_rc) = window_inner.window_item_rc() { + let window_item = + window_item_rc.downcast::().unwrap(); + if let Brush::SolidColor(clear_color) = window_item.as_pin_ref().background() { + skia_canvas.clear(itemrenderer::to_skia_color(&clear_color)); + } else { + // Draws the window background as gradient + item_renderer.draw_rectangle( + window_item.as_pin_ref(), + &window_item_rc, + i_slint_core::lengths::logical_size_from_api( + window.size().to_logical(window_inner.scale_factor()), + ), + &window_item.as_pin_ref().cached_rendering_data, + ); + } + } + + if let Some(callback) = self.rendering_notifier.borrow_mut().as_mut() { + // For the BeforeRendering rendering notifier callback it's important that this happens *after* clearing + // the back buffer, in order to allow the callback to provide its own rendering of the background. + // Skia's clear() will merely schedule a clear call, so flush right away to make it immediate. + if let Some(ctx) = gr_context.as_mut() { + ctx.flush(None); + } + + if let Some(surface) = surface { + surface.with_graphics_api(&mut |api| { + callback.notify(RenderingState::BeforeRendering, &api) + }) + } + } + + for (component, origin) in components { + if let Some(component) = ItemTreeWeak::upgrade(component) { + i_slint_core::item_rendering::render_component_items( + &component, + item_renderer, + *origin, + &window_adapter, + ); + } + } + + if let Some(path) = dirty_region_to_visualize { + let mut paint = skia_safe::Paint::new( + skia_safe::Color4f { a: 0.5, r: 1.0, g: 0., b: 0. }, + None, + ); + paint.set_style(skia_safe::PaintStyle::Stroke); + skia_canvas.draw_path(&path, &paint); + } + + if let Some(collector) = &self.rendering_metrics_collector.borrow_mut().as_ref() { + collector.measure_frame_rendered(item_renderer, Default::default()); + if collector.refresh_mode() + == i_slint_core::graphics::rendering_metrics_collector::RefreshMode::FullSpeed + && let Some(partial_rendering_state) = self.partial_rendering_state() + { + partial_rendering_state.force_screen_refresh(); + } + } + + if let Some(cb) = post_render_cb.as_ref() { + cb(item_renderer) + } + } + + if let Some(ctx) = gr_context.as_mut() { + ctx.flush(None); + } + + dirty_region + } + + fn window_adapter(&self) -> Result, PlatformError> { + self.maybe_window_adapter.borrow().as_ref().and_then(|w| w.upgrade()).ok_or_else(|| { + "Renderer must be associated with component before use".to_string().into() + }) + } + + /// Sets the specified callback, that's invoked before presenting the rendered buffer to the windowing system. + /// This can be useful to implement frame throttling, i.e. for requesting a frame callback from the wayland compositor. + pub fn set_pre_present_callback(&self, callback: Option>) { + *self.pre_present_callback.borrow_mut() = callback; + } + + fn partial_rendering_state(&self) -> Option<&PartialRenderingState> { + // We don't know where the application might render to, so disable partial rendering. + if self.rendering_notifier.borrow().is_some() { + None + } else { + self.partial_rendering_state.as_ref() + } + } +} + +impl i_slint_core::renderer::RendererSealed for SkiaRenderer { + fn text_size( + &self, + text_item: Pin<&dyn i_slint_core::item_rendering::RenderString>, + item_rc: &ItemRc, + max_width: Option, + text_wrap: TextWrap, + ) -> LogicalSize { + sharedparley::text_size( + self, + text_item, + item_rc, + max_width, + text_wrap, + Some(&self.text_layout_cache), + ) + .unwrap_or_default() + } + + fn char_size( + &self, + text_item: Pin<&dyn i_slint_core::item_rendering::HasFont>, + item_rc: &i_slint_core::item_tree::ItemRc, + ch: char, + ) -> LogicalSize { + self.slint_context() + .and_then(|ctx| { + let mut font_ctx = ctx.font_context().borrow_mut(); + sharedparley::char_size(&mut font_ctx, text_item, item_rc, ch) + }) + .unwrap_or_default() + } + + fn font_metrics( + &self, + font_request: i_slint_core::graphics::FontRequest, + ) -> i_slint_core::items::FontMetrics { + self.slint_context() + .map(|ctx| { + let mut font_ctx = ctx.font_context().borrow_mut(); + sharedparley::font_metrics(&mut font_ctx, font_request) + }) + .unwrap_or_default() + } + + fn text_input_byte_offset_for_position( + &self, + text_input: std::pin::Pin<&i_slint_core::items::TextInput>, + item_rc: &i_slint_core::item_tree::ItemRc, + pos: LogicalPoint, + ) -> usize { + sharedparley::text_input_byte_offset_for_position(self, text_input, item_rc, pos) + } + + fn text_input_cursor_rect_for_byte_offset( + &self, + text_input: std::pin::Pin<&i_slint_core::items::TextInput>, + item_rc: &i_slint_core::item_tree::ItemRc, + byte_offset: usize, + ) -> LogicalRect { + sharedparley::text_input_cursor_rect_for_byte_offset(self, text_input, item_rc, byte_offset) + } + + fn register_font_from_memory( + &self, + data: &'static [u8], + ) -> Result<(), Box> { + let ctx = self.slint_context().ok_or("slint platform not initialized")?; + ctx.font_context().borrow_mut().collection.register_fonts(data.to_vec().into(), None); + Ok(()) + } + + fn register_font_from_path( + &self, + path: &std::path::Path, + ) -> Result<(), Box> { + let requested_path = path.canonicalize().unwrap_or_else(|_| path.into()); + let contents = std::fs::read(requested_path)?; + let ctx = self.slint_context().ok_or("slint platform not initialized")?; + ctx.font_context().borrow_mut().collection.register_fonts(contents.into(), None); + Ok(()) + } + + fn set_rendering_notifier( + &self, + callback: Box, + ) -> std::result::Result<(), SetRenderingNotifierError> { + let mut notifier = self.rendering_notifier.borrow_mut(); + if notifier.replace(callback).is_some() { + Err(SetRenderingNotifierError::AlreadySet) + } else { + Ok(()) + } + } + + fn default_font_size(&self) -> LogicalLength { + sharedparley::DEFAULT_FONT_SIZE + } + + fn free_graphics_resources( + &self, + component: i_slint_core::item_tree::ItemTreeRef, + items: &mut dyn Iterator>>, + ) -> Result<(), i_slint_core::platform::PlatformError> { + self.image_cache.component_destroyed(component); + self.path_cache.component_destroyed(component); + self.text_layout_cache.component_destroyed(component); + + if let Some(partial_rendering_state) = self.partial_rendering_state() { + partial_rendering_state.free_graphics_resources(items); + } + + Ok(()) + } + + fn set_window_adapter(&self, window_adapter: &Rc) { + *self.maybe_window_adapter.borrow_mut() = Some(Rc::downgrade(window_adapter)); + self.image_cache.clear_all(); + self.path_cache.clear_all(); + self.text_layout_cache.clear_all(); + + if let Some(partial_rendering_state) = self.partial_rendering_state() { + partial_rendering_state.clear_cache(); + } + } + + fn window_adapter(&self) -> Option> { + self.maybe_window_adapter + .borrow() + .as_ref() + .and_then(|window_adapter| window_adapter.upgrade()) + } + + fn resize(&self, size: i_slint_core::api::PhysicalSize) -> Result<(), PlatformError> { + if size.width == 0 || size.height == 0 { + return Ok(()); + } + + if let Some(surface) = self.surface.borrow().as_ref() { + surface.resize_event(size) + } else { + Ok(()) + } + } + + /// Returns an image buffer of what was rendered last by reading the previous front buffer (using glReadPixels). + fn take_snapshot( + &self, + ) -> Result, PlatformError> { + let window_adapter = self.window_adapter()?; + let window = window_adapter.window(); + let size = window_adapter.window().size(); + let (width, height) = (size.width, size.height); + let mut target_buffer = + SharedPixelBuffer::::new(width, height); + + let mut surface_borrow = skia_safe::surfaces::wrap_pixels( + &skia_safe::ImageInfo::new( + (width as i32, height as i32), + skia_safe::ColorType::RGBA8888, + skia_safe::AlphaType::Opaque, + None, + ), + target_buffer.make_mut_bytes(), + None, + None, + ) + .ok_or_else(|| "Error wrapping target buffer for rendering into with Skia".to_string())?; + + self.render_to_canvas(surface_borrow.canvas(), 0., (0.0, 0.0), None, 0, None, window, None); + + Ok(target_buffer) + } + + fn mark_dirty_region(&self, region: DirtyRegion) { + if let Some(partial_rendering_state) = self.partial_rendering_state() { + partial_rendering_state.mark_dirty_region(region); + } + } + + fn supports_transformations(&self) -> bool { + true + } +} + +impl Drop for SkiaRenderer { + fn drop(&mut self) { + self.clear_surface() + } +} + +/// This trait represents the interface between the Skia renderer and the underlying rendering surface, such as a window +/// with a metal layer, a wayland window with an OpenGL context, etc. +pub trait Surface { + /// Creates a new surface with the given window, display, and size. + fn new( + shared_context: &SkiaSharedContext, + window_handle: Arc, + display_handle: Arc, + size: PhysicalWindowSize, + requested_graphics_api: Option, + ) -> Result + where + Self: Sized; + /// Returns the name of the surface, for diagnostic purposes. + fn name(&self) -> &'static str; + + /// If supported, this invokes the specified callback with access to the platform graphics API. + fn with_graphics_api(&self, _callback: &mut dyn FnMut(GraphicsAPI<'_>)) {} + /// Invokes the callback with the surface active. This has only a meaning for OpenGL rendering, where + /// the implementation must make the GL context current. + fn with_active_surface( + &self, + callback: &mut dyn FnMut(), + ) -> Result<(), i_slint_core::platform::PlatformError> { + callback(); + Ok(()) + } + /// Prepares the surface for rendering and invokes the provided callback with access to a Skia canvas and + /// rendering context. + fn render( + &self, + window: &Window, + size: PhysicalWindowSize, + render_callback: &dyn Fn( + &skia_safe::Canvas, + Option<&mut skia_safe::gpu::DirectContext>, + u8, + ) -> Option, + pre_present_callback: &RefCell>>, + ) -> Result<(), i_slint_core::platform::PlatformError>; + /// Called when the surface should be resized. + fn resize_event( + &self, + size: PhysicalWindowSize, + ) -> Result<(), i_slint_core::platform::PlatformError>; + fn bits_per_pixel(&self) -> Result; + + fn use_partial_rendering(&self) -> bool { + false + } + + fn import_opengl_texture( + &self, + _canvas: &skia_safe::Canvas, + _texture: &i_slint_core::graphics::BorrowedOpenGLTexture, + ) -> Option { + None + } + + #[cfg(any(feature = "unstable-wgpu-27", feature = "unstable-wgpu-28"))] + fn import_wgpu_texture( + &self, + _canvas: &skia_safe::Canvas, + _texture: &i_slint_core::graphics::WGPUTexture, + ) -> Option { + None + } + + /// Implementations should return self to allow upcasting. + fn as_any(&self) -> &dyn core::any::Any { + &() + } +} + +pub trait SkiaRendererExt { + fn render_transformed_with_post_callback( + &self, + rotation_angle_degrees: f32, + translation: (f32, f32), + surface_size: PhysicalWindowSize, + post_render_cb: Option<&dyn Fn(&mut dyn ItemRenderer)>, + ) -> Result<(), i_slint_core::platform::PlatformError>; +} + +impl SkiaRendererExt for SkiaRenderer { + fn render_transformed_with_post_callback( + &self, + rotation_angle_degrees: f32, + translation: (f32, f32), + surface_size: PhysicalWindowSize, + post_render_cb: Option<&dyn Fn(&mut dyn ItemRenderer)>, + ) -> Result<(), i_slint_core::platform::PlatformError> { + self.internal_render_with_post_callback( + rotation_angle_degrees, + translation, + surface_size, + post_render_cb, + ) + } +} diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/metal_surface.rs b/crates/vendor/i-slint-renderer-skia-1.16.1/metal_surface.rs new file mode 100644 index 000000000..9e5fdab15 --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/metal_surface.rs @@ -0,0 +1,268 @@ +// Copyright © SixtyFPS GmbH +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +use i_slint_core::api::{PhysicalSize as PhysicalWindowSize, Window}; +use i_slint_core::graphics::RequestedGraphicsAPI; +use i_slint_core::partial_renderer::DirtyRegion; +use objc2::rc::autoreleasepool; +use objc2::{rc::Retained, runtime::ProtocolObject}; +use objc2_core_foundation::CGSize; +use objc2_metal::{MTLCommandBuffer, MTLCommandQueue, MTLDevice, MTLPixelFormat, MTLTexture}; +use objc2_quartz_core::{CAMetalDrawable, CAMetalLayer}; + +use skia_safe::gpu::mtl; + +use std::cell::RefCell; +use std::sync::Arc; + +use crate::SkiaSharedContext; + +pub struct SharedMetalContext { + device: Retained>, + command_queue: Retained>, +} + +impl super::SkiaSharedContextInner { + fn shared_metal_context( + &self, + ) -> Result<&SharedMetalContext, i_slint_core::platform::PlatformError> { + if let Some(ctx) = self.metal_context.get() { + return Ok(ctx); + } + self.metal_context.set(SharedMetalContext::new()?).ok(); + Ok(self.metal_context.get().unwrap()) + } +} + +impl SharedMetalContext { + fn new() -> Result { + let device = objc2_metal::MTLCreateSystemDefaultDevice().ok_or_else(|| { + "Skia Renderer: Unable to obtain metal system default device".to_string() + })?; + let command_queue = device + .newCommandQueue() + .ok_or_else(|| "Skia Renderer: Unable to create command queue".to_string())?; + Ok(Self { device, command_queue }) + } +} + +/// This surface renders into the given window using Metal. The provided display argument +/// is ignored, as it has no meaning on macOS. +pub struct MetalSurface { + command_queue: Retained>, + layer: raw_window_metal::Layer, + gr_context: RefCell, + // Map from drawable texture to age. Per https://developer.apple.com/documentation/quartzcore/cametallayer/maximumdrawablecount, CAMetalLayer + // can have either 2 or 3 drawables, but not more. That way, this vector is bound in growth. + drawable_ages: RefCell>, +} + +impl super::Surface for MetalSurface { + fn new( + shared_context: &SkiaSharedContext, + window_handle: Arc, + _display_handle: Arc, + size: PhysicalWindowSize, + requested_graphics_api: Option, + ) -> Result { + if requested_graphics_api.is_some_and(|api| !matches!(api, RequestedGraphicsAPI::Metal)) { + return Err("Requested non-Metal rendering with Metal renderer".into()); + } + + let layer = match window_handle + .window_handle() + .map_err(|e| format!("Error obtaining window handle for skia metal renderer: {e}"))? + .as_raw() + { + raw_window_handle::RawWindowHandle::AppKit(handle) => unsafe { + raw_window_metal::Layer::from_ns_view(handle.ns_view) + }, + raw_window_handle::RawWindowHandle::UiKit(handle) => unsafe { + raw_window_metal::Layer::from_ui_view(handle.ui_view) + }, + _ => return Err("Skia Renderer: Metal surface is only supported with AppKit".into()), + }; + + // SAFETY: The pointer is a valid `CAMetalLayer`. + let ca_layer: &CAMetalLayer = unsafe { layer.as_ptr().cast().as_ref() }; + + let shared_context = shared_context.0.shared_metal_context()?; + + let device = &shared_context.device; + + ca_layer.setDevice(Some(device)); + ca_layer.setPixelFormat(MTLPixelFormat::BGRA8Unorm); + ca_layer.setOpaque(false); + ca_layer.setPresentsWithTransaction(false); + + ca_layer.setDrawableSize(CGSize::new(size.width as f64, size.height as f64)); + + let flipped = ca_layer.contentsAreFlipped(); + let gravity = if !flipped { + unsafe { objc2_quartz_core::kCAGravityTopLeft } + } else { + unsafe { objc2_quartz_core::kCAGravityBottomLeft } + }; + ca_layer.setContentsGravity(gravity); + + let command_queue = shared_context.command_queue.clone(); + + let backend = unsafe { + mtl::BackendContext::new( + Retained::as_ptr(device) as mtl::Handle, + Retained::as_ptr(&command_queue) as mtl::Handle, + ) + }; + + let gr_context = + skia_safe::gpu::direct_contexts::make_metal(&backend, None).unwrap().into(); + + Ok(Self { command_queue, layer, gr_context, drawable_ages: Default::default() }) + } + + fn name(&self) -> &'static str { + "metal" + } + + fn resize_event( + &self, + size: PhysicalWindowSize, + ) -> Result<(), i_slint_core::platform::PlatformError> { + // SAFETY: The pointer is a valid `CAMetalLayer`. + let ca_layer: &CAMetalLayer = unsafe { self.layer.as_ptr().cast().as_ref() }; + ca_layer.setDrawableSize(CGSize::new(size.width as f64, size.height as f64)); + self.drawable_ages.borrow_mut().clear(); + Ok(()) + } + + fn render( + &self, + _window: &Window, + _size: PhysicalWindowSize, + callback: &dyn Fn( + &skia_safe::Canvas, + Option<&mut skia_safe::gpu::DirectContext>, + u8, + ) -> Option, + pre_present_callback: &RefCell>>, + ) -> Result<(), i_slint_core::platform::PlatformError> { + autoreleasepool(|_| { + // SAFETY: The pointer is a valid `CAMetalLayer`. + let ca_layer: &CAMetalLayer = unsafe { self.layer.as_ptr().cast().as_ref() }; + let drawable = match ca_layer.nextDrawable() { + Some(drawable) => drawable, + None => { + return Err( + "Skia Metal Renderer: Failed to retrieve next drawable for rendering" + .into(), + ); + } + }; + + let gr_context = &mut self.gr_context.borrow_mut(); + + let size = ca_layer.drawableSize(); + + let mut surface = unsafe { + let texture = drawable.texture(); + let texture_info = mtl::TextureInfo::new(Retained::as_ptr(&texture) as mtl::Handle); + + let backend_render_target = skia_safe::gpu::backend_render_targets::make_mtl( + (size.width as i32, size.height as i32), + &texture_info, + ); + + skia_safe::gpu::surfaces::wrap_backend_render_target( + gr_context, + &backend_render_target, + skia_safe::gpu::SurfaceOrigin::TopLeft, + skia_safe::ColorType::BGRA8888, + None, + None, + ) + .unwrap() + }; + + let texture: Retained> = drawable.texture(); + let texture_id = texture.gpuResourceID(); + let age = { + let mut drawables = self.drawable_ages.borrow_mut(); + if let Some(existing_age) = + drawables.iter().find_map(|(id, age)| (*id == texture_id).then_some(*age)) + { + existing_age + } else { + drawables.push((texture_id, 0)); + 0 + } + }; + callback(surface.canvas(), Some(gr_context), age); + + drop(surface); + + gr_context.submit(None); + + if let Some(pre_present_callback) = pre_present_callback.borrow_mut().as_mut() { + pre_present_callback(); + } + + let command_buffer = self.command_queue.commandBuffer().ok_or_else(|| { + "Skia Renderer: Unable to obtain command queue's command buffer".to_string() + })?; + command_buffer.presentDrawable(ProtocolObject::from_ref(&*drawable)); + command_buffer.commit(); + + self.drawable_ages.borrow_mut().retain_mut(|(id, age)| { + if *id == texture_id { + *age = 1; + } else { + let Some(new_age) = age.checked_add(1) else { + // texture became too old, remove it. + return false; + }; + *age = new_age; + } + true + }); + + Ok(()) + }) + } + + fn bits_per_pixel(&self) -> Result { + // SAFETY: The pointer is a valid `CAMetalLayer`. + let ca_layer: &CAMetalLayer = unsafe { self.layer.as_ptr().cast().as_ref() }; + + // From https://developer.apple.com/documentation/metal/mtlpixelformat: + // The storage size of each pixel format is determined by the sum of its components. + // For example, the storage size of BGRA8Unorm is 32 bits (four 8-bit components) and + // the storage size of BGR5A1Unorm is 16 bits (three 5-bit components and one 1-bit component). + Ok(match ca_layer.pixelFormat() { + MTLPixelFormat::B5G6R5Unorm + | MTLPixelFormat::A1BGR5Unorm + | MTLPixelFormat::ABGR4Unorm + | MTLPixelFormat::BGR5A1Unorm => 16, + MTLPixelFormat::RGBA8Unorm + | MTLPixelFormat::RGBA8Unorm_sRGB + | MTLPixelFormat::RGBA8Snorm + | MTLPixelFormat::RGBA8Uint + | MTLPixelFormat::RGBA8Sint + | MTLPixelFormat::BGRA8Unorm + | MTLPixelFormat::BGRA8Unorm_sRGB => 32, + MTLPixelFormat::RGB10A2Unorm + | MTLPixelFormat::RGB10A2Uint + | MTLPixelFormat::BGR10A2Unorm => 32, + MTLPixelFormat::RGBA16Unorm + | MTLPixelFormat::RGBA16Snorm + | MTLPixelFormat::RGBA16Uint + | MTLPixelFormat::RGBA16Sint => 64, + MTLPixelFormat::RGBA32Uint | MTLPixelFormat::RGBA32Sint => 128, + fmt => { + return Err(format!( + "Skia Metal Renderer: Unsupported layer pixel format found {fmt:?}" + ) + .into()); + } + }) + } +} diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/opengl_surface.rs b/crates/vendor/i-slint-renderer-skia-1.16.1/opengl_surface.rs new file mode 100644 index 000000000..2a2a897cb --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/opengl_surface.rs @@ -0,0 +1,527 @@ +// Copyright © SixtyFPS GmbH +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +use std::num::NonZeroU32; +use std::{cell::RefCell, sync::Arc}; + +use glutin::{ + config::GetGlConfig, + context::{ContextApi, ContextAttributesBuilder}, + display::GetGlDisplay, + prelude::*, + surface::{SurfaceAttributesBuilder, WindowSurface}, +}; +use i_slint_core::api::{GraphicsAPI, PhysicalSize as PhysicalWindowSize, Window}; +use i_slint_core::graphics::{BorrowedOpenGLTexture, RequestedGraphicsAPI, RequestedOpenGLVersion}; +use i_slint_core::partial_renderer::DirtyRegion; +use i_slint_core::platform::PlatformError; + +use crate::SkiaSharedContext; + +/// Wraps a [`glutin::context::PossiblyCurrentContext`] and makes it not-current on drop, +/// so that no stale thread-local state remains after the context is destroyed. +struct GlutinContext(Option); + +impl GlutinContext { + fn new(context: glutin::context::PossiblyCurrentContext) -> Self { + Self(Some(context)) + } +} + +impl std::ops::Deref for GlutinContext { + type Target = glutin::context::PossiblyCurrentContext; + fn deref(&self) -> &Self::Target { + self.0.as_ref().unwrap() + } +} + +impl Drop for GlutinContext { + fn drop(&mut self) { + if let Some(context) = self.0.take() + && let Err(e) = context.make_not_current() + { + i_slint_core::debug_log!( + "Skia OpenGL Renderer: Failed to make context not current: {e}" + ); + } + } +} + +/// This surface type renders into the given window with OpenGL, using glutin and glow libraries. +pub struct OpenGLSurface { + fb_info: skia_safe::gpu::gl::FramebufferInfo, + surface: RefCell, + gr_context: RefCell, + glutin_context: GlutinContext, + glutin_surface: glutin::surface::Surface, +} + +impl super::Surface for OpenGLSurface { + fn new( + _shared_context: &SkiaSharedContext, + window_handle: Arc, + display_handle: Arc, + size: PhysicalWindowSize, + requested_graphics_api: Option, + ) -> Result { + Self::new_with_config( + window_handle, + display_handle, + size, + requested_graphics_api.as_ref().map(TryInto::try_into).transpose()?, + glutin::config::ConfigTemplateBuilder::new(), + None, + ) + } + + fn name(&self) -> &'static str { + "opengl" + } + + fn with_graphics_api(&self, callback: &mut dyn FnMut(GraphicsAPI<'_>)) { + let api = GraphicsAPI::NativeOpenGL { + get_proc_address: &|name| { + self.glutin_context.display().get_proc_address(name) as *const _ + }, + }; + callback(api) + } + + fn with_active_surface(&self, callback: &mut dyn FnMut()) -> Result<(), PlatformError> { + self.ensure_context_current()?; + callback(); + Ok(()) + } + + fn render( + &self, + _window: &Window, + size: PhysicalWindowSize, + callback: &dyn Fn( + &skia_safe::Canvas, + Option<&mut skia_safe::gpu::DirectContext>, + u8, + ) -> Option, + pre_present_callback: &RefCell>>, + ) -> Result<(), PlatformError> { + self.ensure_context_current()?; + + let current_context = &self.glutin_context; + + let gr_context = &mut self.gr_context.borrow_mut(); + + let mut surface = self.surface.borrow_mut(); + + let width = size.width.try_into().ok(); + let height = size.height.try_into().ok(); + + if let Some((width, height)) = width.zip(height) + && (width != surface.width() || height != surface.height()) + { + *surface = Self::create_internal_surface( + self.fb_info, + current_context, + gr_context, + width, + height, + )?; + } + + let skia_canvas = surface.canvas(); + + skia_canvas.save(); + callback( + skia_canvas, + Some(gr_context), + u8::try_from(self.glutin_surface.buffer_age()).unwrap_or_default(), + ); + skia_canvas.restore(); + + if let Some(pre_present_callback) = pre_present_callback.borrow_mut().as_mut() { + pre_present_callback(); + } + + self.glutin_surface.swap_buffers(current_context).map_err(|glutin_error| { + format!("Skia OpenGL Renderer: Error swapping buffers: {glutin_error}").into() + }) + } + + fn resize_event(&self, size: PhysicalWindowSize) -> Result<(), PlatformError> { + self.ensure_context_current()?; + + if let Some((width, height)) = size.width.try_into().ok().zip(size.height.try_into().ok()) { + self.glutin_surface.resize(&self.glutin_context, width, height); + } + + Ok(()) + } + + fn bits_per_pixel(&self) -> Result { + let config = self.glutin_context.config(); + let rgb_bits = match config.color_buffer_type() { + Some(glutin::config::ColorBufferType::Rgb { r_size, g_size, b_size }) => { + r_size + g_size + b_size + } + other => { + return Err(format!( + "Skia OpenGL Renderer: unsupported color buffer {other:?} encountered" + ) + .into()); + } + }; + Ok(rgb_bits + config.alpha_size()) + } + + fn import_opengl_texture( + &self, + canvas: &skia_safe::Canvas, + BorrowedOpenGLTexture { texture_id, size, origin, .. }: &BorrowedOpenGLTexture, + ) -> Option { + unsafe { + let mut texture_info = skia_safe::gpu::gl::TextureInfo::from_target_and_id( + glow::TEXTURE_2D, + texture_id.get(), + ); + texture_info.format = glow::RGBA8; + let backend_texture = skia_safe::gpu::backend_textures::make_gl( + (size.width as _, size.height as _), + skia_safe::gpu::Mipmapped::No, + texture_info, + "Borrowed GL texture", + ); + skia_safe::image::Image::from_texture( + canvas.recording_context().as_mut().unwrap(), + &backend_texture, + match origin { + i_slint_core::graphics::BorrowedOpenGLTextureOrigin::TopLeft => { + skia_safe::gpu::SurfaceOrigin::TopLeft + } + i_slint_core::graphics::BorrowedOpenGLTextureOrigin::BottomLeft => { + skia_safe::gpu::SurfaceOrigin::BottomLeft + } + _ => unimplemented!( + "internal error: missing implementation for BorrowedOpenGLTextureOrigin" + ), + }, + skia_safe::ColorType::RGBA8888, + skia_safe::AlphaType::Unpremul, + None, + ) + } + } +} + +impl OpenGLSurface { + pub fn new_with_config( + window_handle: Arc, + display_handle: Arc, + size: PhysicalWindowSize, + requested_opengl_version: Option, + config_builder: glutin::config::ConfigTemplateBuilder, + config_filter: Option<&dyn Fn(&glutin::config::Config) -> bool>, + ) -> Result { + let width: std::num::NonZeroU32 = size.width.try_into().map_err(|_| { + format!("Attempting to create window surface with an invalid width: {}", size.width) + })?; + let height: std::num::NonZeroU32 = size.height.try_into().map_err(|_| { + format!("Attempting to create window surface with an invalid height: {}", size.height) + })?; + + let window_handle = window_handle + .window_handle() + .map_err(|e| format!("error obtaining window handle for skia opengl renderer: {e}"))?; + let display_handle = display_handle + .display_handle() + .map_err(|e| format!("error obtaining display handle for skia opengl renderer: {e}"))?; + + let (current_glutin_context, glutin_surface) = Self::init_glutin( + window_handle, + display_handle, + width, + height, + requested_opengl_version, + config_builder, + config_filter, + )?; + + glutin_surface.resize(¤t_glutin_context, width, height); + + let fb_info = { + use glow::HasContext; + + let gl = unsafe { + glow::Context::from_loader_function_cstr(|name| { + current_glutin_context.display().get_proc_address(name) as *const _ + }) + }; + let fboid = unsafe { gl.get_parameter_i32(glow::FRAMEBUFFER_BINDING) }; + + skia_safe::gpu::gl::FramebufferInfo { + fboid: fboid.try_into().map_err(|_| { + "Skia Renderer: Internal error, framebuffer binding returned signed id" + .to_string() + })?, + format: skia_safe::gpu::gl::Format::RGBA8.into(), + ..Default::default() + } + }; + + let gl_interface = skia_safe::gpu::gl::Interface::new_load_with_cstr(|name| { + current_glutin_context.display().get_proc_address(name) as *const _ + }) + .ok_or_else(|| { + "Skia Renderer: Internal Error: Could not create OpenGL Interface".to_string() + })?; + + let mut gr_context = + skia_safe::gpu::direct_contexts::make_gl(gl_interface, None).ok_or_else(|| { + "Skia Renderer: Internal Error: Could not create Skia Direct Context from GL interface".to_string() + })?; + + let width: i32 = size.width.try_into().map_err(|e| { + format!("Attempting to create window surface with width that doesn't fit into non-zero i32: {e}") + })?; + let height: i32 = size.height.try_into().map_err(|e| { + format!( + "Attempting to create window surface with height that doesn't fit into non-zero i32: {e}" + ) + })?; + + let surface = Self::create_internal_surface( + fb_info, + ¤t_glutin_context, + &mut gr_context, + width, + height, + )? + .into(); + + Ok(Self { + fb_info, + surface, + gr_context: RefCell::new(gr_context), + glutin_context: GlutinContext::new(current_glutin_context), + glutin_surface, + }) + } + + fn init_glutin( + _window_handle: raw_window_handle::WindowHandle<'_>, + _display_handle: raw_window_handle::DisplayHandle<'_>, + width: NonZeroU32, + height: NonZeroU32, + requested_opengl_version: Option, + config_template_builder: glutin::config::ConfigTemplateBuilder, + config_filter: Option<&dyn Fn(&glutin::config::Config) -> bool>, + ) -> Result< + ( + glutin::context::PossiblyCurrentContext, + glutin::surface::Surface, + ), + PlatformError, + > { + cfg_if::cfg_if! { + if #[cfg(target_os = "macos")] { + let display_api_preference = glutin::display::DisplayApiPreference::Cgl; + } else if #[cfg(not(target_family = "windows"))] { + let display_api_preference = glutin::display::DisplayApiPreference::Egl; + } else { + let display_api_preference = glutin::display::DisplayApiPreference::EglThenWgl(Some(_window_handle.as_raw())); + } + } + + let gl_display = unsafe { + glutin::display::Display::new(_display_handle.as_raw(), display_api_preference) + .map_err(|glutin_error| { + format!( + "Error creating glutin display for native display {:?}: {}", + _display_handle.as_raw(), + glutin_error + ) + })? + }; + + // On macOS, there's only one GL config and that's initialized based on the values in the config template + // builder. So if that one has transparency enabled, it'll show up in the config, and will be set on the + // context later. So we must enable it here, there's no way of enabling it later. + // On EGL/GLX/WGL there are system provided configs that may or may not support transparency. Here in case + // the system doesn't support transparency, we want to fall back to a config that doesn't - better than not + // rendering anything at all. So we don't want to limit the configurations we get to see early on. + // Commented out due to https://github.com/rust-windowing/glutin/issues/1640 + #[cfg(target_os = "macos")] + let config_template_builder = config_template_builder.with_transparency(true); + + // Upstream advises to use this only on Windows. + #[cfg(target_family = "windows")] + let config_template_builder = + config_template_builder.compatible_with_native_window(_window_handle.as_raw()); + + let config_template = config_template_builder.build(); + + let config = unsafe { + gl_display + .find_configs(config_template) + .map_err(|e| format!("Could not find valid OpenGL display configurations: {e}"))? + .filter(|config| config_filter.as_ref().is_none_or(|filter_fn| filter_fn(config))) + .reduce(|accum, config| { + let transparency_check = config.supports_transparency().unwrap_or(false) + & !accum.supports_transparency().unwrap_or(false); + + if transparency_check || config.num_samples() < accum.num_samples() { + config + } else { + accum + } + }) + .ok_or("Unable to find suitable GL config")? + }; + + let requested_opengl_version = + requested_opengl_version.unwrap_or(RequestedOpenGLVersion::OpenGLES(Some((3, 0)))); + let preferred_context_attributes = match requested_opengl_version { + RequestedOpenGLVersion::OpenGL(version) => { + let version = + version.map(|(major, minor)| glutin::context::Version { major, minor }); + ContextAttributesBuilder::new() + .with_context_api(ContextApi::OpenGl(version)) + .build(Some(_window_handle.as_raw())) + } + RequestedOpenGLVersion::OpenGLES(version) => { + let version = + version.map(|(major, minor)| glutin::context::Version { major, minor }); + + ContextAttributesBuilder::new() + .with_context_api(ContextApi::Gles(version)) + .build(Some(_window_handle.as_raw())) + } + }; + + let gles2_fallback_context_attributes = ContextAttributesBuilder::new() + .with_context_api(ContextApi::Gles(Some(glutin::context::Version { + major: 2, + minor: 0, + }))) + .build(Some(_window_handle.as_raw())); + + let fallback_context_attributes = + ContextAttributesBuilder::new().build(Some(_window_handle.as_raw())); + + let not_current_gl_context = unsafe { + gl_display + .create_context(&config, &preferred_context_attributes) + .or_else(|_| gl_display.create_context(&config, &gles2_fallback_context_attributes)) + .or_else(|_| gl_display.create_context(&config, &fallback_context_attributes)) + .map_err(|e| format!("Error creating OpenGL context: {e}")) + }?; + + let attrs = SurfaceAttributesBuilder::::new().build( + _window_handle.as_raw(), + width, + height, + ); + + let surface = unsafe { + config + .display() + .create_window_surface(&config, &attrs) + .map_err(|e| format!("Error creating OpenGL window surface: {e}"))? + }; + + let context = not_current_gl_context.make_current(&surface) + .map_err(|glutin_error: glutin::error::Error| -> PlatformError { + format!("FemtoVG Renderer: Failed to make newly created OpenGL context current: {glutin_error}") + .into() + })?; + + // Align the GL layer to the top-left, so that resizing only invalidates the bottom/right + // part of the window. + #[cfg(target_os = "macos")] + if let raw_window_handle::RawWindowHandle::AppKit(raw_window_handle::AppKitWindowHandle { + ns_view, + .. + }) = _window_handle.as_raw() + { + let ns_view: &objc2_app_kit::NSView = unsafe { ns_view.cast().as_ref() }; + ns_view.setLayerContentsPlacement(objc2_app_kit::NSViewLayerContentsPlacement::TopLeft); + } + + // Sanity check, as all this might succeed on Windows without working GL drivers, but this will fail: + if context + .display() + .get_proc_address(&std::ffi::CString::new("glCreateShader").unwrap()) + .is_null() + { + return Err( + "Failed to initialize OpenGL driver: Could not locate glCreateShader symbol" + .to_string() + .into(), + ); + } + + // Try to default to vsync and ignore if the driver doesn't support it. + surface + .set_swap_interval( + &context, + glutin::surface::SwapInterval::Wait(NonZeroU32::new(1).unwrap()), + ) + .ok(); + + Ok((context, surface)) + } + + fn create_internal_surface( + fb_info: skia_safe::gpu::gl::FramebufferInfo, + gl_context: &glutin::context::PossiblyCurrentContext, + gr_context: &mut skia_safe::gpu::DirectContext, + width: i32, + height: i32, + ) -> Result { + let config = gl_context.config(); + + let backend_render_target = skia_safe::gpu::backend_render_targets::make_gl( + (width, height), + Some(config.num_samples() as _), + config.stencil_size() as _, + fb_info, + ); + match skia_safe::gpu::surfaces::wrap_backend_render_target( + gr_context, + &backend_render_target, + skia_safe::gpu::SurfaceOrigin::BottomLeft, + skia_safe::ColorType::RGBA8888, + None, + None, + ) { + Some(surface) => Ok(surface), + None => { + Err("Skia OpenGL Renderer: Failed to allocate internal backend rendering target" + .into()) + } + } + } + + fn ensure_context_current(&self) -> Result<(), PlatformError> { + if !self.glutin_context.is_current() { + self.glutin_context.make_current(&self.glutin_surface).map_err( + |glutin_error| -> PlatformError { + format!("Skia Renderer: Error making context current: {glutin_error}").into() + }, + )?; + } + Ok(()) + } +} + +impl Drop for OpenGLSurface { + fn drop(&mut self) { + // Make sure that the context is current before Skia calls glDelete*** + // In the event that this fails for some reason (lost GL context), convey that to Skia so that it doesn't try to call + // glDelete*** + if self.ensure_context_current().is_err() { + i_slint_core::debug_log!( + "Skia OpenGL Renderer warning: Failed to make context current for destruction - considering context abandoned." + ); + self.gr_context.borrow_mut().abandon(); + } + } +} diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/software_surface.rs b/crates/vendor/i-slint-renderer-skia-1.16.1/software_surface.rs new file mode 100644 index 000000000..dd3ac6bd8 --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/software_surface.rs @@ -0,0 +1,254 @@ +// Copyright © SixtyFPS GmbH +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +use i_slint_core::api::{PhysicalSize as PhysicalWindowSize, Window}; +use i_slint_core::graphics::RequestedGraphicsAPI; +use i_slint_core::partial_renderer::DirtyRegion; + +use std::cell::RefCell; +use std::num::NonZeroU32; +use std::rc::Rc; +use std::sync::Arc; + +use crate::SkiaSharedContext; + +pub trait RenderBuffer { + fn with_buffer( + &self, + window: &Window, + size: PhysicalWindowSize, + render_callback: &mut dyn FnMut( + NonZeroU32, + NonZeroU32, + skia_safe::ColorType, + u8, + &mut [u8], + ) -> Result< + Option, + i_slint_core::platform::PlatformError, + >, + ) -> Result<(), i_slint_core::platform::PlatformError>; +} + +#[cfg(feature = "softbuffer")] +struct SoftbufferRenderBuffer { + _context: softbuffer::Context>, + surface: RefCell< + softbuffer::Surface< + Arc, + Arc, + >, + >, +} + +#[cfg(feature = "softbuffer")] +impl RenderBuffer for SoftbufferRenderBuffer { + fn with_buffer( + &self, + window: &Window, + size: PhysicalWindowSize, + render_callback: &mut dyn FnMut( + NonZeroU32, + NonZeroU32, + skia_safe::ColorType, + u8, + &mut [u8], + ) -> Result< + Option, + i_slint_core::platform::PlatformError, + >, + ) -> Result<(), i_slint_core::platform::PlatformError> { + let Some((width, height)) = size.width.try_into().ok().zip(size.height.try_into().ok()) + else { + // Nothing to render + return Ok(()); + }; + + let mut surface = self.surface.borrow_mut(); + + surface + .resize(width, height) + .map_err(|e| format!("Error resizing softbuffer surface: {e}"))?; + + let mut target_buffer = surface + .buffer_mut() + .map_err(|e| format!("Error retrieving softbuffer rendering buffer: {e}"))?; + + let dirty_region = render_callback( + width, + height, + skia_safe::ColorType::BGRA8888, + target_buffer.age(), + bytemuck::cast_slice_mut(target_buffer.as_mut()), + )?; + + if let Some(dirty_region) = dirty_region { + let scale_factor = i_slint_core::lengths::ScaleFactor::new(window.scale_factor()); + + let damage_rects = dirty_region + .iter() + .map(|logical| { + let physical_rect = (logical.to_rect() * scale_factor).round_out(); + softbuffer::Rect { + x: physical_rect.min_x().ceil() as _, + y: physical_rect.min_y().ceil() as _, + width: ((physical_rect.width() as i32).max(1) as u32).try_into().unwrap(), + height: ((physical_rect.height() as i32).max(1) as u32).try_into().unwrap(), + } + }) + .collect::>(); + target_buffer.present_with_damage(&damage_rects) + } else { + target_buffer.present() + } + .map_err(|e| format!("Error presenting softbuffer buffer after skia rendering: {e}"))?; + + Ok(()) + } +} + +/// This surface renders into the given window using Skia's software rasterize. +pub struct SoftwareSurface { + render_buffer: Box, +} + +impl super::Surface for SoftwareSurface { + #[cfg(feature = "softbuffer")] + fn new( + _shared_context: &SkiaSharedContext, + window_handle: Arc, + display_handle: Arc, + _size: PhysicalWindowSize, + _requested_graphics_api: Option, + ) -> Result { + let _context = softbuffer::Context::new(display_handle) + .map_err(|e| format!("Error creating softbuffer context: {e}"))?; + + let surface = + softbuffer::Surface::new(&_context, window_handle).map_err(|softbuffer_error| { + format!("Error creating softbuffer surface: {softbuffer_error}") + })?; + + let surface_access = + Box::new(SoftbufferRenderBuffer { _context, surface: RefCell::new(surface) }); + + Ok(Self { render_buffer: surface_access }) + } + + #[cfg(not(feature = "softbuffer"))] + fn new( + _shared_context: &SkiaSharedContext, + _window_handle: Arc, + _display_handle: Arc, + _size: PhysicalWindowSize, + _requested_graphics_api: Option, + ) -> Result { + struct DummyBuffer; + impl RenderBuffer for DummyBuffer { + fn with_buffer( + &self, + _window: &Window, + _size: PhysicalWindowSize, + _render_callback: &mut dyn FnMut( + std::num::NonZeroU32, + std::num::NonZeroU32, + skia_safe::ColorType, + u8, + &mut [u8], + ) -> Result< + Option, + i_slint_core::platform::PlatformError, + >, + ) -> Result<(), i_slint_core::platform::PlatformError> { + Err("Slint's Skia renderer compiled without the 'softbuffer' feature cannot render into a window".into()) + } + } + Ok(DummyBuffer.into()) + } + + fn name(&self) -> &'static str { + "software" + } + + fn resize_event( + &self, + _size: PhysicalWindowSize, + ) -> Result<(), i_slint_core::platform::PlatformError> { + Ok(()) + } + + fn render( + &self, + window: &Window, + size: PhysicalWindowSize, + callback: &dyn Fn( + &skia_safe::Canvas, + Option<&mut skia_safe::gpu::DirectContext>, + u8, + ) -> Option, + pre_present_callback: &RefCell>>, + ) -> Result<(), i_slint_core::platform::PlatformError> { + self.render_buffer.with_buffer( + window, + size, + &mut |width, height, pixel_format, age, pixels| { + let mut surface_borrow = skia_safe::surfaces::wrap_pixels( + &skia_safe::ImageInfo::new( + (width.get() as i32, height.get() as i32), + pixel_format, + skia_safe::AlphaType::Opaque, + None, + ), + pixels, + None, + None, + ) + .ok_or_else(|| { + "Error wrapping target buffer for rendering into with Skia".to_string() + })?; + + let dirty_region = callback(surface_borrow.canvas(), None, age); + + if let Some(pre_present_callback) = pre_present_callback.borrow_mut().as_mut() { + pre_present_callback(); + } + + Ok(dirty_region) + }, + ) + } + + fn bits_per_pixel(&self) -> Result { + Ok(24) + } + + fn use_partial_rendering(&self) -> bool { + true + } +} + +impl From for SoftwareSurface { + fn from(render_buffer: T) -> Self { + Self { render_buffer: Box::new(render_buffer) } + } +} + +impl RenderBuffer for Rc { + fn with_buffer( + &self, + window: &Window, + size: PhysicalWindowSize, + render_callback: &mut dyn FnMut( + NonZeroU32, + NonZeroU32, + skia_safe::ColorType, + u8, + &mut [u8], + ) -> Result< + Option, + i_slint_core::platform::PlatformError, + >, + ) -> Result<(), i_slint_core::platform::PlatformError> { + self.as_ref().with_buffer(window, size, render_callback) + } +} diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/vulkan_surface.rs b/crates/vendor/i-slint-renderer-skia-1.16.1/vulkan_surface.rs new file mode 100644 index 000000000..24b69f706 --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/vulkan_surface.rs @@ -0,0 +1,505 @@ +// Copyright © SixtyFPS GmbH +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +use std::cell::{Cell, RefCell}; +use std::sync::Arc; + +use i_slint_core::api::{PhysicalSize as PhysicalWindowSize, Window}; +use i_slint_core::graphics::RequestedGraphicsAPI; +use i_slint_core::partial_renderer::DirtyRegion; + +use vulkano::device::physical::{PhysicalDevice, PhysicalDeviceType}; +use vulkano::device::{ + Device, DeviceCreateInfo, DeviceExtensions, Queue, QueueCreateInfo, QueueFlags, +}; +use vulkano::image::view::ImageView; +use vulkano::image::{Image, ImageUsage}; +use vulkano::instance::{Instance, InstanceCreateFlags, InstanceCreateInfo, InstanceExtensions}; +use vulkano::swapchain::{Surface, Swapchain, SwapchainCreateInfo, SwapchainPresentInfo}; +use vulkano::sync::GpuFuture; +use vulkano::{Handle, Validated, VulkanError, VulkanLibrary, VulkanObject, sync}; + +use crate::SkiaSharedContext; + +pub struct SharedVulkanContext { + instance: Arc, + // TODO: share also physical/logical device and queue, but their selection process is surface compatibility dependent. +} + +impl super::SkiaSharedContextInner { + fn shared_vulkan_context( + &self, + ) -> Result<&SharedVulkanContext, i_slint_core::platform::PlatformError> { + if let Some(ctx) = self.vulkan_context.get() { + return Ok(ctx); + } + self.vulkan_context.set(SharedVulkanContext::new()?).ok(); + Ok(self.vulkan_context.get().unwrap()) + } +} + +impl SharedVulkanContext { + fn new() -> Result { + let library = VulkanLibrary::new() + .map_err(|load_err| format!("Error loading vulkan library: {load_err}"))?; + + let required_extensions = InstanceExtensions { + khr_surface: true, + mvk_macos_surface: true, + ext_metal_surface: true, + khr_wayland_surface: true, + khr_xlib_surface: true, + khr_xcb_surface: true, + khr_win32_surface: true, + khr_get_surface_capabilities2: true, + khr_get_physical_device_properties2: true, + ..InstanceExtensions::empty() + } + .intersection(library.supported_extensions()); + + let instance = Instance::new( + library.clone(), + InstanceCreateInfo { + flags: InstanceCreateFlags::ENUMERATE_PORTABILITY, + enabled_extensions: required_extensions, + ..Default::default() + }, + ) + .map_err(|instance_err| format!("Error creating Vulkan instance: {instance_err}"))?; + Ok(Self { instance }) + } +} + +/// This surface renders into the given window using Vulkan. +pub struct VulkanSurface { + gr_context: RefCell, + recreate_swapchain: Cell, + device: Arc, + previous_frame_end: RefCell>>, + queue: Arc, + swapchain: RefCell>, + swapchain_images: RefCell>>, + swapchain_image_views: RefCell>>, +} + +impl VulkanSurface { + /// Creates a Skia Vulkan rendering surface from the given Vukano device, queue family index, surface, + /// and size. + pub fn from_surface( + physical_device: Arc, + queue_family_index: u32, + surface: Arc, + size: PhysicalWindowSize, + ) -> Result { + /* + eprintln!( + "Vulkan device: {} (type: {:?})", + physical_device.properties().device_name, + physical_device.properties().device_type, + );*/ + + let (device, mut queues) = Device::new( + physical_device.clone(), + DeviceCreateInfo { + enabled_extensions: DeviceExtensions { + khr_swapchain: true, + ..DeviceExtensions::empty() + }, + queue_create_infos: vec![QueueCreateInfo { + queue_family_index, + ..Default::default() + }], + ..Default::default() + }, + ) + .map_err(|dev_err| format!("Failed to create suitable logical Vulkan device: {dev_err}"))?; + let queue = queues.next().ok_or_else(|| "Not Vulkan device queue found".to_string())?; + + let (swapchain, swapchain_images) = { + let surface_capabilities = device + .physical_device() + .surface_capabilities(&surface, Default::default()) + .map_err(|vke| format!("Error matching Vulkan surface capabilities: {vke}"))?; + let image_format = vulkano::format::Format::B8G8R8A8_UNORM; + + Swapchain::new( + device.clone(), + surface.clone(), + SwapchainCreateInfo { + min_image_count: surface_capabilities.min_image_count, + image_format, + image_extent: [size.width, size.height], + image_usage: ImageUsage::COLOR_ATTACHMENT, + composite_alpha: surface_capabilities + .supported_composite_alpha + .into_iter() + .next() + .ok_or_else(|| { + "fatal: Vulkan surface capabilities missing composite alpha descriptor" + .to_string() + })?, + ..Default::default() + }, + ) + .map_err(|vke| format!("Error creating Vulkan swapchain: {vke}"))? + }; + + let mut swapchain_image_views = Vec::with_capacity(swapchain_images.len()); + + for image in &swapchain_images { + swapchain_image_views.push(ImageView::new_default(image.clone()).map_err(|vke| { + format!("fatal: Error creating image view for swap chain image: {vke}") + })?); + } + + let instance = physical_device.instance(); + let library = instance.library(); + + let get_proc = |of| unsafe { + let result = match of { + skia_safe::gpu::vk::GetProcOf::Instance(instance, name) => { + library.get_instance_proc_addr(ash::vk::Instance::from_raw(instance as _), name) + } + skia_safe::gpu::vk::GetProcOf::Device(device, name) => { + (instance.fns().v1_0.get_device_proc_addr)( + ash::vk::Device::from_raw(device as _), + name, + ) + } + }; + + match result { + Some(f) => f as _, + None => { + //println!("resolve of {} failed", of.name().to_str().unwrap()); + core::ptr::null() + } + } + }; + + let backend_context = unsafe { + skia_safe::gpu::vk::BackendContext::new( + instance.handle().as_raw() as _, + physical_device.handle().as_raw() as _, + device.handle().as_raw() as _, + (queue.handle().as_raw() as _, queue.queue_index() as _), + &get_proc, + ) + }; + + let gr_context = skia_safe::gpu::direct_contexts::make_vulkan(&backend_context, None) + .ok_or_else(|| "Error creating Skia Vulkan context".to_string())?; + + let previous_frame_end = RefCell::new(Some(sync::now(device.clone()).boxed())); + + Ok(Self { + gr_context: RefCell::new(gr_context), + recreate_swapchain: Cell::new(false), + device, + previous_frame_end, + queue, + swapchain: RefCell::new(swapchain), + swapchain_images: RefCell::new(swapchain_images), + swapchain_image_views: RefCell::new(swapchain_image_views), + }) + } + + /// Returns a clone of the shared swapchain. + pub fn swapchain(&self) -> Arc { + self.swapchain.borrow().clone() + } +} + +impl super::Surface for VulkanSurface { + fn new( + shared_context: &SkiaSharedContext, + window_handle: Arc, + display_handle: Arc, + size: PhysicalWindowSize, + requested_graphics_api: Option, + ) -> Result { + if requested_graphics_api.is_some_and(|api| !matches!(api, RequestedGraphicsAPI::Vulkan)) { + return Err("Requested non-Vulkan rendering with Vulkan renderer".into()); + } + + let instance = shared_context.0.shared_vulkan_context()?.instance.clone(); + + let window_handle = window_handle + .window_handle() + .map_err(|e| format!("error obtaining window handle for skia vulkan renderer: {e}"))?; + let display_handle = display_handle + .display_handle() + .map_err(|e| format!("error obtaining display handle for skia vulkan renderer: {e}"))?; + + let surface = create_surface(&instance, window_handle, display_handle) + .map_err(|surface_err| format!("Error creating Vulkan surface: {surface_err}"))?; + + let device_extensions = + DeviceExtensions { khr_swapchain: true, ..DeviceExtensions::empty() }; + let (physical_device, queue_family_index) = instance + .enumerate_physical_devices() + .map_err(|vke| format!("Error enumerating physical Vulkan devices: {vke}"))? + .filter(|p| p.supported_extensions().contains(&device_extensions)) + .filter_map(|p| { + p.queue_family_properties() + .iter() + .enumerate() + .position(|(i, q)| { + q.queue_flags.intersects(QueueFlags::GRAPHICS) + && p.surface_support(i as u32, &surface).unwrap_or(false) + }) + .map(|i| (p, i as u32)) + }) + .min_by_key(|(p, _)| match p.properties().device_type { + PhysicalDeviceType::DiscreteGpu => 0, + PhysicalDeviceType::IntegratedGpu => 1, + PhysicalDeviceType::VirtualGpu => 2, + PhysicalDeviceType::Cpu => 3, + PhysicalDeviceType::Other => 4, + _ => 5, + }) + .ok_or_else(|| "Vulkan: Failed to find suitable physical device".to_string())?; + + Self::from_surface(physical_device, queue_family_index, surface, size) + } + + fn name(&self) -> &'static str { + "vulkan" + } + + fn resize_event( + &self, + _size: PhysicalWindowSize, + ) -> Result<(), i_slint_core::platform::PlatformError> { + self.recreate_swapchain.set(true); + Ok(()) + } + + fn render( + &self, + _window: &Window, + size: PhysicalWindowSize, + callback: &dyn Fn( + &skia_safe::Canvas, + Option<&mut skia_safe::gpu::DirectContext>, + u8, + ) -> Option, + pre_present_callback: &RefCell>>, + ) -> Result<(), i_slint_core::platform::PlatformError> { + let gr_context = &mut self.gr_context.borrow_mut(); + + let device = self.device.clone(); + + self.previous_frame_end.borrow_mut().as_mut().unwrap().cleanup_finished(); + + if self.recreate_swapchain.take() { + let mut swapchain = self.swapchain.borrow_mut(); + let (new_swapchain, new_images) = swapchain + .recreate(SwapchainCreateInfo { + image_extent: [size.width, size.height], + ..swapchain.create_info() + }) + .map_err(|vke| format!("Error re-creating Vulkan swap chain: {vke}"))?; + + *swapchain = new_swapchain; + + let mut new_swapchain_image_views = Vec::with_capacity(new_images.len()); + + for image in &new_images { + new_swapchain_image_views.push(ImageView::new_default(image.clone()).map_err( + |vke| format!("fatal: Error creating image view for swap chain image: {vke}"), + )?); + } + + *self.swapchain_images.borrow_mut() = new_images; + *self.swapchain_image_views.borrow_mut() = new_swapchain_image_views; + } + + let swapchain = self.swapchain.borrow().clone(); + + #[cfg_attr(slint_nightly_test, allow(non_exhaustive_omitted_patterns))] + let (image_index, suboptimal, acquire_future) = + match vulkano::swapchain::acquire_next_image(swapchain.clone(), None) + .map_err(Validated::unwrap) + { + Ok(r) => r, + Err(VulkanError::OutOfDate) => { + self.recreate_swapchain.set(true); + return Ok(()); // Try again next frame + } + Err(e) => return Err(format!("Vulkan: failed to acquire next image: {e}").into()), + }; + + if suboptimal { + self.recreate_swapchain.set(true); + } + + let width = swapchain.image_extent()[0]; + let width: i32 = width + .try_into() + .map_err(|_| format!("internal error: invalid swapchain image width {width}"))?; + let height = swapchain.image_extent()[1]; + let height: i32 = height + .try_into() + .map_err(|_| format!("internal error: invalid swapchain image height {height}"))?; + + let image_view = self.swapchain_image_views.borrow()[image_index as usize].clone(); + let image_object = image_view.image(); + + let format = image_view.format(); + + debug_assert_eq!(format, vulkano::format::Format::B8G8R8A8_UNORM); + let (vk_format, color_type) = + (skia_safe::gpu::vk::Format::B8G8R8A8_UNORM, skia_safe::ColorType::BGRA8888); + + let alloc = skia_safe::gpu::vk::Alloc::default(); + let image_info = &unsafe { + skia_safe::gpu::vk::ImageInfo::new( + image_object.handle().as_raw() as _, + alloc, + skia_safe::gpu::vk::ImageTiling::OPTIMAL, + skia_safe::gpu::vk::ImageLayout::COLOR_ATTACHMENT_OPTIMAL, + vk_format, + 1, + None, + None, + None, + None, + ) + }; + + let render_target = + &skia_safe::gpu::backend_render_targets::make_vk((width, height), image_info); + + let mut skia_surface = skia_safe::gpu::surfaces::wrap_backend_render_target( + gr_context, + render_target, + skia_safe::gpu::SurfaceOrigin::TopLeft, + color_type, + None, + None, + ) + .ok_or_else(|| "Error creating Skia Vulkan surface".to_string())?; + + callback(skia_surface.canvas(), Some(gr_context), 0); + + drop(skia_surface); + + gr_context.submit(None); + + if let Some(pre_present_callback) = pre_present_callback.borrow_mut().as_mut() { + pre_present_callback(); + } + + let future = self + .previous_frame_end + .borrow_mut() + .take() + .unwrap() + .join(acquire_future) + .then_swapchain_present( + self.queue.clone(), + SwapchainPresentInfo::swapchain_image_index(swapchain.clone(), image_index), + ) + .then_signal_fence_and_flush(); + + #[cfg_attr(slint_nightly_test, allow(non_exhaustive_omitted_patterns))] + match future.map_err(Validated::unwrap) { + Ok(future) => { + *self.previous_frame_end.borrow_mut() = Some(future.boxed()); + } + Err(VulkanError::OutOfDate) => { + self.recreate_swapchain.set(true); + *self.previous_frame_end.borrow_mut() = Some(sync::now(device.clone()).boxed()); + } + Err(e) => { + *self.previous_frame_end.borrow_mut() = Some(sync::now(device.clone()).boxed()); + return Err(format!("Skia Vulkan renderer: failed to flush future: {e}").into()); + } + } + + Ok(()) + } + + fn bits_per_pixel(&self) -> Result { + #[cfg_attr(slint_nightly_test, allow(non_exhaustive_omitted_patterns))] + Ok(match self.swapchain.borrow().image_format() { + vulkano::format::Format::B8G8R8A8_UNORM => 32, + fmt => { + return Err(format!( + "Skia Vulkan Renderer: Unsupported swapchain image format found {fmt:?}" + ) + .into()); + } + }) + } + + fn as_any(&self) -> &dyn core::any::Any { + self + } +} + +// FIXME(madsmtm): Why are we doing this instead of using `Surface::from_window`? +fn create_surface( + instance: &Arc, + window_handle: raw_window_handle::WindowHandle<'_>, + display_handle: raw_window_handle::DisplayHandle<'_>, +) -> Result, vulkano::Validated> { + #[cfg_attr(slint_nightly_test, allow(non_exhaustive_omitted_patterns))] + match (window_handle.as_raw(), display_handle.as_raw()) { + #[cfg(target_vendor = "apple")] + (raw_window_handle::RawWindowHandle::AppKit(handle), _) => unsafe { + let layer = raw_window_metal::Layer::from_ns_view(handle.ns_view); + Surface::from_metal(instance.clone(), layer.as_ptr().as_ptr(), None) + }, + #[cfg(target_vendor = "apple")] + (raw_window_handle::RawWindowHandle::UiKit(handle), _) => unsafe { + let layer = raw_window_metal::Layer::from_ui_view(handle.ui_view); + Surface::from_metal(instance.clone(), layer.as_ptr().as_ptr(), None) + }, + ( + raw_window_handle::RawWindowHandle::Xlib(raw_window_handle::XlibWindowHandle { + window, + .. + }), + raw_window_handle::RawDisplayHandle::Xlib(display), + ) => unsafe { + Surface::from_xlib(instance.clone(), display.display.unwrap().as_ptr(), window, None) + }, + ( + raw_window_handle::RawWindowHandle::Xcb(raw_window_handle::XcbWindowHandle { + window, + .. + }), + raw_window_handle::RawDisplayHandle::Xcb(raw_window_handle::XcbDisplayHandle { + connection, + .. + }), + ) => unsafe { + Surface::from_xcb(instance.clone(), connection.unwrap().as_ptr(), window.get(), None) + }, + ( + raw_window_handle::RawWindowHandle::Wayland(raw_window_handle::WaylandWindowHandle { + surface, + .. + }), + raw_window_handle::RawDisplayHandle::Wayland(raw_window_handle::WaylandDisplayHandle { + display, + .. + }), + ) => unsafe { + Surface::from_wayland(instance.clone(), display.as_ptr(), surface.as_ptr(), None) + }, + ( + raw_window_handle::RawWindowHandle::Win32(raw_window_handle::Win32WindowHandle { + hwnd, + hinstance, + .. + }), + _, + ) => unsafe { + Surface::from_win32(instance.clone(), hinstance.unwrap().get(), hwnd.get(), None) + }, + _ => unimplemented!(), + } +} diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_27_surface.rs b/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_27_surface.rs new file mode 100644 index 000000000..d421b22bb --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_27_surface.rs @@ -0,0 +1,339 @@ +// Copyright © SixtyFPS GmbH +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +use i_slint_core::api::{GraphicsAPI, PhysicalSize as PhysicalWindowSize, Window}; +use i_slint_core::graphics::RequestedGraphicsAPI; +use i_slint_core::partial_renderer::DirtyRegion; +use i_slint_core::platform::PlatformError; + +use std::cell::RefCell; +use std::sync::Arc; + +use wgpu_27 as wgpu; + +use crate::SkiaSharedContext; + +#[cfg(target_family = "windows")] +mod dx12; +#[cfg(target_vendor = "apple")] +mod metal; +#[cfg(all(target_family = "unix", not(target_vendor = "apple")))] +mod vulkan; + +/// This surface renders into the given window using Metal. The provided display argument +/// is ignored, as it has no meaning on macOS. +pub struct WGPUSurface { + gr_context: RefCell, + instance: wgpu::Instance, + device: wgpu::Device, + queue: wgpu::Queue, + surface_config: RefCell, + surface: wgpu::Surface<'static>, + textures_to_transition_for_sampling: RefCell>, + backend: Backend, +} + +impl WGPUSurface { + pub fn new_with_surface( + surface_target: impl Into, + size: PhysicalWindowSize, + requested_graphics_api: Option, + ) -> Result { + let (instance, adapter, device, queue, surface) = + i_slint_core::graphics::wgpu_27::init_instance_adapter_device_queue_surface( + surface_target, + requested_graphics_api, + wgpu::Backends::GL /* we're not mapping that to skia because we can't save/restore state */ + .union(if cfg!(target_os = "windows") { + wgpu::Backends::VULKAN + } else { + wgpu::Backends::empty() + }), + )?; + + let mut surface_config = + surface.get_default_config(&adapter, size.width, size.height).unwrap(); + + let swapchain_capabilities = surface.get_capabilities(&adapter); + let swapchain_format = swapchain_capabilities + .formats + .iter() + .find(|f| { + matches!(f, wgpu::TextureFormat::Rgba8Unorm | wgpu::TextureFormat::Bgra8Unorm) + }) + .copied() + .unwrap_or_else(|| swapchain_capabilities.formats[0]); + surface_config.format = swapchain_format; + surface.configure(&device, &surface_config); + + let backend: Backend = adapter.get_info().backend.try_into()?; + + let gr_context = backend.make_context(&adapter, &device, &queue); + + Ok(Self { + gr_context: RefCell::new( + gr_context.ok_or_else(|| { + PlatformError::from("Failed to create Skia context from WGPU") + })?, + ), + instance, + device, + queue, + surface_config: surface_config.into(), + surface, + textures_to_transition_for_sampling: RefCell::new(Vec::new()), + backend, + }) + } +} + +impl super::Surface for WGPUSurface { + fn new( + _shared_context: &SkiaSharedContext, + window_handle: Arc, + display_handle: Arc, + size: PhysicalWindowSize, + requested_graphics_api: Option, + ) -> Result { + Self::new_with_surface( + Box::new(WindowAndDisplayHandle(window_handle, display_handle)) + as Box, + size, + requested_graphics_api, + ) + } + + fn name(&self) -> &'static str { + "wgpu" + } + + fn resize_event(&self, size: PhysicalWindowSize) -> Result<(), PlatformError> { + let mut surface_config = self.surface_config.borrow_mut(); + + // Skip reconfigure if size hasn't changed — DRM/KMS surfaces don't + // support being reconfigured. + if surface_config.width == size.width && surface_config.height == size.height { + return Ok(()); + } + + { + let gr_context = &mut self.gr_context.borrow_mut(); + // This is brute force, but for the lack of access to the fences this seems to work: Avoid any pending work so that + // IDXGISwapChain::ResizeBuffers doesn't complain that the surface is still in use. + gr_context.flush_submit_and_sync_cpu(); + } + + // Prefer FIFO modes over possible Mailbox setting for frame pacing and better energy efficiency. + surface_config.present_mode = wgpu::PresentMode::AutoVsync; + surface_config.width = size.width; + surface_config.height = size.height; + + self.surface.configure(&self.device, &surface_config); + Ok(()) + } + + fn render( + &self, + _window: &Window, + size: PhysicalWindowSize, + callback: &dyn Fn( + &skia_safe::Canvas, + Option<&mut skia_safe::gpu::DirectContext>, + u8, + ) -> Option, + pre_present_callback: &RefCell>>, + ) -> Result<(), PlatformError> { + let gr_context = &mut self.gr_context.borrow_mut(); + + let frame = match self.surface.get_current_texture() { + Ok(texture) => texture, + Err(wgpu::SurfaceError::Timeout) => { + self.surface.get_current_texture().map_err(|e| { + format!("Error obtaining current surface texture after timeout: {e}") + })? + } + // Outdated or lost: re-configure and try again + Err(_) => { + self.surface.configure(&self.device, &self.surface_config.borrow()); + self.surface.get_current_texture().map_err(|e| { + format!("Error obtaining current surface texture after initial error: {e}") + })? + } + }; + + let skia_surface = self.backend.make_surface(size, gr_context, &frame); + + let mut skia_surface = skia_surface + .ok_or_else(|| PlatformError::from("Failed to create Skia surface from WGPU"))?; + + callback(skia_surface.canvas(), Some(gr_context), 0); + + let textures_to_transition = self.textures_to_transition_for_sampling.take(); + if !textures_to_transition.is_empty() { + let mut encoder = self.device.create_command_encoder(&wgpu::CommandEncoderDescriptor { + label: Some("Skia texture transition encoder"), + }); + encoder.transition_resources( + std::iter::empty(), + textures_to_transition.iter().map(|texture| wgpu::TextureTransition { + texture, + selector: None, + state: wgpu::TextureUses::RESOURCE, + }), + ); + + self.queue.submit(Some(encoder.finish())); + } + + gr_context.submit(None); + + if let Some(pre_present_callback) = pre_present_callback.borrow_mut().as_mut() { + pre_present_callback(); + } + + frame.present(); + + Ok(()) + } + + fn bits_per_pixel(&self) -> Result { + Ok(match self.surface_config.borrow().format { + wgpu_27::TextureFormat::Rgba8Unorm + | wgpu_27::TextureFormat::Rgba8UnormSrgb + | wgpu_27::TextureFormat::Bgra8Unorm + | wgpu_27::TextureFormat::Bgra8UnormSrgb => 32, + fmt => return Err(format!("Unsupported surface format {:#?}", fmt).into()), + }) + } + + #[cfg(feature = "unstable-wgpu-27")] + fn with_graphics_api(&self, callback: &mut dyn FnMut(GraphicsAPI<'_>)) { + let api = i_slint_core::graphics::create_graphics_api_wgpu_27( + self.instance.clone(), + self.device.clone(), + self.queue.clone(), + ); + callback(api) + } + + #[cfg(any(feature = "unstable-wgpu-27", feature = "unstable-wgpu-28"))] + fn import_wgpu_texture( + &self, + canvas: &skia_safe::Canvas, + any_wgpu_texture: &i_slint_core::graphics::WGPUTexture, + ) -> Option { + let texture: wgpu::Texture = match any_wgpu_texture { + #[cfg(feature = "unstable-wgpu-27")] + i_slint_core::graphics::WGPUTexture::WGPU27Texture(texture) => texture.clone(), + #[cfg(feature = "unstable-wgpu-28")] + i_slint_core::graphics::WGPUTexture::WGPU28Texture(..) => return None, + }; + + // Skia won't submit commands right away, so remember the texture and transition before + // submitting. + self.textures_to_transition_for_sampling.borrow_mut().push(texture.clone()); + + self.backend.import_texture(canvas, texture) + } +} + +struct WindowAndDisplayHandle( + Arc, + Arc, +); + +impl raw_window_handle::HasWindowHandle for WindowAndDisplayHandle { + fn window_handle( + &self, + ) -> Result, raw_window_handle::HandleError> { + self.0.window_handle() + } +} + +impl raw_window_handle::HasDisplayHandle for WindowAndDisplayHandle { + fn display_handle( + &self, + ) -> Result, raw_window_handle::HandleError> { + self.1.display_handle() + } +} + +enum Backend { + #[cfg(target_vendor = "apple")] + Metal, + #[cfg(target_family = "windows")] + Dx12, + #[cfg(all(target_family = "unix", not(target_vendor = "apple")))] + Vulkan, +} + +impl TryFrom for Backend { + type Error = PlatformError; + + fn try_from(wgpu_backend: wgpu::Backend) -> Result { + match wgpu_backend { + wgpu_27::Backend::Noop => { + Err(PlatformError::from("Cannot use WGPU Noop backend with Skia")) + } + #[cfg(all(target_family = "unix", not(target_vendor = "apple")))] + wgpu_27::Backend::Vulkan => Ok(Self::Vulkan), + #[cfg(target_vendor = "apple")] + wgpu_27::Backend::Metal => Ok(Self::Metal), + #[cfg(target_family = "windows")] + wgpu_27::Backend::Dx12 => Ok(Self::Dx12), + other => Err(PlatformError::from(format!( + "Unsupported WGPU backend for use with Skia: {}", + other + ))), + } + } +} + +impl Backend { + fn make_context( + &self, + _adapter: &wgpu::Adapter, + device: &wgpu::Device, + queue: &wgpu::Queue, + ) -> Option { + match self { + #[cfg(target_vendor = "apple")] + Self::Metal => metal::make_metal_context(device, queue), + #[cfg(target_family = "windows")] + Self::Dx12 => unsafe { dx12::make_dx12_context(&_adapter, &device, &queue) }, + #[cfg(all(target_family = "unix", not(target_vendor = "apple")))] + Self::Vulkan => unsafe { vulkan::make_vulkan_context(device, queue) }, + } + } + + fn make_surface( + &self, + size: PhysicalWindowSize, + gr_context: &mut skia_safe::gpu::DirectContext, + frame: &wgpu::SurfaceTexture, + ) -> Option { + match self { + #[cfg(target_vendor = "apple")] + Self::Metal => unsafe { metal::make_metal_surface(size, gr_context, frame) }, + #[cfg(target_family = "windows")] + Self::Dx12 => unsafe { dx12::make_dx12_surface(size, gr_context, frame) }, + #[cfg(all(target_family = "unix", not(target_vendor = "apple")))] + Self::Vulkan => unsafe { vulkan::make_vulkan_surface(size, gr_context, frame) }, + } + } + + fn import_texture( + &self, + canvas: &skia_safe::Canvas, + texture: wgpu::Texture, + ) -> Option { + match self { + #[cfg(target_vendor = "apple")] + Self::Metal => unsafe { metal::import_metal_texture(canvas, texture) }, + #[cfg(target_family = "windows")] + Self::Dx12 => unsafe { dx12::import_dx12_texture(canvas, texture) }, + #[cfg(all(target_family = "unix", not(target_vendor = "apple")))] + Self::Vulkan => unsafe { vulkan::import_vulkan_texture(canvas, texture) }, + } + } +} diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_27_surface/dx12.rs b/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_27_surface/dx12.rs new file mode 100644 index 000000000..fca7678fb --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_27_surface/dx12.rs @@ -0,0 +1,139 @@ +// Copyright © SixtyFPS GmbH +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +use i_slint_core::api::PhysicalSize as PhysicalWindowSize; + +use windows::Win32::Graphics::Direct3D12::{D3D12_RESOURCE_STATE_PRESENT, ID3D12Resource}; +use windows::Win32::Graphics::Dxgi::Common::DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN; +use windows::Win32::Graphics::Dxgi::Common::{ + DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, +}; + +use wgpu_27 as wgpu; + +pub unsafe fn make_dx12_surface( + size: PhysicalWindowSize, + gr_context: &mut skia_safe::gpu::DirectContext, + frame: &wgpu::SurfaceTexture, +) -> Option { + unsafe { + let dx12_texture = frame.texture.as_hal::(); + + let texture_info = skia_safe::gpu::d3d::TextureResourceInfo { + resource: windows_core::Interface::from_raw(windows_core_58::Interface::into_raw( + dx12_texture.unwrap().raw_resource().clone(), + )), + alloc: None, + resource_state: D3D12_RESOURCE_STATE_PRESENT, + format: DXGI_FORMAT_R8G8B8A8_UNORM, + sample_count: 1, + level_count: 1, + sample_quality_pattern: DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN, + protected: skia_safe::gpu::Protected::No, + }; + + let backend_render_target = skia_safe::gpu::BackendRenderTarget::new_d3d( + (size.width as i32, size.height as i32), + &texture_info, + ); + + skia_safe::gpu::surfaces::wrap_backend_render_target( + gr_context, + &backend_render_target, + skia_safe::gpu::SurfaceOrigin::TopLeft, + skia_safe::ColorType::RGBA8888, + None, + None, + ) + } +} + +#[allow(non_snake_case)] +pub unsafe fn import_dx12_texture( + canvas: &skia_safe::Canvas, + texture: wgpu::Texture, +) -> Option { + unsafe { + let dx12_texture = texture.as_hal::(); + + let resource: ID3D12Resource = windows_core::Interface::from_raw( + windows_core_58::Interface::into_raw(dx12_texture.unwrap().raw_resource().clone()), + ); + + let dxgi_texture_format = resource.GetDesc().Format; + + let color_type = match dxgi_texture_format { + DXGI_FORMAT_R8G8B8A8_UNORM => skia_safe::ColorType::RGBA8888, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB => skia_safe::ColorType::SRGBA8888, + _ => return None, + }; + + let texture_info = skia_safe::gpu::d3d::TextureResourceInfo { + resource, + alloc: None, + resource_state: D3D12_RESOURCE_STATE_PRESENT, + format: dxgi_texture_format, + sample_count: 1, + level_count: 1, + sample_quality_pattern: DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN, + protected: skia_safe::gpu::Protected::No, + }; + let size = texture.size(); + + let backend_texture = skia_safe::gpu::BackendTexture::new_d3d( + (size.width as i32, size.height as i32), + &texture_info, + ); + + Some( + skia_safe::image::Image::from_texture( + canvas.recording_context().as_mut().unwrap(), + &backend_texture, + skia_safe::gpu::SurfaceOrigin::TopLeft, + color_type, + skia_safe::AlphaType::Unpremul, + None, + ) + .unwrap(), + ) + } +} + +pub unsafe fn make_dx12_context( + adapter: &wgpu::Adapter, + _device: &wgpu::Device, + queue: &wgpu::Queue, +) -> Option { + let backend = unsafe { + let maybe_dx12_queue = queue.as_hal::(); + let dx12_adapter = adapter.as_hal::().unwrap(); + + maybe_dx12_queue.map(|dx12_queue| { + let dx12_queue_raw = dx12_queue.as_raw(); + let mut dx12_device_old: Option = + None; + dx12_queue_raw.GetDevice(&mut dx12_device_old as _).unwrap(); + let dx12_device_old = dx12_device_old.unwrap(); + let dx12_device = windows_core::Interface::from_raw( + windows_core_58::Interface::into_raw(dx12_device_old), + ); + + let idxgiadapter_1: windows_58::Win32::Graphics::Dxgi::IDXGIAdapter1 = + dx12_adapter.as_raw().clone().into(); + + skia_safe::gpu::d3d::BackendContext { + adapter: windows_core::Interface::from_raw(windows_core_58::Interface::into_raw( + idxgiadapter_1, + )), + device: dx12_device, + queue: windows_core::Interface::from_raw(windows_core_58::Interface::into_raw( + dx12_queue_raw.clone(), + )), + memory_allocator: None, + protected_context: skia_safe::gpu::Protected::No, + } + }) + }; + + skia_safe::gpu::DirectContext::new_d3d(&backend.unwrap(), None) +} diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_27_surface/metal.rs b/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_27_surface/metal.rs new file mode 100644 index 000000000..0dc042ddb --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_27_surface/metal.rs @@ -0,0 +1,95 @@ +// Copyright © SixtyFPS GmbH +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +use foreign_types::ForeignType; +use i_slint_core::api::PhysicalSize as PhysicalWindowSize; + +use skia_safe::gpu::mtl; + +use wgpu_27 as wgpu; + +pub unsafe fn make_metal_surface( + size: PhysicalWindowSize, + gr_context: &mut skia_safe::gpu::DirectContext, + frame: &wgpu::SurfaceTexture, +) -> Option { + unsafe { + let metal_texture = frame.texture.as_hal::(); + + let texture_info = + mtl::TextureInfo::new(metal_texture.unwrap().raw_handle().as_ptr() as mtl::Handle); + + let backend_render_target = skia_safe::gpu::backend_render_targets::make_mtl( + (size.width as i32, size.height as i32), + &texture_info, + ); + + skia_safe::gpu::surfaces::wrap_backend_render_target( + gr_context, + &backend_render_target, + skia_safe::gpu::SurfaceOrigin::TopLeft, + skia_safe::ColorType::BGRA8888, + None, + None, + ) + } +} + +pub unsafe fn import_metal_texture( + canvas: &skia_safe::Canvas, + texture: wgpu::Texture, +) -> Option { + unsafe { + let metal_texture = texture.as_hal::(); + + let texture_info = + mtl::TextureInfo::new(metal_texture.unwrap().raw_handle().as_ptr() as mtl::Handle); + let size = texture.size(); + + let backend_texture = skia_safe::gpu::backend_textures::make_mtl( + (size.width as _, size.height as _), + skia_safe::gpu::Mipmapped::No, + &texture_info, + "Borrowed Metal texture", + ); + Some( + skia_safe::image::Image::from_texture( + canvas.recording_context().as_mut().unwrap(), + &backend_texture, + skia_safe::gpu::SurfaceOrigin::TopLeft, + match texture.format() { + wgpu::TextureFormat::Rgba8Unorm => skia_safe::ColorType::RGBA8888, + wgpu::TextureFormat::Rgba8UnormSrgb => skia_safe::ColorType::SRGBA8888, + _ => return None, + }, + skia_safe::AlphaType::Unpremul, + None, + ) + .unwrap(), + ) + } +} + +pub fn make_metal_context( + device: &wgpu::Device, + queue: &wgpu::Queue, +) -> Option { + let backend = unsafe { + let maybe_metal_device = device.as_hal::(); + let maybe_metal_queue = queue.as_hal::(); + + maybe_metal_device.and_then(|metal_device| { + let metal_device_raw = &*metal_device.raw_device().lock(); + + maybe_metal_queue.map(|metal_queue| { + let metal_queue_raw = &*metal_queue.as_raw().lock(); + mtl::BackendContext::new( + metal_device_raw.as_ptr() as mtl::Handle, + metal_queue_raw.as_ptr() as mtl::Handle, + ) + }) + })? + }; + + skia_safe::gpu::direct_contexts::make_metal(&backend, None) +} diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_27_surface/vulkan.rs b/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_27_surface/vulkan.rs new file mode 100644 index 000000000..3fce08edd --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_27_surface/vulkan.rs @@ -0,0 +1,164 @@ +// Copyright © SixtyFPS GmbH +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +use i_slint_core::api::PhysicalSize as PhysicalWindowSize; + +use ash::vk::Handle; +use skia_safe::gpu::vk; + +use wgpu_27 as wgpu; + +pub unsafe fn make_vulkan_surface( + size: PhysicalWindowSize, + gr_context: &mut skia_safe::gpu::DirectContext, + frame: &wgpu::SurfaceTexture, +) -> Option { + unsafe { + let vulkan_texture = frame.texture.as_hal::(); + + let alloc = skia_safe::gpu::vk::Alloc::default(); + + let (vk_format, color_type) = match frame.texture.format() { + wgpu::TextureFormat::Rgba8Unorm => { + (skia_safe::gpu::vk::Format::R8G8B8A8_UNORM, skia_safe::ColorType::RGBA8888) + } + wgpu::TextureFormat::Rgba8UnormSrgb => { + (skia_safe::gpu::vk::Format::R8G8B8A8_SRGB, skia_safe::ColorType::SRGBA8888) + } + wgpu::TextureFormat::Bgra8Unorm => { + (skia_safe::gpu::vk::Format::B8G8R8A8_UNORM, skia_safe::ColorType::BGRA8888) + } + _ => return None, + }; + + let texture_info = &skia_safe::gpu::vk::ImageInfo::new( + vulkan_texture.unwrap().raw_handle().as_raw() as _, + alloc, + skia_safe::gpu::vk::ImageTiling::OPTIMAL, + skia_safe::gpu::vk::ImageLayout::COLOR_ATTACHMENT_OPTIMAL, + vk_format, + 1, + None, + None, + None, + None, + ); + + let backend_render_target = skia_safe::gpu::backend_render_targets::make_vk( + (size.width as i32, size.height as i32), + texture_info, + ); + + skia_safe::gpu::surfaces::wrap_backend_render_target( + gr_context, + &backend_render_target, + skia_safe::gpu::SurfaceOrigin::TopLeft, + color_type, + None, + None, + ) + } +} + +pub unsafe fn import_vulkan_texture( + canvas: &skia_safe::Canvas, + texture: wgpu::Texture, +) -> Option { + unsafe { + let vulkan_texture = texture.as_hal::(); + + let alloc = skia_safe::gpu::vk::Alloc::default(); + + let (vk_format, color_type) = match texture.format() { + wgpu::TextureFormat::Rgba8Unorm => { + (skia_safe::gpu::vk::Format::R8G8B8A8_UNORM, skia_safe::ColorType::RGBA8888) + } + wgpu::TextureFormat::Rgba8UnormSrgb => { + (skia_safe::gpu::vk::Format::R8G8B8A8_SRGB, skia_safe::ColorType::SRGBA8888) + } + wgpu::TextureFormat::Bgra8Unorm => { + (skia_safe::gpu::vk::Format::B8G8R8A8_UNORM, skia_safe::ColorType::BGRA8888) + } + _ => return None, + }; + + let texture_info = &skia_safe::gpu::vk::ImageInfo::new( + vulkan_texture.unwrap().raw_handle().as_raw() as _, + alloc, + skia_safe::gpu::vk::ImageTiling::OPTIMAL, + skia_safe::gpu::vk::ImageLayout::COLOR_ATTACHMENT_OPTIMAL, + vk_format, + 1, + None, + None, + None, + None, + ); + + let size = texture.size(); + + let backend_texture = skia_safe::gpu::backend_textures::make_vk( + (size.width as _, size.height as _), + texture_info, + "Borrowed Vulkan texture", + ); + Some( + skia_safe::image::Image::from_texture( + canvas.recording_context().as_mut().unwrap(), + &backend_texture, + skia_safe::gpu::SurfaceOrigin::TopLeft, + color_type, + skia_safe::AlphaType::Unpremul, + None, + ) + .unwrap(), + ) + } +} + +pub unsafe fn make_vulkan_context( + device: &wgpu::Device, + queue: &wgpu::Queue, +) -> Option { + unsafe { + let vulkan_device = device.as_hal::()?; + let vulkan_queue = queue.as_hal::()?; + + let vulkan_queue_raw = vulkan_queue.as_raw(); + + let get_proc = |of| { + let result = match of { + skia_safe::gpu::vk::GetProcOf::Instance(instance, name) => vulkan_device + .shared_instance() + .entry() + .get_instance_proc_addr(ash::vk::Instance::from_raw(instance as _), name), + skia_safe::gpu::vk::GetProcOf::Device(device, name) => vulkan_device + .shared_instance() + .raw_instance() + .get_device_proc_addr(ash::vk::Device::from_raw(device as _), name), + }; + + match result { + Some(f) => f as _, + None => { + //println!("resolve of {} failed", of.name().to_str().unwrap()); + core::ptr::null() + } + } + }; + + let mut backend = vk::BackendContext::new( + vulkan_device.shared_instance().raw_instance().handle().as_raw() as _, + vulkan_device.raw_physical_device().as_raw() as _, + vulkan_device.raw_device().handle().as_raw() as _, + (vulkan_queue_raw.as_raw() as _, vulkan_device.queue_family_index() as _), + &get_proc, + ); + + // WGPU 27 is locked to vulkan 1.3 and skia assumes the highest vulkan API version of the physical device is chosen, + // causing it to ask for unsupported features/functions + backend.set_max_api_version(vk::Version::new(1, 3, 0)); + + skia_safe::gpu::direct_contexts::make_vulkan(&backend, None) + } +} diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_28_surface.rs b/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_28_surface.rs new file mode 100644 index 000000000..fa4479c86 --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_28_surface.rs @@ -0,0 +1,339 @@ +// Copyright © SixtyFPS GmbH +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +use i_slint_core::api::{GraphicsAPI, PhysicalSize as PhysicalWindowSize, Window}; +use i_slint_core::graphics::RequestedGraphicsAPI; +use i_slint_core::partial_renderer::DirtyRegion; +use i_slint_core::platform::PlatformError; + +use std::cell::RefCell; +use std::sync::Arc; + +use wgpu_28 as wgpu; + +use crate::SkiaSharedContext; + +#[cfg(target_family = "windows")] +mod dx12; +#[cfg(target_vendor = "apple")] +mod metal; +#[cfg(all(target_family = "unix", not(target_vendor = "apple")))] +mod vulkan; + +/// This surface renders into the given window using Metal. The provided display argument +/// is ignored, as it has no meaning on macOS. +pub struct WGPUSurface { + gr_context: RefCell, + instance: wgpu::Instance, + device: wgpu::Device, + queue: wgpu::Queue, + surface_config: RefCell, + surface: wgpu::Surface<'static>, + textures_to_transition_for_sampling: RefCell>, + backend: Backend, +} + +impl WGPUSurface { + pub fn new_with_surface( + surface_target: impl Into, + size: PhysicalWindowSize, + requested_graphics_api: Option, + ) -> Result { + let (instance, adapter, device, queue, surface) = + i_slint_core::graphics::wgpu_28::init_instance_adapter_device_queue_surface( + surface_target, + requested_graphics_api, + wgpu::Backends::GL /* we're not mapping that to skia because we can't save/restore state */ + .union(if cfg!(target_os = "windows") { + wgpu::Backends::VULKAN + } else { + wgpu::Backends::empty() + }), + )?; + + let mut surface_config = + surface.get_default_config(&adapter, size.width, size.height).unwrap(); + + let swapchain_capabilities = surface.get_capabilities(&adapter); + let swapchain_format = swapchain_capabilities + .formats + .iter() + .find(|f| { + matches!(f, wgpu::TextureFormat::Rgba8Unorm | wgpu::TextureFormat::Bgra8Unorm) + }) + .copied() + .unwrap_or_else(|| swapchain_capabilities.formats[0]); + surface_config.format = swapchain_format; + surface.configure(&device, &surface_config); + + let backend: Backend = adapter.get_info().backend.try_into()?; + + let gr_context = backend.make_context(&adapter, &device, &queue); + + Ok(Self { + gr_context: RefCell::new( + gr_context.ok_or_else(|| { + PlatformError::from("Failed to create Skia context from WGPU") + })?, + ), + instance, + device, + queue, + surface_config: surface_config.into(), + surface, + textures_to_transition_for_sampling: RefCell::new(Vec::new()), + backend, + }) + } +} + +impl super::Surface for WGPUSurface { + fn new( + _shared_context: &SkiaSharedContext, + window_handle: Arc, + display_handle: Arc, + size: PhysicalWindowSize, + requested_graphics_api: Option, + ) -> Result { + Self::new_with_surface( + Box::new(WindowAndDisplayHandle(window_handle, display_handle)) + as Box, + size, + requested_graphics_api, + ) + } + + fn name(&self) -> &'static str { + "wgpu" + } + + fn resize_event(&self, size: PhysicalWindowSize) -> Result<(), PlatformError> { + let mut surface_config = self.surface_config.borrow_mut(); + + // Skip reconfigure if size hasn't changed — DRM/KMS surfaces don't + // support being reconfigured. + if surface_config.width == size.width && surface_config.height == size.height { + return Ok(()); + } + + { + let gr_context = &mut self.gr_context.borrow_mut(); + // This is brute force, but for the lack of access to the fences this seems to work: Avoid any pending work so that + // IDXGISwapChain::ResizeBuffers doesn't complain that the surface is still in use. + gr_context.flush_submit_and_sync_cpu(); + } + + // Prefer FIFO modes over possible Mailbox setting for frame pacing and better energy efficiency. + surface_config.present_mode = wgpu::PresentMode::AutoVsync; + surface_config.width = size.width; + surface_config.height = size.height; + + self.surface.configure(&self.device, &surface_config); + Ok(()) + } + + fn render( + &self, + _window: &Window, + size: PhysicalWindowSize, + callback: &dyn Fn( + &skia_safe::Canvas, + Option<&mut skia_safe::gpu::DirectContext>, + u8, + ) -> Option, + pre_present_callback: &RefCell>>, + ) -> Result<(), PlatformError> { + let gr_context = &mut self.gr_context.borrow_mut(); + + let frame = match self.surface.get_current_texture() { + Ok(texture) => texture, + Err(wgpu::SurfaceError::Timeout) => { + self.surface.get_current_texture().map_err(|e| { + format!("Error obtaining current surface texture after timeout: {e}") + })? + } + // Outdated or lost: re-configure and try again + Err(_) => { + self.surface.configure(&self.device, &self.surface_config.borrow()); + self.surface.get_current_texture().map_err(|e| { + format!("Error obtaining current surface texture after initial error: {e}") + })? + } + }; + + let skia_surface = self.backend.make_surface(size, gr_context, &frame); + + let mut skia_surface = skia_surface + .ok_or_else(|| PlatformError::from("Failed to create Skia surface from WGPU"))?; + + callback(skia_surface.canvas(), Some(gr_context), 0); + + let textures_to_transition = self.textures_to_transition_for_sampling.take(); + if !textures_to_transition.is_empty() { + let mut encoder = self.device.create_command_encoder(&wgpu::CommandEncoderDescriptor { + label: Some("Skia texture transition encoder"), + }); + encoder.transition_resources( + std::iter::empty(), + textures_to_transition.iter().map(|texture| wgpu::TextureTransition { + texture, + selector: None, + state: wgpu::TextureUses::RESOURCE, + }), + ); + + self.queue.submit(Some(encoder.finish())); + } + + gr_context.submit(None); + + if let Some(pre_present_callback) = pre_present_callback.borrow_mut().as_mut() { + pre_present_callback(); + } + + frame.present(); + + Ok(()) + } + + fn bits_per_pixel(&self) -> Result { + Ok(match self.surface_config.borrow().format { + wgpu_28::TextureFormat::Rgba8Unorm + | wgpu_28::TextureFormat::Rgba8UnormSrgb + | wgpu_28::TextureFormat::Bgra8Unorm + | wgpu_28::TextureFormat::Bgra8UnormSrgb => 32, + fmt => return Err(format!("Unsupported surface format {:#?}", fmt).into()), + }) + } + + #[cfg(feature = "unstable-wgpu-28")] + fn with_graphics_api(&self, callback: &mut dyn FnMut(GraphicsAPI<'_>)) { + let api = i_slint_core::graphics::create_graphics_api_wgpu_28( + self.instance.clone(), + self.device.clone(), + self.queue.clone(), + ); + callback(api) + } + + #[cfg(any(feature = "unstable-wgpu-27", feature = "unstable-wgpu-28"))] + fn import_wgpu_texture( + &self, + canvas: &skia_safe::Canvas, + any_wgpu_texture: &i_slint_core::graphics::WGPUTexture, + ) -> Option { + let texture = match any_wgpu_texture { + #[cfg(feature = "unstable-wgpu-27")] + i_slint_core::graphics::WGPUTexture::WGPU27Texture(..) => return None, + #[cfg(feature = "unstable-wgpu-28")] + i_slint_core::graphics::WGPUTexture::WGPU28Texture(texture) => texture.clone(), + }; + + // Skia won't submit commands right away, so remember the texture and transition before + // submitting. + self.textures_to_transition_for_sampling.borrow_mut().push(texture.clone()); + + self.backend.import_texture(canvas, texture) + } +} + +struct WindowAndDisplayHandle( + Arc, + Arc, +); + +impl raw_window_handle::HasWindowHandle for WindowAndDisplayHandle { + fn window_handle( + &self, + ) -> Result, raw_window_handle::HandleError> { + self.0.window_handle() + } +} + +impl raw_window_handle::HasDisplayHandle for WindowAndDisplayHandle { + fn display_handle( + &self, + ) -> Result, raw_window_handle::HandleError> { + self.1.display_handle() + } +} + +enum Backend { + #[cfg(target_vendor = "apple")] + Metal, + #[cfg(target_family = "windows")] + Dx12, + #[cfg(all(target_family = "unix", not(target_vendor = "apple")))] + Vulkan, +} + +impl TryFrom for Backend { + type Error = PlatformError; + + fn try_from(wgpu_backend: wgpu::Backend) -> Result { + match wgpu_backend { + wgpu_28::Backend::Noop => { + Err(PlatformError::from("Cannot use WGPU Noop backend with Skia")) + } + #[cfg(all(target_family = "unix", not(target_vendor = "apple")))] + wgpu_28::Backend::Vulkan => Ok(Self::Vulkan), + #[cfg(target_vendor = "apple")] + wgpu_28::Backend::Metal => Ok(Self::Metal), + #[cfg(target_family = "windows")] + wgpu_28::Backend::Dx12 => Ok(Self::Dx12), + other => Err(PlatformError::from(format!( + "Unsupported WGPU backend for use with Skia: {}", + other + ))), + } + } +} + +impl Backend { + fn make_context( + &self, + _adapter: &wgpu::Adapter, + device: &wgpu::Device, + queue: &wgpu::Queue, + ) -> Option { + match self { + #[cfg(target_vendor = "apple")] + Self::Metal => metal::make_metal_context(device, queue), + #[cfg(target_family = "windows")] + Self::Dx12 => unsafe { dx12::make_dx12_context(&_adapter, &device, &queue) }, + #[cfg(all(target_family = "unix", not(target_vendor = "apple")))] + Self::Vulkan => unsafe { vulkan::make_vulkan_context(device, queue) }, + } + } + + fn make_surface( + &self, + size: PhysicalWindowSize, + gr_context: &mut skia_safe::gpu::DirectContext, + frame: &wgpu::SurfaceTexture, + ) -> Option { + match self { + #[cfg(target_vendor = "apple")] + Self::Metal => unsafe { metal::make_metal_surface(size, gr_context, frame) }, + #[cfg(target_family = "windows")] + Self::Dx12 => unsafe { dx12::make_dx12_surface(size, gr_context, frame) }, + #[cfg(all(target_family = "unix", not(target_vendor = "apple")))] + Self::Vulkan => unsafe { vulkan::make_vulkan_surface(size, gr_context, frame) }, + } + } + + fn import_texture( + &self, + canvas: &skia_safe::Canvas, + texture: wgpu::Texture, + ) -> Option { + match self { + #[cfg(target_vendor = "apple")] + Self::Metal => unsafe { metal::import_metal_texture(canvas, texture) }, + #[cfg(target_family = "windows")] + Self::Dx12 => unsafe { dx12::import_dx12_texture(canvas, texture) }, + #[cfg(all(target_family = "unix", not(target_vendor = "apple")))] + Self::Vulkan => unsafe { vulkan::import_vulkan_texture(canvas, texture) }, + } + } +} diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_28_surface/dx12.rs b/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_28_surface/dx12.rs new file mode 100644 index 000000000..9a3099d54 --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_28_surface/dx12.rs @@ -0,0 +1,139 @@ +// Copyright © SixtyFPS GmbH +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +use i_slint_core::api::PhysicalSize as PhysicalWindowSize; + +use windows::Win32::Graphics::Direct3D12::{D3D12_RESOURCE_STATE_PRESENT, ID3D12Resource}; +use windows::Win32::Graphics::Dxgi::Common::DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN; +use windows::Win32::Graphics::Dxgi::Common::{ + DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, +}; + +use wgpu_28 as wgpu; + +pub unsafe fn make_dx12_surface( + size: PhysicalWindowSize, + gr_context: &mut skia_safe::gpu::DirectContext, + frame: &wgpu::SurfaceTexture, +) -> Option { + unsafe { + let dx12_texture = frame.texture.as_hal::(); + + let texture_info = skia_safe::gpu::d3d::TextureResourceInfo { + resource: windows_core::Interface::from_raw(windows_core::Interface::into_raw( + dx12_texture.unwrap().raw_resource().clone(), + )), + alloc: None, + resource_state: D3D12_RESOURCE_STATE_PRESENT, + format: DXGI_FORMAT_R8G8B8A8_UNORM, + sample_count: 1, + level_count: 1, + sample_quality_pattern: DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN, + protected: skia_safe::gpu::Protected::No, + }; + + let backend_render_target = skia_safe::gpu::BackendRenderTarget::new_d3d( + (size.width as i32, size.height as i32), + &texture_info, + ); + + skia_safe::gpu::surfaces::wrap_backend_render_target( + gr_context, + &backend_render_target, + skia_safe::gpu::SurfaceOrigin::TopLeft, + skia_safe::ColorType::RGBA8888, + None, + None, + ) + } +} + +#[allow(non_snake_case)] +pub unsafe fn import_dx12_texture( + canvas: &skia_safe::Canvas, + texture: wgpu::Texture, +) -> Option { + unsafe { + let dx12_texture = texture.as_hal::(); + + let resource: ID3D12Resource = windows_core::Interface::from_raw( + windows_core::Interface::into_raw(dx12_texture.unwrap().raw_resource().clone()), + ); + + let dxgi_texture_format = resource.GetDesc().Format; + + let color_type = match dxgi_texture_format { + DXGI_FORMAT_R8G8B8A8_UNORM => skia_safe::ColorType::RGBA8888, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB => skia_safe::ColorType::SRGBA8888, + _ => return None, + }; + + let texture_info = skia_safe::gpu::d3d::TextureResourceInfo { + resource, + alloc: None, + resource_state: D3D12_RESOURCE_STATE_PRESENT, + format: dxgi_texture_format, + sample_count: 1, + level_count: 1, + sample_quality_pattern: DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN, + protected: skia_safe::gpu::Protected::No, + }; + let size = texture.size(); + + let backend_texture = skia_safe::gpu::BackendTexture::new_d3d( + (size.width as i32, size.height as i32), + &texture_info, + ); + + Some( + skia_safe::image::Image::from_texture( + canvas.recording_context().as_mut().unwrap(), + &backend_texture, + skia_safe::gpu::SurfaceOrigin::TopLeft, + color_type, + skia_safe::AlphaType::Unpremul, + None, + ) + .unwrap(), + ) + } +} + +pub unsafe fn make_dx12_context( + adapter: &wgpu::Adapter, + _device: &wgpu::Device, + queue: &wgpu::Queue, +) -> Option { + let backend = unsafe { + let maybe_dx12_queue = queue.as_hal::(); + let dx12_adapter = adapter.as_hal::().unwrap(); + + maybe_dx12_queue.map(|dx12_queue| { + let dx12_queue_raw = dx12_queue.as_raw(); + let mut dx12_device_old: Option = + None; + dx12_queue_raw.GetDevice(&mut dx12_device_old as _).unwrap(); + let dx12_device_old = dx12_device_old.unwrap(); + let dx12_device = windows_core::Interface::from_raw(windows_core::Interface::into_raw( + dx12_device_old, + )); + + let idxgiadapter_3: windows::Win32::Graphics::Dxgi::IDXGIAdapter3 = + dx12_adapter.as_raw().clone().into(); + + skia_safe::gpu::d3d::BackendContext { + adapter: windows_core::Interface::from_raw(windows_core::Interface::into_raw( + idxgiadapter_3, + )), + device: dx12_device, + queue: windows_core::Interface::from_raw(windows_core::Interface::into_raw( + dx12_queue_raw.clone(), + )), + memory_allocator: None, + protected_context: skia_safe::gpu::Protected::No, + } + }) + }; + + skia_safe::gpu::DirectContext::new_d3d(&backend.unwrap(), None) +} diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_28_surface/metal.rs b/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_28_surface/metal.rs new file mode 100644 index 000000000..6b635dee5 --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_28_surface/metal.rs @@ -0,0 +1,95 @@ +// Copyright © SixtyFPS GmbH +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +use foreign_types::ForeignType; +use i_slint_core::api::PhysicalSize as PhysicalWindowSize; + +use skia_safe::gpu::mtl; + +use wgpu_28 as wgpu; + +pub unsafe fn make_metal_surface( + size: PhysicalWindowSize, + gr_context: &mut skia_safe::gpu::DirectContext, + frame: &wgpu::SurfaceTexture, +) -> Option { + unsafe { + let metal_texture = frame.texture.as_hal::(); + + let texture_info = + mtl::TextureInfo::new(metal_texture.unwrap().raw_handle().as_ptr() as mtl::Handle); + + let backend_render_target = skia_safe::gpu::backend_render_targets::make_mtl( + (size.width as i32, size.height as i32), + &texture_info, + ); + + skia_safe::gpu::surfaces::wrap_backend_render_target( + gr_context, + &backend_render_target, + skia_safe::gpu::SurfaceOrigin::TopLeft, + skia_safe::ColorType::BGRA8888, + None, + None, + ) + } +} + +pub unsafe fn import_metal_texture( + canvas: &skia_safe::Canvas, + texture: wgpu::Texture, +) -> Option { + unsafe { + let metal_texture = texture.as_hal::(); + + let texture_info = + mtl::TextureInfo::new(metal_texture.unwrap().raw_handle().as_ptr() as mtl::Handle); + let size = texture.size(); + + let backend_texture = skia_safe::gpu::backend_textures::make_mtl( + (size.width as _, size.height as _), + skia_safe::gpu::Mipmapped::No, + &texture_info, + "Borrowed Metal texture", + ); + Some( + skia_safe::image::Image::from_texture( + canvas.recording_context().as_mut().unwrap(), + &backend_texture, + skia_safe::gpu::SurfaceOrigin::TopLeft, + match texture.format() { + wgpu::TextureFormat::Rgba8Unorm => skia_safe::ColorType::RGBA8888, + wgpu::TextureFormat::Rgba8UnormSrgb => skia_safe::ColorType::SRGBA8888, + _ => return None, + }, + skia_safe::AlphaType::Unpremul, + None, + ) + .unwrap(), + ) + } +} + +pub fn make_metal_context( + device: &wgpu::Device, + queue: &wgpu::Queue, +) -> Option { + let backend = unsafe { + let maybe_metal_device = device.as_hal::(); + let maybe_metal_queue = queue.as_hal::(); + + maybe_metal_device.and_then(|metal_device| { + let metal_device_raw = metal_device.raw_device(); + + maybe_metal_queue.map(|metal_queue| { + let metal_queue_raw = &*metal_queue.as_raw().lock(); + mtl::BackendContext::new( + metal_device_raw.as_ptr() as mtl::Handle, + metal_queue_raw.as_ptr() as mtl::Handle, + ) + }) + })? + }; + + skia_safe::gpu::direct_contexts::make_metal(&backend, None) +} diff --git a/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_28_surface/vulkan.rs b/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_28_surface/vulkan.rs new file mode 100644 index 000000000..44b49744e --- /dev/null +++ b/crates/vendor/i-slint-renderer-skia-1.16.1/wgpu_28_surface/vulkan.rs @@ -0,0 +1,164 @@ +// Copyright © SixtyFPS GmbH +// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 + +use i_slint_core::api::PhysicalSize as PhysicalWindowSize; + +use ash::vk::Handle; +use skia_safe::gpu::vk; + +use wgpu_28 as wgpu; + +pub unsafe fn make_vulkan_surface( + size: PhysicalWindowSize, + gr_context: &mut skia_safe::gpu::DirectContext, + frame: &wgpu::SurfaceTexture, +) -> Option { + unsafe { + let vulkan_texture = frame.texture.as_hal::(); + + let alloc = skia_safe::gpu::vk::Alloc::default(); + + let (vk_format, color_type) = match frame.texture.format() { + wgpu::TextureFormat::Rgba8Unorm => { + (skia_safe::gpu::vk::Format::R8G8B8A8_UNORM, skia_safe::ColorType::RGBA8888) + } + wgpu::TextureFormat::Rgba8UnormSrgb => { + (skia_safe::gpu::vk::Format::R8G8B8A8_SRGB, skia_safe::ColorType::SRGBA8888) + } + wgpu::TextureFormat::Bgra8Unorm => { + (skia_safe::gpu::vk::Format::B8G8R8A8_UNORM, skia_safe::ColorType::BGRA8888) + } + _ => return None, + }; + + let texture_info = &skia_safe::gpu::vk::ImageInfo::new( + vulkan_texture.unwrap().raw_handle().as_raw() as _, + alloc, + skia_safe::gpu::vk::ImageTiling::OPTIMAL, + skia_safe::gpu::vk::ImageLayout::COLOR_ATTACHMENT_OPTIMAL, + vk_format, + 1, + None, + None, + None, + None, + ); + + let backend_render_target = skia_safe::gpu::backend_render_targets::make_vk( + (size.width as i32, size.height as i32), + texture_info, + ); + + skia_safe::gpu::surfaces::wrap_backend_render_target( + gr_context, + &backend_render_target, + skia_safe::gpu::SurfaceOrigin::TopLeft, + color_type, + None, + None, + ) + } +} + +pub unsafe fn import_vulkan_texture( + canvas: &skia_safe::Canvas, + texture: wgpu::Texture, +) -> Option { + unsafe { + let vulkan_texture = texture.as_hal::(); + + let alloc = skia_safe::gpu::vk::Alloc::default(); + + let (vk_format, color_type) = match texture.format() { + wgpu::TextureFormat::Rgba8Unorm => { + (skia_safe::gpu::vk::Format::R8G8B8A8_UNORM, skia_safe::ColorType::RGBA8888) + } + wgpu::TextureFormat::Rgba8UnormSrgb => { + (skia_safe::gpu::vk::Format::R8G8B8A8_SRGB, skia_safe::ColorType::SRGBA8888) + } + wgpu::TextureFormat::Bgra8Unorm => { + (skia_safe::gpu::vk::Format::B8G8R8A8_UNORM, skia_safe::ColorType::BGRA8888) + } + _ => return None, + }; + + let texture_info = &skia_safe::gpu::vk::ImageInfo::new( + vulkan_texture.unwrap().raw_handle().as_raw() as _, + alloc, + skia_safe::gpu::vk::ImageTiling::OPTIMAL, + skia_safe::gpu::vk::ImageLayout::COLOR_ATTACHMENT_OPTIMAL, + vk_format, + 1, + None, + None, + None, + None, + ); + + let size = texture.size(); + + let backend_texture = skia_safe::gpu::backend_textures::make_vk( + (size.width as _, size.height as _), + texture_info, + "Borrowed Vulkan texture", + ); + Some( + skia_safe::image::Image::from_texture( + canvas.recording_context().as_mut().unwrap(), + &backend_texture, + skia_safe::gpu::SurfaceOrigin::TopLeft, + color_type, + skia_safe::AlphaType::Unpremul, + None, + ) + .unwrap(), + ) + } +} + +pub unsafe fn make_vulkan_context( + device: &wgpu::Device, + queue: &wgpu::Queue, +) -> Option { + unsafe { + let vulkan_device = device.as_hal::()?; + let vulkan_queue = queue.as_hal::()?; + + let vulkan_queue_raw = vulkan_queue.as_raw(); + + let get_proc = |of| { + let result = match of { + skia_safe::gpu::vk::GetProcOf::Instance(instance, name) => vulkan_device + .shared_instance() + .entry() + .get_instance_proc_addr(ash::vk::Instance::from_raw(instance as _), name), + skia_safe::gpu::vk::GetProcOf::Device(device, name) => vulkan_device + .shared_instance() + .raw_instance() + .get_device_proc_addr(ash::vk::Device::from_raw(device as _), name), + }; + + match result { + Some(f) => f as _, + None => { + //println!("resolve of {} failed", of.name().to_str().unwrap()); + core::ptr::null() + } + } + }; + + let mut backend = vk::BackendContext::new( + vulkan_device.shared_instance().raw_instance().handle().as_raw() as _, + vulkan_device.raw_physical_device().as_raw() as _, + vulkan_device.raw_device().handle().as_raw() as _, + (vulkan_queue_raw.as_raw() as _, vulkan_device.queue_family_index() as _), + &get_proc, + ); + + // WGPU 28 is locked to vulkan 1.3 and skia assumes the highest vulkan API version of the physical device is chosen, + // causing it to ask for unsupported features/functions + backend.set_max_api_version(vk::Version::new(1, 3, 0)); + + skia_safe::gpu::direct_contexts::make_vulkan(&backend, None) + } +}