mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 23:35:34 +00:00
Bug 1628772 - Update core-foundation dependency to 0.7 r=kats
Differential Revision: https://phabricator.services.mozilla.com/D70432 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
50c061e425
commit
feed464a5d
@ -75,7 +75,7 @@ rev = "5e870faf6f95d79d11efc813e56370ad124bbed5"
|
||||
[source."https://github.com/ChunMinChang/cubeb-coreaudio-rs"]
|
||||
git = "https://github.com/ChunMinChang/cubeb-coreaudio-rs"
|
||||
replace-with = "vendored-sources"
|
||||
rev = "ea9e5aa3e6014f219cf5fa0690bc4b06916f0b09"
|
||||
rev = "27cf89ef920d1968c06e45f2a7903725d6b635cd"
|
||||
|
||||
[source.crates-io]
|
||||
replace-with = "vendored-sources"
|
||||
|
44
Cargo.lock
generated
44
Cargo.lock
generated
@ -174,9 +174,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "authenticator"
|
||||
version = "0.2.10"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ab47f9d4626728ef5b1622700ebb38b1ea76869d1c4c0ab0868297dfd6b4b3e"
|
||||
checksum = "ff593fb4dd388fe452c5e63d4d668699466bd46b571c4b852dfbca4bac8f0706"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"boxfnonce",
|
||||
@ -586,9 +586,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cocoa"
|
||||
version = "0.19.0"
|
||||
version = "0.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8cd20045e880893b4a8286d5639e9ade85fb1f6a14c291f882cf8cf2149d37d9"
|
||||
checksum = "0a4736c86d51bd878b474400d9ec888156f4037015f5d09794fab9f26eab1ad4"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"block",
|
||||
@ -639,9 +639,9 @@ checksum = "6ff9c56c9fb2a49c05ef0e431485a22400af20d33226dc0764d891d09e724127"
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.6.3"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4e2640d6d0bf22e82bed1b73c6aef8d5dd31e5abe6666c57e6d45e2649f4f887"
|
||||
checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
@ -649,15 +649,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.6.2"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"
|
||||
checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac"
|
||||
|
||||
[[package]]
|
||||
name = "core-graphics"
|
||||
version = "0.17.3"
|
||||
version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56790968ab1c8a1202a102e6de05fc6e1ec87da99e4e93e9a7d13efbfc1e95a9"
|
||||
checksum = "59e78b2e0aaf43f08e7ae0d6bc96895ef72ff0921c7d4ff4762201b2dba376dd"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"core-foundation",
|
||||
@ -667,9 +667,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "core-text"
|
||||
version = "13.0.0"
|
||||
version = "15.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3f46450d6f2397261af420b4ccce23807add2e45fa206410a03d66fb7f050ae"
|
||||
checksum = "131b3fd1f8bd5db9f2b398fa4fdb6008c64afc04d447c306ac2c7e98fba2a61d"
|
||||
dependencies = [
|
||||
"core-foundation",
|
||||
"core-graphics",
|
||||
@ -689,7 +689,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "coreaudio-sys-utils"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/ChunMinChang/cubeb-coreaudio-rs?rev=ea9e5aa3e6014f219cf5fa0690bc4b06916f0b09#ea9e5aa3e6014f219cf5fa0690bc4b06916f0b09"
|
||||
source = "git+https://github.com/ChunMinChang/cubeb-coreaudio-rs?rev=27cf89ef920d1968c06e45f2a7903725d6b635cd#27cf89ef920d1968c06e45f2a7903725d6b635cd"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"coreaudio-sys",
|
||||
@ -926,7 +926,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "cubeb-coreaudio"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/ChunMinChang/cubeb-coreaudio-rs?rev=ea9e5aa3e6014f219cf5fa0690bc4b06916f0b09#ea9e5aa3e6014f219cf5fa0690bc4b06916f0b09"
|
||||
source = "git+https://github.com/ChunMinChang/cubeb-coreaudio-rs?rev=27cf89ef920d1968c06e45f2a7903725d6b635cd#27cf89ef920d1968c06e45f2a7903725d6b635cd"
|
||||
dependencies = [
|
||||
"atomic",
|
||||
"audio-mixer",
|
||||
@ -1588,9 +1588,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gfx-backend-metal"
|
||||
version = "0.4.0"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8de5c71f18ba805c95b84d6c78c472ef44485a6fc46e3b49fe1e6739c8d7b0c0"
|
||||
checksum = "b19262dc17be65f2c5b5c72fe5199ab2017faf51f9e0e353c4a68b63a88f933b"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bitflags",
|
||||
@ -1615,9 +1615,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gfx-backend-vulkan"
|
||||
version = "0.4.0"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62538fedd66a78968a162e8e1a29d085ffbc97f8782634684b2f7da7aea59207"
|
||||
checksum = "f1b8d901941d1734d307dacd8e5f00c89ee8fb8e78b4dab3edd91248150b26b4"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"ash",
|
||||
@ -1635,9 +1635,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gfx-hal"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "977716fea7800ab5bc9a1e048dd2f72b23af166d8c2f48c6fb6d1ce37d77ca7e"
|
||||
checksum = "7c88981665c780447bb08eb099e1ded330754a7246719bab927ee4a949c0ba7f"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"raw-window-handle",
|
||||
@ -2527,9 +2527,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "metal"
|
||||
version = "0.17.0"
|
||||
version = "0.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ddf8052f20601c7af6293d3f7bf7b9159aee5974804fe65d871d437f933ec1eb"
|
||||
checksum = "e198a0ee42bdbe9ef2c09d0b9426f3b2b47d90d93a4a9b0395c4cea605e92dc0"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"block",
|
||||
|
@ -34,7 +34,7 @@ dirs = "1.0"
|
||||
winapi = "0.3"
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
core-foundation = "0.6"
|
||||
core-graphics = "0.17.1"
|
||||
core-foundation = "0.7"
|
||||
core-graphics = "0.19"
|
||||
foreign-types = "0.3.0"
|
||||
|
||||
|
@ -68,4 +68,4 @@ webrender = { path = "../webrender" }
|
||||
winit = "0.19"
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
core-foundation = "0.6.4"
|
||||
core-foundation = "0.7"
|
||||
|
@ -65,6 +65,6 @@ libc = "0.2"
|
||||
dwrote = "0.9"
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
core-foundation = "0.6"
|
||||
core-graphics = "0.17.1"
|
||||
core-text = { version = "13", default-features = false }
|
||||
core-foundation = "0.7"
|
||||
core-graphics = "0.19"
|
||||
core-text = { version = "15", default-features = false }
|
||||
|
@ -28,5 +28,5 @@ malloc_size_of = { version = "0.0.1", path = "../wr_malloc_size_of", package = "
|
||||
peek-poke = { version = "0.2", path = "../peek-poke", features = ["extras"] }
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
core-foundation = "0.6"
|
||||
core-graphics = "0.17.1"
|
||||
core-foundation = "0.7"
|
||||
core-graphics = "0.19"
|
||||
|
@ -38,8 +38,8 @@ default-features = false
|
||||
features = ["png"]
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
core-graphics = "0.17.1"
|
||||
core-foundation = "0.6.4"
|
||||
core-graphics = "0.19"
|
||||
core-foundation = "0.7"
|
||||
|
||||
[features]
|
||||
default = [ "env_logger" ]
|
||||
|
@ -16,7 +16,7 @@ pkcs11 = "0.4"
|
||||
sha2 = "0.8"
|
||||
|
||||
[target."cfg(target_os = \"macos\")".dependencies.core-foundation]
|
||||
version = "0.6"
|
||||
version = "0.7"
|
||||
|
||||
[target."cfg(target_os = \"macos\")".dependencies.libloading]
|
||||
version = "0.5"
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"Cargo.lock":"30ecb0ded0f1f15cdcb77a03fa5e3c017960938fe82095b52a44706fb6368e6c","Cargo.toml":"85145ad982a1e8e5c5790d8c5ddfe0875ae269119e8049be08ef3191ca7ee9b4","LICENSE":"e866c8f5864d4cacfe403820e722e9dc03fe3c7565efa5e4dad9051d827bb92a","README.md":"8f6794c59c9401388d01f095a448f8ce3392e1be7f7bdc7354e6a288b2f2f33e","build.rs":"bc308b771ae9741d775370e3efe45e9cca166fd1d0335f4214b00497042ccc55","examples/main.rs":"7af9e288b1836fb9362589b6bf54c1f1d277bdf64df60c1caccef98c1bfe792c","rustfmt.toml":"de4e1daab481c1572805aed3e51e72c5dc1b3e5af757bc675e1717b251c6e922","src/capi.rs":"99f0d0742bf102451698c7e32db0fc4941b8ac10bec2fb309f41e7e5d99b05bd","src/consts.rs":"4c34980f94d1017e5e75e29b26750c1678e0609c9227296951ffbb9e180a5adf","src/freebsd/device.rs":"914ac446ff24cc3fc050732372e286e1fedf8341a8d4754e392bc9f38393b142","src/freebsd/mod.rs":"42dcb57fbeb00140003a8ad39acac9b547062b8f281a3fa5deb5f92a6169dde6","src/freebsd/monitor.rs":"3683370931b15f05403d240a788a87b1bea801284ee74b849e1f330a4a231dd0","src/freebsd/transaction.rs":"e3615cfdd7f23e9a80a53c32e0fa2a5ae290a432b009bed2b2e74e0df77f8266","src/freebsd/uhid.rs":"d19ade6e808e63981ba5f93d482d676ffa9dff29cb2b7011486591f69ddbbdcd","src/hidproto.rs":"9de8d86509d706e3a0ade2b5a57eec7730afd4073d9cdd99aa8ca1376be37f83","src/lib.rs":"4b43ad18b4eae9356ba6d7954542a38f3015ab8a72ab1fde28169aaf343721d8","src/linux/device.rs":"2271fbb8d176ec01f83a899c0c8194a954465fdd8670a9b136ab88baaba2ee48","src/linux/hidraw.rs":"0d5804d1cd99e7c30c8bde3089f8ed98d7d683d3cd487821e29b133b1ee90228","src/linux/hidwrapper.h":"72785db3a9b27ea72b6cf13a958fee032af54304522d002f56322473978a20f9","src/linux/hidwrapper.rs":"4be65676cf3220929700bf4906938dcbd1538ba53d40c60b08f9ba8890c910f6","src/linux/ioctl_aarch64le.rs":"f482a967c8006d0c34c03e9f2aeca4c4f426c5c27f7f930f3230129caf176060","src/linux/ioctl_armle.rs":"f482a967c8006d0c34c03e9f2aeca4c4f426c5c27f7f930f3230129caf176060","src/linux/ioctl_mips64le.rs":"fbda309934ad8bda689cd4fb5c0ca696fe26dedb493fe9d5a5322c3047d474fd","src/linux/ioctl_powerpc64le.rs":"0d50afd0bf094b5146d65d263544cba141ff248e487d90d6c03559e9b3c2fd55","src/linux/ioctl_s390xbe.rs":"2d8b265cd39a9f46816f83d5a5df0701c13eb842bc609325bad42ce50add3bf0","src/linux/ioctl_x86.rs":"f482a967c8006d0c34c03e9f2aeca4c4f426c5c27f7f930f3230129caf176060","src/linux/ioctl_x86_64.rs":"f482a967c8006d0c34c03e9f2aeca4c4f426c5c27f7f930f3230129caf176060","src/linux/mod.rs":"446e435126d2a58f167f648dd95cba28e8ac9c17f1f799e1eaeab80ea800fc57","src/linux/monitor.rs":"57890c5f000829c5c0f44032fe5364126e60451605d517c79ba4d4fe4fd6c94b","src/linux/transaction.rs":"92b47d064c1fa5fe2674f65d06c519601480fc1c2b03667ade19a186a6ec9d13","src/macos/device.rs":"57186092fd937124f96afacef57d0493efce86553ac50d527e6365b93eaabddf","src/macos/iokit.rs":"a0fd818224718e96ad5d106dfc235f4bc9218a59f5114b9f9825abe3ee62bce7","src/macos/mod.rs":"333e561554fc901d4f6092f6e4c85823e2b0c4ff31c9188d0e6d542b71a0a07c","src/macos/monitor.rs":"d3a1dadfbfb5bfd665d75493d72bfbca3da9c43692262230f10d5feadb928e62","src/macos/transaction.rs":"cf2e67530401b0ef18e978557f470aa2661b3a5f4ef64cd3053d6e11f2f19b2b","src/manager.rs":"7428fc23038b004841936d8f27f8dc33234d5c06361efa75b73c7a5c035dae75","src/openbsd/device.rs":"b5de51a8b3ae0e542373a2064cff1ae6e1f91ac78e1406805d9ca8a05ce758c9","src/openbsd/mod.rs":"514274d414042ff84b3667a41a736e78581e22fda87ccc97c2bc05617e381a30","src/openbsd/monitor.rs":"953800ab8fd6adf5d70633059b20d2cf0f5a2701d92e58a06d1ec33208983bc4","src/openbsd/transaction.rs":"10be1ce983c72513fec57baaa6869ef02b9cdbd8ea66bb2dfe24d857faf054f5","src/statemachine.rs":"28477fba601f5086b85e911da1e4f04af3f0060329e6e0e1172b960f9c52fd41","src/stub/device.rs":"32e134fc8826667d16b02fe32831fc29f4d52d0a7a065d7d649c4a1c5faa0dcc","src/stub/mod.rs":"6a7fec504a52d403b0241b18cd8b95088a31807571f4c0a67e4055afc74f4453","src/stub/transaction.rs":"8655bc37b69c318ff0bc69a62fcb31820eb6ad7921a53e0cecffa15e80d97630","src/u2fhid-capi.h":"fc2575f720ab8f6bc0c523c57310f35c464576bd5150c3c2b1873d3abde5909b","src/u2fprotocol.rs":"77b6d5005d8b3d98cd96e480013c1e97155da5df3cf5e19819ee82ac8e3b6c7d","src/u2ftypes.rs":"cf972d805b15a95f4c18d556aa01660ce451f1d3bce1516b0ce73d17e73199aa","src/util.rs":"c517750c9bf00f44fb63cada8c40d0227a4d3765488499a1f4d3c0f01daa67a7","src/windows/device.rs":"86a6ecc239608977a963f375336780746e90e95c3eb9ff303347beb983c40ab6","src/windows/mod.rs":"218e7f2fe91ecb390c12bba5a5ffdad2c1f0b22861c937f4d386262e5b3dd617","src/windows/monitor.rs":"d8e8316e5bd9fc6ebed737bd8d6e0713c99287aca04f392f6319cdfd8576f754","src/windows/transaction.rs":"1b9a5af866048911ccaec8c94b698b28ae1b80e3d4842f9d6ed38462f459c796","src/windows/winapi.rs":"a4286fd5e8dcb178e37df512ba7752b2a3c38fe30e1176022767d2c05c242bf8"},"package":"7ab47f9d4626728ef5b1622700ebb38b1ea76869d1c4c0ab0868297dfd6b4b3e"}
|
||||
{"files":{"Cargo.lock":"4e90be1a6ead1f94b74ab22da0ad669e69bb7c112849d0e43e8942b83ca5ba7b","Cargo.toml":"31b25c3aadc79a147603253dee37c7fcd74e1a20bb62dd3d3b506e097b555fa2","LICENSE":"e866c8f5864d4cacfe403820e722e9dc03fe3c7565efa5e4dad9051d827bb92a","README.md":"f7b1f971632873f3d3c322c2f5cf980fbcd0116786efb580b89fe6ddac07fc07","build.rs":"bc308b771ae9741d775370e3efe45e9cca166fd1d0335f4214b00497042ccc55","examples/main.rs":"7af9e288b1836fb9362589b6bf54c1f1d277bdf64df60c1caccef98c1bfe792c","rustfmt.toml":"de4e1daab481c1572805aed3e51e72c5dc1b3e5af757bc675e1717b251c6e922","src/capi.rs":"99f0d0742bf102451698c7e32db0fc4941b8ac10bec2fb309f41e7e5d99b05bd","src/consts.rs":"4c34980f94d1017e5e75e29b26750c1678e0609c9227296951ffbb9e180a5adf","src/freebsd/device.rs":"914ac446ff24cc3fc050732372e286e1fedf8341a8d4754e392bc9f38393b142","src/freebsd/mod.rs":"42dcb57fbeb00140003a8ad39acac9b547062b8f281a3fa5deb5f92a6169dde6","src/freebsd/monitor.rs":"3683370931b15f05403d240a788a87b1bea801284ee74b849e1f330a4a231dd0","src/freebsd/transaction.rs":"e3615cfdd7f23e9a80a53c32e0fa2a5ae290a432b009bed2b2e74e0df77f8266","src/freebsd/uhid.rs":"d19ade6e808e63981ba5f93d482d676ffa9dff29cb2b7011486591f69ddbbdcd","src/hidproto.rs":"9de8d86509d706e3a0ade2b5a57eec7730afd4073d9cdd99aa8ca1376be37f83","src/lib.rs":"4b43ad18b4eae9356ba6d7954542a38f3015ab8a72ab1fde28169aaf343721d8","src/linux/device.rs":"2271fbb8d176ec01f83a899c0c8194a954465fdd8670a9b136ab88baaba2ee48","src/linux/hidraw.rs":"0d5804d1cd99e7c30c8bde3089f8ed98d7d683d3cd487821e29b133b1ee90228","src/linux/hidwrapper.h":"72785db3a9b27ea72b6cf13a958fee032af54304522d002f56322473978a20f9","src/linux/hidwrapper.rs":"4be65676cf3220929700bf4906938dcbd1538ba53d40c60b08f9ba8890c910f6","src/linux/ioctl_aarch64le.rs":"f482a967c8006d0c34c03e9f2aeca4c4f426c5c27f7f930f3230129caf176060","src/linux/ioctl_armle.rs":"f482a967c8006d0c34c03e9f2aeca4c4f426c5c27f7f930f3230129caf176060","src/linux/ioctl_mips64le.rs":"fbda309934ad8bda689cd4fb5c0ca696fe26dedb493fe9d5a5322c3047d474fd","src/linux/ioctl_powerpc64be.rs":"fbda309934ad8bda689cd4fb5c0ca696fe26dedb493fe9d5a5322c3047d474fd","src/linux/ioctl_powerpc64le.rs":"0d50afd0bf094b5146d65d263544cba141ff248e487d90d6c03559e9b3c2fd55","src/linux/ioctl_powerpcbe.rs":"0d50afd0bf094b5146d65d263544cba141ff248e487d90d6c03559e9b3c2fd55","src/linux/ioctl_s390xbe.rs":"2d8b265cd39a9f46816f83d5a5df0701c13eb842bc609325bad42ce50add3bf0","src/linux/ioctl_x86.rs":"f482a967c8006d0c34c03e9f2aeca4c4f426c5c27f7f930f3230129caf176060","src/linux/ioctl_x86_64.rs":"f482a967c8006d0c34c03e9f2aeca4c4f426c5c27f7f930f3230129caf176060","src/linux/mod.rs":"446e435126d2a58f167f648dd95cba28e8ac9c17f1f799e1eaeab80ea800fc57","src/linux/monitor.rs":"57890c5f000829c5c0f44032fe5364126e60451605d517c79ba4d4fe4fd6c94b","src/linux/transaction.rs":"92b47d064c1fa5fe2674f65d06c519601480fc1c2b03667ade19a186a6ec9d13","src/macos/device.rs":"29863c88f851a957ec754f16aae6f789b300b00fcfe9a6c198a7cdcf1c9fcfe4","src/macos/iokit.rs":"a0fd818224718e96ad5d106dfc235f4bc9218a59f5114b9f9825abe3ee62bce7","src/macos/mod.rs":"333e561554fc901d4f6092f6e4c85823e2b0c4ff31c9188d0e6d542b71a0a07c","src/macos/monitor.rs":"d3a1dadfbfb5bfd665d75493d72bfbca3da9c43692262230f10d5feadb928e62","src/macos/transaction.rs":"cf2e67530401b0ef18e978557f470aa2661b3a5f4ef64cd3053d6e11f2f19b2b","src/manager.rs":"7428fc23038b004841936d8f27f8dc33234d5c06361efa75b73c7a5c035dae75","src/openbsd/device.rs":"b5de51a8b3ae0e542373a2064cff1ae6e1f91ac78e1406805d9ca8a05ce758c9","src/openbsd/mod.rs":"514274d414042ff84b3667a41a736e78581e22fda87ccc97c2bc05617e381a30","src/openbsd/monitor.rs":"953800ab8fd6adf5d70633059b20d2cf0f5a2701d92e58a06d1ec33208983bc4","src/openbsd/transaction.rs":"10be1ce983c72513fec57baaa6869ef02b9cdbd8ea66bb2dfe24d857faf054f5","src/statemachine.rs":"28477fba601f5086b85e911da1e4f04af3f0060329e6e0e1172b960f9c52fd41","src/stub/device.rs":"32e134fc8826667d16b02fe32831fc29f4d52d0a7a065d7d649c4a1c5faa0dcc","src/stub/mod.rs":"6a7fec504a52d403b0241b18cd8b95088a31807571f4c0a67e4055afc74f4453","src/stub/transaction.rs":"8655bc37b69c318ff0bc69a62fcb31820eb6ad7921a53e0cecffa15e80d97630","src/u2fhid-capi.h":"fc2575f720ab8f6bc0c523c57310f35c464576bd5150c3c2b1873d3abde5909b","src/u2fprotocol.rs":"77b6d5005d8b3d98cd96e480013c1e97155da5df3cf5e19819ee82ac8e3b6c7d","src/u2ftypes.rs":"cf972d805b15a95f4c18d556aa01660ce451f1d3bce1516b0ce73d17e73199aa","src/util.rs":"c517750c9bf00f44fb63cada8c40d0227a4d3765488499a1f4d3c0f01daa67a7","src/windows/device.rs":"86a6ecc239608977a963f375336780746e90e95c3eb9ff303347beb983c40ab6","src/windows/mod.rs":"218e7f2fe91ecb390c12bba5a5ffdad2c1f0b22861c937f4d386262e5b3dd617","src/windows/monitor.rs":"d8e8316e5bd9fc6ebed737bd8d6e0713c99287aca04f392f6319cdfd8576f754","src/windows/transaction.rs":"1b9a5af866048911ccaec8c94b698b28ae1b80e3d4842f9d6ed38462f459c796","src/windows/winapi.rs":"a4286fd5e8dcb178e37df512ba7752b2a3c38fe30e1176022767d2c05c242bf8"},"package":"ff593fb4dd388fe452c5e63d4d668699466bd46b571c4b852dfbca4bac8f0706"}
|
14
third_party/rust/authenticator/Cargo.lock
generated
vendored
14
third_party/rust/authenticator/Cargo.lock
generated
vendored
@ -28,13 +28,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "authenticator"
|
||||
version = "0.2.10"
|
||||
version = "0.2.12"
|
||||
dependencies = [
|
||||
"base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bindgen 0.51.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"boxfnonce 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"devd-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -167,16 +167,16 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.6.3"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.6.2"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@ -584,8 +584,8 @@ dependencies = [
|
||||
"checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4"
|
||||
"checksum clang-sys 0.28.1 (registry+https://github.com/rust-lang/crates.io-index)" = "81de550971c976f176130da4b2978d3b524eaa0fd9ac31f3ceb5ae1231fb4853"
|
||||
"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
|
||||
"checksum core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4e2640d6d0bf22e82bed1b73c6aef8d5dd31e5abe6666c57e6d45e2649f4f887"
|
||||
"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"
|
||||
"checksum core-foundation 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171"
|
||||
"checksum core-foundation-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac"
|
||||
"checksum devd-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0d009f166c0d9e9f9909dc751630b3a6411ab7f85a153d32d01deb364ffe52a7"
|
||||
"checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c"
|
||||
"checksum env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b61fa891024a945da30a9581546e8cfaf5602c7b3f4c137a2805cf388f92075a"
|
||||
|
4
third_party/rust/authenticator/Cargo.toml
vendored
4
third_party/rust/authenticator/Cargo.toml
vendored
@ -12,7 +12,7 @@
|
||||
|
||||
[package]
|
||||
name = "authenticator"
|
||||
version = "0.2.10"
|
||||
version = "0.2.12"
|
||||
authors = ["J.C. Jones <jc@mozilla.com>", "Tim Taubert <ttaubert@mozilla.com>", "Kyle Machulis <kyle@nonpolynomial.com>"]
|
||||
description = "Library for interacting with CTAP1/2 security keys for Web Authentication. Used by Firefox."
|
||||
license = "MPL-2.0"
|
||||
@ -53,7 +53,7 @@ version = "0.3"
|
||||
[target."cfg(target_os = \"linux\")".dependencies.libudev]
|
||||
version = "^0.2"
|
||||
[target."cfg(target_os = \"macos\")".dependencies.core-foundation]
|
||||
version = "0.6.2"
|
||||
version = "0.7"
|
||||
[target."cfg(target_os = \"windows\")".dependencies.winapi]
|
||||
version = "0.3"
|
||||
features = ["handleapi", "hidclass", "hidpi", "hidusage", "setupapi"]
|
||||
|
2
third_party/rust/authenticator/README.md
vendored
2
third_party/rust/authenticator/README.md
vendored
@ -24,7 +24,7 @@ RUST_LOG=debug cargo run --example main
|
||||
```
|
||||
|
||||
Proper usage should be to call into this library from something else - e.g., Firefox. There are
|
||||
some [C headers exposed for the purpose](authenticator/blob/master/src/u2fhid-capi.h).
|
||||
some [C headers exposed for the purpose](./src/u2fhid-capi.h).
|
||||
|
||||
## Tests
|
||||
|
||||
|
5
third_party/rust/authenticator/src/linux/ioctl_powerpc64be.rs
vendored
Normal file
5
third_party/rust/authenticator/src/linux/ioctl_powerpc64be.rs
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
/* automatically generated by rust-bindgen */
|
||||
|
||||
pub type __u32 = ::std::os::raw::c_uint;
|
||||
pub const _HIDIOCGRDESCSIZE: __u32 = 1074022401;
|
||||
pub const _HIDIOCGRDESC: __u32 = 1342457858;
|
3
third_party/rust/authenticator/src/linux/ioctl_powerpcbe.rs
vendored
Normal file
3
third_party/rust/authenticator/src/linux/ioctl_powerpcbe.rs
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/* automatically generated by rust-bindgen */
|
||||
|
||||
pub type __u32 = :: std :: os :: raw :: c_uint ; pub const _HIDIOCGRDESCSIZE : __u32 = 1074022401 ; pub const _HIDIOCGRDESC : __u32 = 1342457858 ;
|
@ -7,6 +7,7 @@ extern crate log;
|
||||
use consts::{CID_BROADCAST, HID_RPT_SIZE};
|
||||
use core_foundation::base::*;
|
||||
use platform::iokit::*;
|
||||
use std::convert::TryInto;
|
||||
use std::io;
|
||||
use std::io::{Read, Write};
|
||||
use std::sync::mpsc::{Receiver, RecvTimeoutError};
|
||||
@ -71,7 +72,7 @@ impl Write for Device {
|
||||
IOHIDDeviceSetReport(
|
||||
self.device_ref,
|
||||
kIOHIDReportTypeOutput,
|
||||
report_id,
|
||||
report_id.try_into().unwrap(),
|
||||
data.as_ptr(),
|
||||
data.len() as CFIndex,
|
||||
)
|
||||
|
2
third_party/rust/cocoa/.cargo-checksum.json
vendored
2
third_party/rust/cocoa/.cargo-checksum.json
vendored
@ -1 +1 @@
|
||||
{"files":{"COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.lock":"13b2e7b7a41925418cff959dc7bfc94e516797f4da57fd50fee058013af0175f","Cargo.toml":"28b9c7045e43195c6c91d6fb8923c3a74143fe4ecf3514ae5ebcf61d7c95299a","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"29542cb34adb016506822ef78bceacf1774dbe8c27818a4d47b7d7b71ed4e1ac","examples/color.rs":"5211a85ab9ec4cbb98f8f677de50bb2f1d300400f50226ebfd714d40b9d32485","examples/fullscreen.rs":"f5ad7a0f9c44944c5ee84413ab9a106abd4d4e53534867c602651db7be722165","examples/hello_world.rs":"7efe2a29de4d4dfc1d8821f469e13b1456f72de478bab55f813d08d4e5aafd5c","examples/tab_view.rs":"e6a3187eeac2f46210994293c2db7756757f4cad07e519902fa994c6d5c1a7d6","src/appkit.rs":"097a75a94a50de737d757bcd84fd0ce4283aab8f6f197dc9889dad2387c279c9","src/base.rs":"6c56d1758a9b0a7f8927771fe8b0bb43c6f19e4531bf9accecc786028eaad845","src/foundation.rs":"0b8809b5c2d11120ed4e90797961cb97c814ae62166d9d19182c04da7a04d9a6","src/lib.rs":"ed6164b3e0fe68579218185267d79229a2989c86efce690d7273f779c5239ec3","src/macros.rs":"0de0a8ea9a23f03cad94266a92051c3be8ff3f8f7d7d60f95dafe6c663204d48","src/quartzcore.rs":"a3aaf7461020a7b03dbdd55e3dcf6c6dbcf693343def7e121cc1d9257d4cc26f","tests/foundation.rs":"16e35ab33eefde5f7f2f52ee796e3b825427c2665ef9b146d40362f81fdd503a"},"package":"8cd20045e880893b4a8286d5639e9ade85fb1f6a14c291f882cf8cf2149d37d9"}
|
||||
{"files":{"COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.lock":"0effdfa775e787f93cfabf50aa7039d7a4999e0dd92d57d3d5745a5f5926a962","Cargo.toml":"280ff6f510cff8a892ddbba326304fd8b16ac2eb1ad111948405abe3a6a90d51","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"29542cb34adb016506822ef78bceacf1774dbe8c27818a4d47b7d7b71ed4e1ac","examples/color.rs":"5211a85ab9ec4cbb98f8f677de50bb2f1d300400f50226ebfd714d40b9d32485","examples/fullscreen.rs":"f8719268b6eb1d19078af347e02f9993c9d29633ef2d38dcc4fac26cbd731c2d","examples/hello_world.rs":"7efe2a29de4d4dfc1d8821f469e13b1456f72de478bab55f813d08d4e5aafd5c","examples/tab_view.rs":"e6a3187eeac2f46210994293c2db7756757f4cad07e519902fa994c6d5c1a7d6","src/appkit.rs":"a21c6d612d0ec45dbbb5df45fe96d84b76c5a9982d09bdf74714ce63723da558","src/base.rs":"6c56d1758a9b0a7f8927771fe8b0bb43c6f19e4531bf9accecc786028eaad845","src/foundation.rs":"f0a8c0d2e3aee6bde64f480085025dfa92f903a39d6c15251ba392523aa153a3","src/lib.rs":"ed6164b3e0fe68579218185267d79229a2989c86efce690d7273f779c5239ec3","src/macros.rs":"0de0a8ea9a23f03cad94266a92051c3be8ff3f8f7d7d60f95dafe6c663204d48","src/quartzcore.rs":"cb4f96b4b095e9d623346a42b1e119a5299bf2af73ed81256dd548c688d525e2","tests/foundation.rs":"728eb7dcc9edbfb43dcb6aa1ebcc391658a7d47846d94a71905bcedfce833260"},"package":"0a4736c86d51bd878b474400d9ec888156f4037015f5d09794fab9f26eab1ad4"}
|
48
third_party/rust/cocoa/Cargo.lock
generated
vendored
48
third_party/rust/cocoa/Cargo.lock
generated
vendored
@ -2,7 +2,7 @@
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.1.0"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@ -12,40 +12,40 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cocoa"
|
||||
version = "0.19.0"
|
||||
version = "0.20.0"
|
||||
dependencies = [
|
||||
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-graphics 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.6.4"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.6.2"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "core-graphics"
|
||||
version = "0.17.3"
|
||||
version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core-foundation 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -63,7 +63,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.60"
|
||||
version = "0.2.65"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@ -71,25 +71,25 @@ name = "malloc_buf"
|
||||
version = "0.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc"
|
||||
version = "0.2.6"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[metadata]
|
||||
"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd"
|
||||
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||
"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
|
||||
"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d"
|
||||
"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"
|
||||
"checksum core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)" = "56790968ab1c8a1202a102e6de05fc6e1ec87da99e4e93e9a7d13efbfc1e95a9"
|
||||
"checksum core-foundation 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171"
|
||||
"checksum core-foundation-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac"
|
||||
"checksum core-graphics 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "59e78b2e0aaf43f08e7ae0d6bc96895ef72ff0921c7d4ff4762201b2dba376dd"
|
||||
"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
|
||||
"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
|
||||
"checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb"
|
||||
"checksum libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8"
|
||||
"checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
|
||||
"checksum objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "31d20fd2b37e07cf5125be68357b588672e8cefe9a96f8c17a9d46053b3e590d"
|
||||
"checksum objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
|
||||
|
6
third_party/rust/cocoa/Cargo.toml
vendored
6
third_party/rust/cocoa/Cargo.toml
vendored
@ -12,7 +12,7 @@
|
||||
|
||||
[package]
|
||||
name = "cocoa"
|
||||
version = "0.19.0"
|
||||
version = "0.20.0"
|
||||
authors = ["The Servo Project Developers"]
|
||||
description = "Bindings to Cocoa for macOS"
|
||||
homepage = "https://github.com/servo/core-foundation-rs"
|
||||
@ -29,10 +29,10 @@ version = "1.0"
|
||||
version = "0.1"
|
||||
|
||||
[dependencies.core-foundation]
|
||||
version = "0.6"
|
||||
version = "0.7"
|
||||
|
||||
[dependencies.core-graphics]
|
||||
version = "0.17"
|
||||
version = "0.19"
|
||||
|
||||
[dependencies.foreign-types]
|
||||
version = "0.3"
|
||||
|
@ -76,7 +76,7 @@ fn main() {
|
||||
|
||||
// create Window
|
||||
let display = CGDisplay::main();
|
||||
let size = NSSize::new(display.pixels_wide() as f64, display.pixels_high() as f64);
|
||||
let size = NSSize::new(display.pixels_wide() as _, display.pixels_high() as _);
|
||||
let window = NSWindow::alloc(nil)
|
||||
.initWithContentRect_styleMask_backing_defer_(NSRect::new(NSPoint::new(0., 0.), size),
|
||||
NSWindowStyleMask::NSTitledWindowMask,
|
||||
|
43
third_party/rust/cocoa/src/appkit.rs
vendored
43
third_party/rust/cocoa/src/appkit.rs
vendored
@ -549,7 +549,7 @@ pub trait NSPasteboard: Sized {
|
||||
|
||||
impl NSPasteboard for id {
|
||||
unsafe fn releaseGlobally(self) {
|
||||
msg_send![self, releaseGlobally];
|
||||
msg_send![self, releaseGlobally]
|
||||
}
|
||||
|
||||
unsafe fn clearContents(self) -> NSInteger {
|
||||
@ -821,6 +821,7 @@ pub trait NSMenuItem: Sized {
|
||||
unsafe fn initWithTitle_action_keyEquivalent_(self, title: id, action: SEL, key: id) -> id;
|
||||
unsafe fn setKeyEquivalentModifierMask_(self, mask: NSEventModifierFlags);
|
||||
unsafe fn setSubmenu_(self, submenu: id);
|
||||
unsafe fn setTarget_(self, target: id);
|
||||
}
|
||||
|
||||
impl NSMenuItem for id {
|
||||
@ -835,6 +836,10 @@ impl NSMenuItem for id {
|
||||
unsafe fn setSubmenu_(self, submenu: id) {
|
||||
msg_send![self, setSubmenu:submenu]
|
||||
}
|
||||
|
||||
unsafe fn setTarget_(self, target: id) {
|
||||
msg_send![self, setTarget:target]
|
||||
}
|
||||
}
|
||||
|
||||
pub type NSWindowDepth = libc::c_int;
|
||||
@ -1542,11 +1547,11 @@ impl NSWindow for id {
|
||||
}
|
||||
|
||||
unsafe fn setTabbingMode_(self, tabbingMode: NSWindowTabbingMode) {
|
||||
msg_send![self, setTabbingMode: tabbingMode];
|
||||
msg_send![self, setTabbingMode: tabbingMode]
|
||||
}
|
||||
|
||||
unsafe fn addTabbedWindow_ordered_(self, window: id, ordering_mode: NSWindowOrderingMode) {
|
||||
msg_send![self, addTabbedWindow:window ordered: ordering_mode];
|
||||
msg_send![self, addTabbedWindow:window ordered: ordering_mode]
|
||||
}
|
||||
|
||||
unsafe fn toggleTabBar_(self, sender: id) {
|
||||
@ -2938,6 +2943,23 @@ impl NSControl for id {
|
||||
}
|
||||
}
|
||||
|
||||
pub trait NSImageView: Sized {
|
||||
unsafe fn alloc(_: Self) -> id {
|
||||
msg_send![class!(NSImageView), alloc]
|
||||
}
|
||||
unsafe fn initWithFrame_(self, frameRect: NSRect) -> id;
|
||||
unsafe fn setImage_(self, img: id /* (NSImage *) */);
|
||||
}
|
||||
|
||||
impl NSImageView for id {
|
||||
unsafe fn initWithFrame_(self, frameRect: NSRect) -> id {
|
||||
msg_send![self, initWithFrame:frameRect]
|
||||
}
|
||||
unsafe fn setImage_(self, img: id /* (NSImage *) */) {
|
||||
msg_send![self, setImage:img]
|
||||
}
|
||||
}
|
||||
|
||||
pub trait NSButton: Sized {
|
||||
unsafe fn setImage_(self, img: id /* (NSImage *) */);
|
||||
unsafe fn setBezelStyle_(self, style: NSBezelStyle);
|
||||
@ -2946,6 +2968,8 @@ pub trait NSButton: Sized {
|
||||
msg_send![class!(NSButton), alloc]
|
||||
}
|
||||
unsafe fn initWithFrame_(self, frameRect: NSRect) -> id;
|
||||
unsafe fn setTarget_(self, target: id /* Instance */);
|
||||
unsafe fn setAction_(self, selector: objc::runtime::Sel /* (Instance *) */);
|
||||
}
|
||||
|
||||
impl NSButton for id {
|
||||
@ -2953,7 +2977,7 @@ impl NSButton for id {
|
||||
msg_send![self, initWithFrame:frameRect]
|
||||
}
|
||||
unsafe fn setBezelStyle_(self, style: NSBezelStyle) {
|
||||
msg_send![self, setBezelStyle:style];
|
||||
msg_send![self, setBezelStyle:style]
|
||||
}
|
||||
unsafe fn setTitle_(self, title: id /* (NSString*) */) {
|
||||
msg_send![self, setTitle:title]
|
||||
@ -2961,6 +2985,13 @@ impl NSButton for id {
|
||||
unsafe fn setImage_(self, img: id /* (NSImage *) */) {
|
||||
msg_send![self, setImage:img]
|
||||
}
|
||||
unsafe fn setTarget_(self, target: id /* (Instance *) */) {
|
||||
msg_send![self, setTarget:target]
|
||||
}
|
||||
|
||||
unsafe fn setAction_(self, selector: objc::runtime::Sel /* (Instance method *) */) {
|
||||
msg_send![self, setAction:selector]
|
||||
}
|
||||
}
|
||||
|
||||
pub trait NSImage: Sized {
|
||||
@ -3558,10 +3589,10 @@ impl NSTextField for id {
|
||||
msg_send![self, initWithFrame:frameRect]
|
||||
}
|
||||
unsafe fn setEditable_(self, editable: BOOL) {
|
||||
msg_send![self, setEditable:editable];
|
||||
msg_send![self, setEditable:editable]
|
||||
}
|
||||
unsafe fn setStringValue_(self, label: id) {
|
||||
msg_send![self, setStringValue:label];
|
||||
msg_send![self, setStringValue:label]
|
||||
}
|
||||
}
|
||||
|
||||
|
20
third_party/rust/cocoa/src/foundation.rs
vendored
20
third_party/rust/cocoa/src/foundation.rs
vendored
@ -42,13 +42,13 @@ mod macos {
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct NSPoint {
|
||||
pub x: f64,
|
||||
pub y: f64,
|
||||
pub x: CGFloat,
|
||||
pub y: CGFloat,
|
||||
}
|
||||
|
||||
impl NSPoint {
|
||||
#[inline]
|
||||
pub fn new(x: f64, y: f64) -> NSPoint {
|
||||
pub fn new(x: CGFloat, y: CGFloat) -> NSPoint {
|
||||
NSPoint {
|
||||
x: x,
|
||||
y: y,
|
||||
@ -59,8 +59,8 @@ mod macos {
|
||||
unsafe impl objc::Encode for NSPoint {
|
||||
fn encode() -> objc::Encoding {
|
||||
let encoding = format!("{{CGPoint={}{}}}",
|
||||
f64::encode().as_str(),
|
||||
f64::encode().as_str());
|
||||
CGFloat::encode().as_str(),
|
||||
CGFloat::encode().as_str());
|
||||
unsafe { objc::Encoding::from_str(&encoding) }
|
||||
}
|
||||
}
|
||||
@ -68,13 +68,13 @@ mod macos {
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct NSSize {
|
||||
pub width: f64,
|
||||
pub height: f64,
|
||||
pub width: CGFloat,
|
||||
pub height: CGFloat,
|
||||
}
|
||||
|
||||
impl NSSize {
|
||||
#[inline]
|
||||
pub fn new(width: f64, height: f64) -> NSSize {
|
||||
pub fn new(width: CGFloat, height: CGFloat) -> NSSize {
|
||||
NSSize {
|
||||
width: width,
|
||||
height: height,
|
||||
@ -85,8 +85,8 @@ mod macos {
|
||||
unsafe impl objc::Encode for NSSize {
|
||||
fn encode() -> objc::Encoding {
|
||||
let encoding = format!("{{CGSize={}{}}}",
|
||||
f64::encode().as_str(),
|
||||
f64::encode().as_str());
|
||||
CGFloat::encode().as_str(),
|
||||
CGFloat::encode().as_str());
|
||||
unsafe { objc::Encoding::from_str(&encoding) }
|
||||
}
|
||||
}
|
||||
|
4
third_party/rust/cocoa/src/quartzcore.rs
vendored
4
third_party/rust/cocoa/src/quartzcore.rs
vendored
@ -889,7 +889,7 @@ impl CALayer {
|
||||
#[inline]
|
||||
pub fn set_should_rasterize(&self, flag: bool) {
|
||||
unsafe {
|
||||
msg_send![self.id(), setShouldRasterize:(flag as BOOL)];
|
||||
msg_send![self.id(), setShouldRasterize:(flag as BOOL)]
|
||||
}
|
||||
}
|
||||
|
||||
@ -1459,7 +1459,7 @@ impl CARenderer {
|
||||
Some(ref layer) => layer.id(),
|
||||
None => nil,
|
||||
};
|
||||
msg_send![self.id(), setLayer:layer];
|
||||
msg_send![self.id(), setLayer:layer]
|
||||
}
|
||||
}
|
||||
|
||||
|
24
third_party/rust/cocoa/tests/foundation.rs
vendored
24
third_party/rust/cocoa/tests/foundation.rs
vendored
@ -100,7 +100,7 @@ mod foundation {
|
||||
let mut_components: id = msg_send![components, mutableCopy];
|
||||
let mut iter = mut_components.iter();
|
||||
iter.next();
|
||||
msg_send![mut_components, removeObjectAtIndex:1];
|
||||
let () = msg_send![mut_components, removeObjectAtIndex:1];
|
||||
iter.next();
|
||||
}
|
||||
}
|
||||
@ -148,14 +148,20 @@ mod foundation {
|
||||
// sorted iterators to ensure that each item is the same as its counterpart in
|
||||
// the vector.
|
||||
|
||||
fn compare_function(s0: &id, s1: &id) -> Ordering {
|
||||
unsafe {
|
||||
let (bytes0, len0) = (s0.UTF8String() as *const u8, s0.len());
|
||||
let (bytes1, len1) = (s1.UTF8String() as *const u8, s1.len());
|
||||
let (s0, s1) = (str::from_utf8(slice::from_raw_parts(bytes0, len0)).unwrap(),
|
||||
str::from_utf8(slice::from_raw_parts(bytes1, len1)).unwrap());
|
||||
let (c0, c1) = (s0.chars().next().unwrap(), s1.chars().next().unwrap());
|
||||
c0.cmp(&c1)
|
||||
}
|
||||
}
|
||||
|
||||
// First test cocoa sorting...
|
||||
let mut comparator = ConcreteBlock::new(|s0: id, s1: id| {
|
||||
let (bytes0, len0) = (s0.UTF8String() as *const u8, s0.len());
|
||||
let (bytes1, len1) = (s1.UTF8String() as *const u8, s1.len());
|
||||
let (s0, s1) = (str::from_utf8(slice::from_raw_parts(bytes0, len0)).unwrap(),
|
||||
str::from_utf8(slice::from_raw_parts(bytes1, len1)).unwrap());
|
||||
let (c0, c1) = (s0.chars().next().unwrap(), s1.chars().next().unwrap());
|
||||
match c0.cmp(&c1) {
|
||||
match compare_function(&s0, &s1) {
|
||||
Ordering::Less => NSComparisonResult::NSOrderedAscending,
|
||||
Ordering::Equal => NSComparisonResult::NSOrderedSame,
|
||||
Ordering::Greater => NSComparisonResult::NSOrderedDescending,
|
||||
@ -173,13 +179,13 @@ mod foundation {
|
||||
|
||||
// Then use rust sorting
|
||||
let mut keys_arr = dict.allKeys().iter().collect::<Vec<_>>();
|
||||
keys_arr.sort();
|
||||
keys_arr.sort_by(compare_function);
|
||||
for (k0, k1) in keys_arr.into_iter().zip(keys.iter()) {
|
||||
assert!(k0.isEqualToString(k1));
|
||||
}
|
||||
|
||||
let mut objects_arr = dict.allValues().iter().collect::<Vec<_>>();
|
||||
objects_arr.sort();
|
||||
objects_arr.sort_by(compare_function);
|
||||
for (v0, v1) in objects_arr.into_iter().zip(objects.iter()) {
|
||||
assert!(v0.isEqualToString(v1));
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"dc9a55f461f23bf82bb9b3ee7d9b74807b7a905e31f05074bb05b5e3cb1ab267","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","build.rs":"9433ed3b20cc99e716dda4c6d8507c29bc04882544cbbea8d4e48ba80fd0fa12","src/array.rs":"40c305658e16b07d86353a5ad34e7b5fb98720f19cc2b5173360d6a61ce2642f","src/attributed_string.rs":"693b6c745c5aef1929595c94363d500b4b25ebcfed0b4b8dee0103b8fc0537f8","src/base.rs":"f0f8424099a4269e2359b063c3f055e115aec6df0f6aa71695ca91257dfd64e2","src/bundle.rs":"e8ad47f9f0280e1eef7e9aea2eb88020443953ac2cda234396321450ffc3d48a","src/data.rs":"4547e98f4e25a99606d8f33e82f8de3d9889612485d445d4467138b8ad29b7e9","src/date.rs":"c064ee4c3ebd1927532c34871e2e41179d6e3c3e400f6b409a18ad9e2337477f","src/dictionary.rs":"3327a6f90f1e0db5e3fde1973e2df4143ca896716a816d03f2b17c8e988c5159","src/error.rs":"6205ebeb7631daa8bcd560862b6daa10f640c8c117ce5f6f7184f268dcbcb42a","src/filedescriptor.rs":"49580654b657811fade7adaa256f5f895cb011c9baa4731e2f44a6ec7fdba235","src/lib.rs":"af7183760214be155e2cf562bf4265bd2d73da079e35d05e29ea0146e3c87654","src/messageport.rs":"e9227d5907cba8e29cdeea41bcb3ae5c7840220442953ab19aace31a84542f47","src/number.rs":"b1154203e74cb2258ba5520e20bcd4d524f1a957e09a19dd026b18d23baa3868","src/propertylist.rs":"7ec928438826c4ce40befedf3de0a37c8ecbc0fc17896dfa629d5864000b2cfe","src/runloop.rs":"67a6c2e4773f13de9452c9f8e4791b9889e03e56c07a7bdf64dbba99e9821f45","src/set.rs":"8aef5f4ba75a067e271ad6cb960569f1d22a0acee0eb6c79e31bb8b636619d9d","src/string.rs":"3ebfa11bba928d0ab1b07ecc0bd0f11367642eb818c8e21f08c16a4be8f9494f","src/timezone.rs":"42741f556af081be32987d2705488959c60aeb794e7c737b092f0dce5851ca89","src/url.rs":"4cd2950660ad234f7f833b3f5c092f7322465085452cca8ced623564400cdef9","src/uuid.rs":"82f75efa73d0842dff2e13d299c166c6593a77fcb69c4b7629a2df1c17ae507d"},"package":"e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"}
|
||||
{"files":{"Cargo.toml":"2f56db7bbb02e7e0e2329179c2bb533fbe36a6196b7f0a539b710291cced25ae","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","build.rs":"9433ed3b20cc99e716dda4c6d8507c29bc04882544cbbea8d4e48ba80fd0fa12","src/array.rs":"40c305658e16b07d86353a5ad34e7b5fb98720f19cc2b5173360d6a61ce2642f","src/attributed_string.rs":"693b6c745c5aef1929595c94363d500b4b25ebcfed0b4b8dee0103b8fc0537f8","src/base.rs":"369fb6710bb342f488c1207db2339f16d51bea7b7cb437c88dfb9b3ecb55f788","src/bundle.rs":"701b99db500b1260b3327182e965483d7cc1b220e0c2b3b7b97a3bf1a17b9dcb","src/characterset.rs":"a10bbb42ddc74b3dc50b43ae6a50cc9d9a1cd08b975a1ce1b092be4bf64448a6","src/data.rs":"7cf4ddbc62635434fd3552739ffae9dde5f5d34f0ad0bb818068d3ac26403784","src/date.rs":"c064ee4c3ebd1927532c34871e2e41179d6e3c3e400f6b409a18ad9e2337477f","src/dictionary.rs":"3327a6f90f1e0db5e3fde1973e2df4143ca896716a816d03f2b17c8e988c5159","src/error.rs":"6205ebeb7631daa8bcd560862b6daa10f640c8c117ce5f6f7184f268dcbcb42a","src/filedescriptor.rs":"49580654b657811fade7adaa256f5f895cb011c9baa4731e2f44a6ec7fdba235","src/lib.rs":"f815234d32327532da600f47e9a006550d8993dcd695b803d0660316899f9319","src/messageport.rs":"e9227d5907cba8e29cdeea41bcb3ae5c7840220442953ab19aace31a84542f47","src/number.rs":"b1154203e74cb2258ba5520e20bcd4d524f1a957e09a19dd026b18d23baa3868","src/propertylist.rs":"7ec928438826c4ce40befedf3de0a37c8ecbc0fc17896dfa629d5864000b2cfe","src/runloop.rs":"26ca33e2472d191f583e01c24e8cd262f54de8b542fbe7278f33ab08b2925794","src/set.rs":"8aef5f4ba75a067e271ad6cb960569f1d22a0acee0eb6c79e31bb8b636619d9d","src/string.rs":"ef2c408bf1fcea5d9106329fc48d659aabbdbca05eb121dfa27a221829bc4b89","src/timezone.rs":"42741f556af081be32987d2705488959c60aeb794e7c737b092f0dce5851ca89","src/url.rs":"4358f756ed3d5e9afd5a7f3e2e9115adc6133b47dc7ce59d6ebb32c6610b0e8f","src/uuid.rs":"82f75efa73d0842dff2e13d299c166c6593a77fcb69c4b7629a2df1c17ae507d"},"package":"b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac"}
|
@ -3,7 +3,7 @@
|
||||
# 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
|
||||
# to registry (e.g., crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
@ -12,10 +12,10 @@
|
||||
|
||||
[package]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.6.2"
|
||||
version = "0.7.0"
|
||||
authors = ["The Servo Project Developers"]
|
||||
build = "build.rs"
|
||||
description = "Bindings to Core Foundation for OS X"
|
||||
description = "Bindings to Core Foundation for macOS"
|
||||
homepage = "https://github.com/servo/core-foundation-rs"
|
||||
license = "MIT / Apache-2.0"
|
||||
repository = "https://github.com/servo/core-foundation-rs"
|
||||
|
14
third_party/rust/core-foundation-sys/src/base.rs
vendored
14
third_party/rust/core-foundation-sys/src/base.rs
vendored
@ -8,23 +8,23 @@
|
||||
// except according to those terms.
|
||||
|
||||
use std::cmp::Ordering;
|
||||
use std::os::raw::{c_uint, c_long, c_ulong, c_void, c_int};
|
||||
use std::os::raw::{c_uint, c_void, c_int};
|
||||
use string::CFStringRef;
|
||||
|
||||
pub type Boolean = u8;
|
||||
pub type CFIndex = c_long;
|
||||
pub type mach_port_t = c_uint;
|
||||
pub type CFAllocatorRef = *const c_void;
|
||||
pub type CFNullRef = *const c_void;
|
||||
pub type CFHashCode = c_ulong;
|
||||
pub type CFTypeID = c_ulong;
|
||||
pub type CFTypeRef = *const c_void;
|
||||
pub type CFOptionFlags = u32;
|
||||
pub type OSStatus = i32;
|
||||
pub type SInt32 = c_int;
|
||||
pub type CFTypeID = usize;
|
||||
pub type CFOptionFlags = usize;
|
||||
pub type CFHashCode = usize;
|
||||
pub type CFIndex = isize;
|
||||
|
||||
#[repr(i64)]
|
||||
#[derive(Clone, Copy)]
|
||||
#[repr(isize)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum CFComparisonResult {
|
||||
LessThan = -1,
|
||||
EqualTo = 0,
|
||||
|
@ -33,4 +33,5 @@ extern {
|
||||
pub fn CFBundleGetTypeID() -> CFTypeID;
|
||||
pub fn CFBundleCopyExecutableURL(bundle: CFBundleRef) -> CFURLRef;
|
||||
pub fn CFBundleCopyPrivateFrameworksURL(bundle: CFBundleRef) -> CFURLRef;
|
||||
pub fn CFBundleCopySharedSupportURL(bundle: CFBundleRef) -> CFURLRef;
|
||||
}
|
||||
|
58
third_party/rust/core-foundation-sys/src/characterset.rs
vendored
Normal file
58
third_party/rust/core-foundation-sys/src/characterset.rs
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
// Copyright 2019 The Servo Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use base::{Boolean, CFAllocatorRef, CFIndex, CFRange, CFTypeID};
|
||||
use data::CFDataRef;
|
||||
use string::{CFStringRef, UniChar};
|
||||
|
||||
pub type CFCharacterSetPredefinedSet = CFIndex;
|
||||
|
||||
// Members of CFCharacterSetPredefinedSet enum
|
||||
pub static kCFCharacterSetControl: CFCharacterSetPredefinedSet = 1;
|
||||
pub static kCFCharacterSetWhitespace: CFCharacterSetPredefinedSet = 2;
|
||||
pub static kCFCharacterSetWhitespaceAndNewline: CFCharacterSetPredefinedSet = 3;
|
||||
pub static kCFCharacterSetDecimalDigit: CFCharacterSetPredefinedSet = 4;
|
||||
pub static kCFCharacterSetLetter: CFCharacterSetPredefinedSet = 5;
|
||||
pub static kCFCharacterSetLowercaseLetter: CFCharacterSetPredefinedSet = 6;
|
||||
pub static kCFCharacterSetUppercaseLetter: CFCharacterSetPredefinedSet = 7;
|
||||
pub static kCFCharacterSetNonBase: CFCharacterSetPredefinedSet = 8;
|
||||
pub static kCFCharacterSetDecomposable: CFCharacterSetPredefinedSet = 9;
|
||||
pub static kCFCharacterSetAlphaNumeric: CFCharacterSetPredefinedSet = 10;
|
||||
pub static kCFCharacterSetPunctuation: CFCharacterSetPredefinedSet = 11;
|
||||
pub static kCFCharacterSetIllegal: CFCharacterSetPredefinedSet = 12;
|
||||
pub static kCFCharacterSetCapitalizedLetter: CFCharacterSetPredefinedSet = 13;
|
||||
pub static kCFCharacterSetSymbol: CFCharacterSetPredefinedSet = 14;
|
||||
pub static kCFCharacterSetNewline: CFCharacterSetPredefinedSet = 15;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct __CFCharacterSet(c_void);
|
||||
|
||||
pub type CFCharacterSetRef = *const __CFCharacterSet;
|
||||
pub type CFMutableCharacterSetRef = *const __CFCharacterSet;
|
||||
|
||||
extern {
|
||||
pub fn CFCharacterSetGetTypeID() -> CFTypeID;
|
||||
pub fn CFCharacterSetGetPredefined(theSetIdentifier: CFCharacterSetPredefinedSet) -> CFCharacterSetRef;
|
||||
pub fn CFCharacterSetCreateWithCharactersInRange(alloc: CFAllocatorRef, theRange: CFRange) -> CFCharacterSetRef;
|
||||
pub fn CFCharacterSetCreateWithCharactersInString(alloc: CFAllocatorRef, theString: CFStringRef) -> CFCharacterSetRef;
|
||||
pub fn CFCharacterSetCreateWithBitmapRepresentation(alloc: CFAllocatorRef, theData: CFDataRef) -> CFCharacterSetRef;
|
||||
pub fn CFCharacterSetCreateMutable(alloc: CFAllocatorRef) -> CFMutableCharacterSetRef;
|
||||
pub fn CFCharacterSetCreateCopy(alloc: CFAllocatorRef, theSet: CFCharacterSetRef) -> CFCharacterSetRef;
|
||||
pub fn CFCharacterSetCreateMutableCopy(alloc: CFAllocatorRef, theSet: CFCharacterSetRef) -> CFMutableCharacterSetRef;
|
||||
pub fn CFCharacterSetIsCharacterMember(theSet: CFCharacterSetRef, theChar: UniChar) -> Boolean;
|
||||
pub fn CFCharacterSetCreateBitmapRepresentation(alloc: CFAllocatorRef, theSet: CFCharacterSetRef) -> CFDataRef;
|
||||
pub fn CFCharacterSetAddCharactersInRange(theSet: CFMutableCharacterSetRef, theRange: CFRange);
|
||||
pub fn CFCharacterSetRemoveCharactersInRange(theSet: CFMutableCharacterSetRef, theRange: CFRange);
|
||||
pub fn CFCharacterSetAddCharactersInString(theSet: CFMutableCharacterSetRef, theString: CFStringRef);
|
||||
pub fn CFCharacterSetRemoveCharactersInString(theSet: CFMutableCharacterSetRef, theString: CFStringRef);
|
||||
pub fn CFCharacterSetUnion(theSet: CFMutableCharacterSetRef, theOtherSet: CFCharacterSetRef);
|
||||
pub fn CFCharacterSetIntersect(theSet: CFMutableCharacterSetRef, theOtherSet: CFCharacterSetRef);
|
||||
pub fn CFCharacterSetInvert(theSet: CFMutableCharacterSetRef);
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
|
||||
use std::os::raw::c_void;
|
||||
|
||||
use base::{CFAllocatorRef, CFTypeID, CFIndex};
|
||||
use base::{CFAllocatorRef, CFTypeID, CFIndex, CFRange};
|
||||
|
||||
#[repr(C)]
|
||||
pub struct __CFData(c_void);
|
||||
@ -25,6 +25,7 @@ extern {
|
||||
bytes: *const u8, length: CFIndex) -> CFDataRef;
|
||||
//fn CFDataFind
|
||||
pub fn CFDataGetBytePtr(theData: CFDataRef) -> *const u8;
|
||||
pub fn CFDataGetBytes(theData: CFDataRef, range: CFRange, buffer: *mut u8);
|
||||
pub fn CFDataGetLength(theData: CFDataRef) -> CFIndex;
|
||||
|
||||
pub fn CFDataGetTypeID() -> CFTypeID;
|
||||
|
@ -14,6 +14,7 @@ pub mod array;
|
||||
pub mod attributed_string;
|
||||
pub mod base;
|
||||
pub mod bundle;
|
||||
pub mod characterset;
|
||||
pub mod data;
|
||||
pub mod date;
|
||||
pub mod dictionary;
|
||||
|
@ -50,13 +50,13 @@ pub const kCFRunLoopAllActivities: CFOptionFlags = 0x0FFFFFFF;
|
||||
pub struct CFRunLoopSourceContext {
|
||||
pub version: CFIndex,
|
||||
pub info: *mut c_void,
|
||||
pub retain: extern "C" fn (info: *const c_void) -> *const c_void,
|
||||
pub release: extern "C" fn (info: *const c_void),
|
||||
pub copyDescription: extern "C" fn (info: *const c_void) -> CFStringRef,
|
||||
pub equal: extern "C" fn (info1: *const c_void, info2: *const c_void) -> Boolean,
|
||||
pub hash: extern "C" fn (info: *const c_void) -> CFHashCode,
|
||||
pub schedule: extern "C" fn (info: *const c_void, rl: CFRunLoopRef, mode: CFStringRef),
|
||||
pub cancel: extern "C" fn (info: *const c_void, rl: CFRunLoopRef, mode: CFStringRef),
|
||||
pub retain: Option<extern "C" fn (info: *const c_void) -> *const c_void>,
|
||||
pub release: Option<extern "C" fn (info: *const c_void)>,
|
||||
pub copyDescription: Option<extern "C" fn (info: *const c_void) -> CFStringRef>,
|
||||
pub equal: Option<extern "C" fn (info1: *const c_void, info2: *const c_void) -> Boolean>,
|
||||
pub hash: Option<extern "C" fn (info: *const c_void) -> CFHashCode>,
|
||||
pub schedule: Option<extern "C" fn (info: *const c_void, rl: CFRunLoopRef, mode: CFStringRef)>,
|
||||
pub cancel: Option<extern "C" fn (info: *const c_void, rl: CFRunLoopRef, mode: CFStringRef)>,
|
||||
pub perform: extern "C" fn (info: *const c_void),
|
||||
}
|
||||
|
||||
@ -64,12 +64,12 @@ pub struct CFRunLoopSourceContext {
|
||||
pub struct CFRunLoopSourceContext1 {
|
||||
pub version: CFIndex,
|
||||
pub info: *mut c_void,
|
||||
pub retain: extern "C" fn (info: *const c_void) -> *const c_void,
|
||||
pub release: extern "C" fn (info: *const c_void),
|
||||
pub copyDescription: extern "C" fn (info: *const c_void) -> CFStringRef,
|
||||
pub equal: extern "C" fn (info1: *const c_void, info2: *const c_void) -> Boolean,
|
||||
pub hash: extern "C" fn (info: *const c_void) -> CFHashCode,
|
||||
// note that the following two fields are platform dependent in the C header, the ones here are for OS X
|
||||
pub retain: Option<extern "C" fn (info: *const c_void) -> *const c_void>,
|
||||
pub release: Option<extern "C" fn (info: *const c_void)>,
|
||||
pub copyDescription: Option<extern "C" fn (info: *const c_void) -> CFStringRef>,
|
||||
pub equal: Option<extern "C" fn (info1: *const c_void, info2: *const c_void) -> Boolean>,
|
||||
pub hash: Option<extern "C" fn (info: *const c_void) -> CFHashCode>,
|
||||
// note that the following two fields are platform dependent in the C header, the ones here are for macOS
|
||||
pub getPort: extern "C" fn (info: *mut c_void) -> mach_port_t,
|
||||
pub perform: extern "C" fn (msg: *mut c_void, size: CFIndex, allocator: CFAllocatorRef, info: *mut c_void) -> *mut c_void,
|
||||
}
|
||||
@ -78,9 +78,9 @@ pub struct CFRunLoopSourceContext1 {
|
||||
pub struct CFRunLoopObserverContext {
|
||||
pub version: CFIndex,
|
||||
pub info: *mut c_void,
|
||||
pub retain: extern "C" fn (info: *const c_void) -> *const c_void,
|
||||
pub release: extern "C" fn (info: *const c_void),
|
||||
pub copyDescription: extern "C" fn (info: *const c_void) -> CFStringRef,
|
||||
pub retain: Option<extern "C" fn (info: *const c_void) -> *const c_void>,
|
||||
pub release: Option<extern "C" fn (info: *const c_void)>,
|
||||
pub copyDescription: Option<extern "C" fn (info: *const c_void) -> CFStringRef>,
|
||||
}
|
||||
|
||||
pub type CFRunLoopObserverCallBack = extern "C" fn (observer: CFRunLoopObserverRef, activity: CFRunLoopActivity, info: *mut c_void);
|
||||
@ -89,15 +89,15 @@ pub type CFRunLoopObserverCallBack = extern "C" fn (observer: CFRunLoopObserverR
|
||||
pub struct CFRunLoopTimerContext {
|
||||
pub version: CFIndex,
|
||||
pub info: *mut c_void,
|
||||
pub retain: extern "C" fn (info: *const c_void) -> *const c_void,
|
||||
pub release: extern "C" fn (info: *const c_void),
|
||||
pub copyDescription: extern "C" fn (info: *const c_void) -> CFStringRef,
|
||||
pub retain: Option<extern "C" fn (info: *const c_void) -> *const c_void>,
|
||||
pub release: Option<extern "C" fn (info: *const c_void)>,
|
||||
pub copyDescription: Option<extern "C" fn (info: *const c_void) -> CFStringRef>,
|
||||
}
|
||||
|
||||
pub type CFRunLoopTimerCallBack = extern "C" fn (timer: CFRunLoopTimerRef, info: *mut c_void);
|
||||
|
||||
#[repr(C)]
|
||||
pub struct __CFRunLoopTimer;
|
||||
pub struct __CFRunLoopTimer(c_void);
|
||||
|
||||
pub type CFRunLoopTimerRef = *mut __CFRunLoopTimer;
|
||||
|
||||
|
@ -28,7 +28,7 @@ pub type CFStringCompareFlags = CFOptionFlags;
|
||||
|
||||
pub type CFStringEncoding = u32;
|
||||
|
||||
// OS X built-in encodings.
|
||||
// macOS built-in encodings.
|
||||
|
||||
//static kCFStringEncodingMacRoman: CFStringEncoding = 0;
|
||||
//static kCFStringEncodingWindowsLatin1: CFStringEncoding = 0x0500;
|
||||
|
45
third_party/rust/core-foundation-sys/src/url.rs
vendored
45
third_party/rust/core-foundation-sys/src/url.rs
vendored
@ -10,6 +10,9 @@
|
||||
use std::os::raw::c_void;
|
||||
|
||||
use base::{CFOptionFlags, CFIndex, CFAllocatorRef, Boolean, CFTypeID, CFTypeRef, SInt32};
|
||||
use data::CFDataRef;
|
||||
use array::CFArrayRef;
|
||||
use dictionary::CFDictionaryRef;
|
||||
use string::{CFStringRef, CFStringEncoding};
|
||||
use error::CFErrorRef;
|
||||
|
||||
@ -19,6 +22,8 @@ pub struct __CFURL(c_void);
|
||||
pub type CFURLRef = *const __CFURL;
|
||||
|
||||
pub type CFURLBookmarkCreationOptions = CFOptionFlags;
|
||||
pub type CFURLBookmarkResolutionOptions = CFOptionFlags;
|
||||
pub type CFURLBookmarkFileCreationOptions = CFOptionFlags;
|
||||
|
||||
pub type CFURLPathStyle = CFIndex;
|
||||
|
||||
@ -27,16 +32,16 @@ pub const kCFURLPOSIXPathStyle: CFURLPathStyle = 0;
|
||||
pub const kCFURLHFSPathStyle: CFURLPathStyle = 1;
|
||||
pub const kCFURLWindowsPathStyle: CFURLPathStyle = 2;
|
||||
|
||||
// static kCFURLBookmarkCreationPreferFileIDResolutionMask: CFURLBookmarkCreationOptions =
|
||||
// (1 << 8) as u32;
|
||||
// static kCFURLBookmarkCreationMinimalBookmarkMask: CFURLBookmarkCreationOptions =
|
||||
// (1 << 9) as u32;
|
||||
// static kCFURLBookmarkCreationSuitableForBookmarkFile: CFURLBookmarkCreationOptions =
|
||||
// (1 << 10) as u32;
|
||||
// static kCFURLBookmarkCreationWithSecurityScope: CFURLBookmarkCreationOptions =
|
||||
// (1 << 11) as u32;
|
||||
// static kCFURLBookmarkCreationSecurityScopeAllowOnlyReadAccess: CFURLBookmarkCreationOptions =
|
||||
// (1 << 12) as u32;
|
||||
pub static kCFURLBookmarkCreationPreferFileIDResolutionMask: CFURLBookmarkCreationOptions =
|
||||
(1u32 << 8) as usize;
|
||||
pub static kCFURLBookmarkCreationMinimalBookmarkMask: CFURLBookmarkCreationOptions =
|
||||
(1u32 << 9) as usize;
|
||||
pub static kCFURLBookmarkCreationSuitableForBookmarkFile: CFURLBookmarkCreationOptions =
|
||||
(1u32 << 10) as usize;
|
||||
pub static kCFURLBookmarkCreationWithSecurityScope: CFURLBookmarkCreationOptions =
|
||||
(1u32 << 11) as usize;
|
||||
pub static kCFURLBookmarkCreationSecurityScopeAllowOnlyReadAccess: CFURLBookmarkCreationOptions =
|
||||
(1u32 << 12) as usize;
|
||||
|
||||
// TODO: there are a lot of missing keys and constants. Add if you are bored or need them.
|
||||
|
||||
@ -83,8 +88,8 @@ extern {
|
||||
|
||||
/* Creating a CFURL */
|
||||
pub fn CFURLCopyAbsoluteURL(anURL: CFURLRef) -> CFURLRef;
|
||||
//fn CFURLCreateAbsoluteURLWithBytes
|
||||
//fn CFURLCreateByResolvingBookmarkData
|
||||
pub fn CFURLCreateAbsoluteURLWithBytes(allocator: CFAllocatorRef, relativeURLBytes: *const u8, length: CFIndex, encoding: CFStringEncoding, baseURL: CFURLRef, useCompatibilityMode: Boolean) -> CFURLRef;
|
||||
pub fn CFURLCreateByResolvingBookmarkData(allocator: CFAllocatorRef, bookmark: CFDataRef, options: CFURLBookmarkResolutionOptions, relativeToURL: CFURLRef, resourcePropertiesToInclude: CFArrayRef, isStale: *mut Boolean, error: *mut CFErrorRef) -> CFURLRef;
|
||||
//fn CFURLCreateCopyAppendingPathComponent
|
||||
//fn CFURLCreateCopyAppendingPathExtension
|
||||
//fn CFURLCreateCopyDeletingLastPathComponent
|
||||
@ -142,19 +147,19 @@ extern {
|
||||
//fn CFURLClearResourcePropertyCacheForKey
|
||||
//fn CFURLCopyResourcePropertiesForKeys
|
||||
//fn CFURLCopyResourcePropertyForKey
|
||||
//fn CFURLCreateResourcePropertiesForKeysFromBookmarkData
|
||||
//fn CFURLCreateResourcePropertyForKeyFromBookmarkData
|
||||
pub fn CFURLCreateResourcePropertiesForKeysFromBookmarkData(allocator: CFAllocatorRef, resourcePropertiesToReturn: CFArrayRef, bookmark: CFDataRef) -> CFDictionaryRef;
|
||||
pub fn CFURLCreateResourcePropertyForKeyFromBookmarkData(allocator: CFAllocatorRef, resourcePropertyKey: CFStringRef, bookmark: CFDataRef) -> CFTypeRef;
|
||||
//fn CFURLSetResourcePropertiesForKeys
|
||||
pub fn CFURLSetResourcePropertyForKey(url: CFURLRef, key: CFStringRef, value: CFTypeRef, error: *mut CFErrorRef) -> Boolean;
|
||||
//fn CFURLSetTemporaryResourcePropertyForKey
|
||||
|
||||
/* Working with Bookmark Data */
|
||||
//fn CFURLCreateBookmarkData
|
||||
//fn CFURLCreateBookmarkDataFromAliasRecord
|
||||
//fn CFURLCreateBookmarkDataFromFile
|
||||
//fn CFURLWriteBookmarkDataToFile
|
||||
//fn CFURLStartAccessingSecurityScopedResource
|
||||
//fn CFURLStopAccessingSecurityScopedResource
|
||||
pub fn CFURLCreateBookmarkData(allocator: CFAllocatorRef, url: CFURLRef, options: CFURLBookmarkCreationOptions, resourcePropertiesToInclude: CFArrayRef, relativeToURL: CFURLRef, error: *mut CFErrorRef) -> CFDataRef;
|
||||
pub fn CFURLCreateBookmarkDataFromAliasRecord(allocator: CFAllocatorRef, aliasRecordDataRef: CFDataRef) -> CFDataRef;
|
||||
pub fn CFURLCreateBookmarkDataFromFile(allocator: CFAllocatorRef, fileURL: CFURLRef, errorRef: *mut CFErrorRef) -> CFDataRef;
|
||||
pub fn CFURLWriteBookmarkDataToFile(bookmarkRef: CFDataRef, fileURL: CFURLRef, options: CFURLBookmarkFileCreationOptions, errorRef: *mut CFErrorRef) -> Boolean;
|
||||
pub fn CFURLStartAccessingSecurityScopedResource(url: CFURLRef) -> Boolean;
|
||||
pub fn CFURLStopAccessingSecurityScopedResource(url: CFURLRef);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"072515f7973c73e5db7674b3c3f0e0c13a07800fcacb2ef1efb0c656f0ca77fe","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","src/array.rs":"c38c9364cbd53c7656959b62cb3fa93f6e2fb37f2822fed89f052ea73bb4b052","src/attributed_string.rs":"b3b998991234c3740751a21a38ad5179b9761d79fa51f975921c40d515a69825","src/base.rs":"043dc1c905fce6b3c3a2b7ebf6de937c728ca5e75766639ff45b31ec7b0a11cf","src/boolean.rs":"f5b4d295aaf6cc3681212afebeae2974c5d551125badcc066e6089ac0d2a0873","src/bundle.rs":"7e0fbe7032c8658ba5751a236eaaaa4b031fef43daf0be3aa229de4beb83b52a","src/data.rs":"a1d7e6430c745731fc7b2aee49af9f14e79c8a288951c82ea6507689a3356af8","src/date.rs":"a02f6cca7b6e8fbabc7713177429012658dba5146556e14a08e7baaf81958d83","src/dictionary.rs":"897886dd2ff5f011e838829fc82564404e9384e7bee58db7dc7d4c08c352599d","src/error.rs":"22c21087d9c2c103d1bcb2c4af33b684317bbda5d4747902e510d410f8c1a14b","src/filedescriptor.rs":"f01da404e42760a50d91a43af648e781916c0a10c23753bea94f0f67bdc4d00c","src/lib.rs":"98a1deda9e40c293dfd2410d8f9bdcbc033ec0c55e3b2807050fc6a7d68f23ce","src/number.rs":"9de607a5809dcb7f43ccce5ea2b587423dfe69aa94c1cf68a52e20b50f8c9835","src/propertylist.rs":"762e1ed2db80badd1b491767c02a62c9aa31d9751ecd45c2e4b3bec89ebd40ad","src/runloop.rs":"98334ee796cea1634a5a9baf59d62f02c25b718d45baab5230a5cc14cb2ee6d5","src/set.rs":"f8e80eefe5257084350f04fce2cf6b051f08efe7921f6459cba67ccd7ea1e1e7","src/string.rs":"1f1216a9b126e0496b0f757a42c28c59f0ee53f9b8bd45a7b2b6dc8046a3f3e7","src/timezone.rs":"65859378232ee55f04bc4544b88f5dbc21f5db01bd16f2df3e82136ee3ce26b4","src/url.rs":"ee5370a1ba88823ee0eaa8615c5dafd55cedd7bd50172e9f2caa52ed305e2233","src/uuid.rs":"c532363a1a322a88e195f8606e613a68012708454b0d61ffe7abce432ec68596","tests/use_macro_outside_crate.rs":"ed5e74ac9e988f2609c0b785189f1e6368d693f6401603ad065521f3ab51df94"},"package":"4e2640d6d0bf22e82bed1b73c6aef8d5dd31e5abe6666c57e6d45e2649f4f887"}
|
||||
{"files":{"Cargo.toml":"b5b2f9b692bbd5d0b445bfc43eb2dad8e236fd14be6fea6511e2f972f2177b92","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","src/array.rs":"221e81de15d95ca453df39466ba65faf879f2923202145958dfcebe63bfef97f","src/attributed_string.rs":"e6b32d673fa957611dbac2480675fab3c697fca8043077f2015f0a0801b20425","src/base.rs":"394764fa59518507fd8d53024b9574ab914eb856c1a873e6b1b4d84cdcde1c31","src/boolean.rs":"f5b4d295aaf6cc3681212afebeae2974c5d551125badcc066e6089ac0d2a0873","src/bundle.rs":"b652810146ee35c7c08ccb8e0b920359bf0313f4e8ca20111627754854ca93b5","src/characterset.rs":"a3ffb46c5463c99813eebfc177a65794f44a1b9343534e28bbccd262034714c2","src/data.rs":"a1d7e6430c745731fc7b2aee49af9f14e79c8a288951c82ea6507689a3356af8","src/date.rs":"a02f6cca7b6e8fbabc7713177429012658dba5146556e14a08e7baaf81958d83","src/dictionary.rs":"ed8080eb00507e342521fb2c513a83c5706e883c3f8d67d8f38e9a0ed685c7eb","src/error.rs":"22c21087d9c2c103d1bcb2c4af33b684317bbda5d4747902e510d410f8c1a14b","src/filedescriptor.rs":"6c2087a8e101bfb31a6b916759a69a82852b18b2174c818f6ec9211ccdcaf1e6","src/lib.rs":"bbf7e392e1c8e5f4cd491601b6601ea26b389b47dc4e32217481a7b86020843c","src/number.rs":"5a6cc9036c156e7e9d787864dd671087677abf4175cd840cbf123ccd89abcafe","src/propertylist.rs":"557ff9c346fbc70d19a887e0ce9977b84066f5d4bb6ba53ece8b733a5f0526e3","src/runloop.rs":"048772c566cf3a1ec3e478958293aa9f3af38ff40b71ab7695f86b61d12f2023","src/set.rs":"c61d7cacdbe7c3c69b2add3d2f1721960f6df710ef4db6a442cd8b05e8e929f3","src/string.rs":"28cead4283dfeeeb1c8c8bcf855823ed4b952e3a54cb8ca1c8f5f9a25d77bc0b","src/timezone.rs":"65859378232ee55f04bc4544b88f5dbc21f5db01bd16f2df3e82136ee3ce26b4","src/url.rs":"6d009ad7991af80c3131cd63070309e5c4054076cc7b05c99caf88cea660bf43","src/uuid.rs":"c3457e43fc22ba0f3fcab3ee8108500585ba005dbcbfa7edad0d389701ddf379","tests/use_macro_outside_crate.rs":"ed5e74ac9e988f2609c0b785189f1e6368d693f6401603ad065521f3ab51df94"},"package":"57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171"}
|
10
third_party/rust/core-foundation/Cargo.toml
vendored
10
third_party/rust/core-foundation/Cargo.toml
vendored
@ -3,7 +3,7 @@
|
||||
# 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
|
||||
# to registry (e.g., crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
@ -12,10 +12,12 @@
|
||||
|
||||
[package]
|
||||
name = "core-foundation"
|
||||
version = "0.6.3"
|
||||
version = "0.7.0"
|
||||
authors = ["The Servo Project Developers"]
|
||||
description = "Bindings to Core Foundation for OS X"
|
||||
description = "Bindings to Core Foundation for macOS"
|
||||
homepage = "https://github.com/servo/core-foundation-rs"
|
||||
keywords = ["macos", "framework", "objc"]
|
||||
categories = ["os::macos-apis"]
|
||||
license = "MIT / Apache-2.0"
|
||||
repository = "https://github.com/servo/core-foundation-rs"
|
||||
[dependencies.chrono]
|
||||
@ -23,7 +25,7 @@ version = "0.4"
|
||||
optional = true
|
||||
|
||||
[dependencies.core-foundation-sys]
|
||||
version = "0.6.1"
|
||||
version = "0.7"
|
||||
|
||||
[dependencies.libc]
|
||||
version = "0.2"
|
||||
|
25
third_party/rust/core-foundation/src/array.rs
vendored
25
third_party/rust/core-foundation/src/array.rs
vendored
@ -66,7 +66,7 @@ impl<T> CFArray<T> {
|
||||
pub fn from_copyable(elems: &[T]) -> CFArray<T> where T: Copy {
|
||||
unsafe {
|
||||
let array_ref = CFArrayCreate(kCFAllocatorDefault,
|
||||
mem::transmute(elems.as_ptr()),
|
||||
elems.as_ptr() as *const *const c_void,
|
||||
elems.len().to_CFIndex(),
|
||||
ptr::null());
|
||||
TCFType::wrap_under_create_rule(array_ref)
|
||||
@ -78,7 +78,7 @@ impl<T> CFArray<T> {
|
||||
unsafe {
|
||||
let elems: Vec<CFTypeRef> = elems.iter().map(|elem| elem.as_CFTypeRef()).collect();
|
||||
let array_ref = CFArrayCreate(kCFAllocatorDefault,
|
||||
mem::transmute(elems.as_ptr()),
|
||||
elems.as_ptr(),
|
||||
elems.len().to_CFIndex(),
|
||||
&kCFTypeArrayCallBacks);
|
||||
TCFType::wrap_under_create_rule(array_ref)
|
||||
@ -250,12 +250,17 @@ mod tests {
|
||||
n5.as_CFType(),
|
||||
]);
|
||||
|
||||
assert!(arr.get_all_values() == &[n0.as_CFTypeRef(),
|
||||
n1.as_CFTypeRef(),
|
||||
n2.as_CFTypeRef(),
|
||||
n3.as_CFTypeRef(),
|
||||
n4.as_CFTypeRef(),
|
||||
n5.as_CFTypeRef()]);
|
||||
assert_eq!(
|
||||
arr.get_all_values(),
|
||||
&[
|
||||
n0.as_CFTypeRef(),
|
||||
n1.as_CFTypeRef(),
|
||||
n2.as_CFTypeRef(),
|
||||
n3.as_CFTypeRef(),
|
||||
n4.as_CFTypeRef(),
|
||||
n5.as_CFTypeRef()
|
||||
]
|
||||
);
|
||||
|
||||
let mut sum = 0;
|
||||
|
||||
@ -269,13 +274,13 @@ mod tests {
|
||||
sum += number.to_i64().unwrap()
|
||||
}
|
||||
|
||||
assert!(sum == 15);
|
||||
assert_eq!(sum, 15);
|
||||
|
||||
for elem in arr.iter() {
|
||||
let number: CFNumber = elem.downcast::<CFNumber>().unwrap();
|
||||
sum += number.to_i64().unwrap()
|
||||
}
|
||||
|
||||
assert!(sum == 30);
|
||||
assert_eq!(sum, 30);
|
||||
}
|
||||
}
|
||||
|
@ -77,3 +77,9 @@ impl CFMutableAttributedString {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for CFMutableAttributedString {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
9
third_party/rust/core-foundation/src/base.rs
vendored
9
third_party/rust/core-foundation/src/base.rs
vendored
@ -59,7 +59,7 @@ impl CFType {
|
||||
/// // Cast it up to a CFType.
|
||||
/// let cf_type: CFType = string.as_CFType();
|
||||
/// // Cast it down again.
|
||||
/// assert!(cf_type.downcast::<CFString>().unwrap().to_string() == "FooBar");
|
||||
/// assert_eq!(cf_type.downcast::<CFString>().unwrap().to_string(), "FooBar");
|
||||
/// // Casting it to some other type will yield `None`
|
||||
/// assert!(cf_type.downcast::<CFBoolean>().is_none());
|
||||
/// ```
|
||||
@ -111,6 +111,9 @@ impl CFType {
|
||||
}
|
||||
|
||||
impl fmt::Debug for CFType {
|
||||
/// Formats the value using [`CFCopyDescription`].
|
||||
///
|
||||
/// [`CFCopyDescription`]: https://developer.apple.com/documentation/corefoundation/1521252-cfcopydescription?language=objc
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let desc = unsafe {
|
||||
CFString::wrap_under_create_rule(CFCopyDescription(self.0))
|
||||
@ -154,6 +157,10 @@ impl CFAllocator {
|
||||
/// All Core Foundation types implement this trait. The associated type `Ref` specifies the
|
||||
/// associated Core Foundation type: e.g. for `CFType` this is `CFTypeRef`; for `CFArray` this is
|
||||
/// `CFArrayRef`.
|
||||
///
|
||||
/// Most structs that implement this trait will do so via the [`impl_TCFType`] macro.
|
||||
///
|
||||
/// [`impl_TCFType`]: ../macro.impl_TCFType.html
|
||||
pub trait TCFType {
|
||||
/// The reference type wrapped inside this type.
|
||||
type Ref: TCFTypeRef;
|
||||
|
11
third_party/rust/core-foundation/src/bundle.rs
vendored
11
third_party/rust/core-foundation/src/bundle.rs
vendored
@ -89,6 +89,17 @@ impl CFBundle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn shared_support_url(&self) -> Option<CFURL> {
|
||||
unsafe {
|
||||
let fw_url = CFBundleCopySharedSupportURL(self.0);
|
||||
if fw_url.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(TCFType::wrap_under_create_rule(fw_url))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
21
third_party/rust/core-foundation/src/characterset.rs
vendored
Normal file
21
third_party/rust/core-foundation/src/characterset.rs
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright 2019 The Servo Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! A set of Unicode compliant characters.
|
||||
|
||||
pub use core_foundation_sys::characterset::*;
|
||||
|
||||
use base::TCFType;
|
||||
|
||||
declare_TCFType!{
|
||||
/// An immutable set of Unicde characters.
|
||||
CFCharacterSet, CFCharacterSetRef
|
||||
}
|
||||
impl_TCFType!(CFCharacterSet, CFCharacterSetRef, CFCharacterSetGetTypeID);
|
||||
impl_CFTypeDescription!(CFCharacterSet);
|
@ -44,8 +44,8 @@ impl<K, V> CFDictionary<K, V> {
|
||||
|
||||
unsafe {
|
||||
let dictionary_ref = CFDictionaryCreate(kCFAllocatorDefault,
|
||||
mem::transmute(keys.as_ptr()),
|
||||
mem::transmute(values.as_ptr()),
|
||||
keys.as_ptr(),
|
||||
values.as_ptr(),
|
||||
keys.len().to_CFIndex(),
|
||||
&kCFTypeDictionaryKeyCallBacks,
|
||||
&kCFTypeDictionaryValueCallBacks);
|
||||
@ -58,6 +58,13 @@ impl<K, V> CFDictionary<K, V> {
|
||||
unsafe { CFDictionary::wrap_under_get_rule(self.0) }
|
||||
}
|
||||
|
||||
/// Returns a `CFMutableDictionary` pointing to the same underlying dictionary as this immutable one.
|
||||
/// This should only be used when the underlying dictionary is mutable.
|
||||
#[inline]
|
||||
pub unsafe fn to_mutable(&self) -> CFMutableDictionary<K, V> {
|
||||
CFMutableDictionary::wrap_under_get_rule(self.0 as CFMutableDictionaryRef)
|
||||
}
|
||||
|
||||
/// Returns the same dictionary, but with the types reset to void pointers.
|
||||
/// Equal to `to_untyped`, but is faster since it does not increment the retain count.
|
||||
#[inline]
|
||||
@ -103,7 +110,7 @@ impl<K, V> CFDictionary<K, V> {
|
||||
#[inline]
|
||||
pub fn get<'a, T: ToVoid<K>>(&'a self, key: T) -> ItemRef<'a, V> where V: FromVoid, K: ToVoid<K> {
|
||||
let ptr = key.to_void();
|
||||
self.find(key).expect(&format!("No entry found for key {:p}", ptr))
|
||||
self.find(key).unwrap_or_else(|| panic!("No entry found for key {:p}", ptr))
|
||||
}
|
||||
|
||||
pub fn get_keys_and_values(&self) -> (Vec<*const c_void>, Vec<*const c_void>) {
|
||||
@ -223,7 +230,7 @@ impl<K, V> CFMutableDictionary<K, V> {
|
||||
#[inline]
|
||||
pub fn get<'a>(&'a self, key: &K) -> ItemRef<'a, V> where V: FromVoid, K: ToVoid<K> {
|
||||
let ptr = key.to_void();
|
||||
self.find(&key).expect(&format!("No entry found for key {:p}", ptr))
|
||||
self.find(&key).unwrap_or_else(|| panic!("No entry found for key {:p}", ptr))
|
||||
}
|
||||
|
||||
pub fn get_keys_and_values(&self) -> (Vec<*const c_void>, Vec<*const c_void>) {
|
||||
@ -272,6 +279,12 @@ impl<K, V> CFMutableDictionary<K, V> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<K, V> Default for CFMutableDictionary<K, V> {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, K, V> From<&'a CFDictionary<K, V>> for CFMutableDictionary<K, V> {
|
||||
/// Creates a new mutable dictionary with the key-value pairs from another dictionary.
|
||||
/// The capacity of the new mutable dictionary is not limited.
|
||||
@ -309,8 +322,8 @@ pub mod test {
|
||||
]);
|
||||
|
||||
let (v1, v2) = d.get_keys_and_values();
|
||||
assert!(v1 == &[bar.as_CFTypeRef(), baz.as_CFTypeRef(), foo.as_CFTypeRef()]);
|
||||
assert!(v2 == &[boo.as_CFTypeRef(), tru.as_CFTypeRef(), n42.as_CFTypeRef()]);
|
||||
assert_eq!(v1, &[bar.as_CFTypeRef(), baz.as_CFTypeRef(), foo.as_CFTypeRef()]);
|
||||
assert_eq!(v2, &[boo.as_CFTypeRef(), tru.as_CFTypeRef(), n42.as_CFTypeRef()]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -329,15 +342,15 @@ pub mod test {
|
||||
assert_eq!(d.len(), 3);
|
||||
|
||||
let (v1, v2) = d.get_keys_and_values();
|
||||
assert!(v1 == &[bar.as_CFTypeRef(), baz.as_CFTypeRef(), foo.as_CFTypeRef()]);
|
||||
assert!(v2 == &[boo.as_CFTypeRef(), tru.as_CFTypeRef(), n42.as_CFTypeRef()]);
|
||||
assert_eq!(v1, &[bar.as_CFTypeRef(), baz.as_CFTypeRef(), foo.as_CFTypeRef()]);
|
||||
assert_eq!(v2, &[boo.as_CFTypeRef(), tru.as_CFTypeRef(), n42.as_CFTypeRef()]);
|
||||
|
||||
d.remove(baz);
|
||||
assert_eq!(d.len(), 2);
|
||||
|
||||
let (v1, v2) = d.get_keys_and_values();
|
||||
assert!(v1 == &[bar.as_CFTypeRef(), foo.as_CFTypeRef()]);
|
||||
assert!(v2 == &[boo.as_CFTypeRef(), n42.as_CFTypeRef()]);
|
||||
assert_eq!(v1, &[bar.as_CFTypeRef(), foo.as_CFTypeRef()]);
|
||||
assert_eq!(v2, &[boo.as_CFTypeRef(), n42.as_CFTypeRef()]);
|
||||
|
||||
d.remove_all();
|
||||
assert_eq!(d.len(), 0)
|
||||
|
@ -15,7 +15,7 @@ use core_foundation_sys::base::{kCFAllocatorDefault, CFOptionFlags};
|
||||
use base::TCFType;
|
||||
use runloop::CFRunLoopSource;
|
||||
|
||||
use std::mem;
|
||||
use std::mem::MaybeUninit;
|
||||
use std::os::unix::io::{AsRawFd, RawFd};
|
||||
use std::ptr;
|
||||
|
||||
@ -46,9 +46,9 @@ impl CFFileDescriptor {
|
||||
|
||||
pub fn context(&self) -> CFFileDescriptorContext {
|
||||
unsafe {
|
||||
let mut context: CFFileDescriptorContext = mem::uninitialized();
|
||||
CFFileDescriptorGetContext(self.0, &mut context);
|
||||
context
|
||||
let mut context = MaybeUninit::<CFFileDescriptorContext>::uninit();
|
||||
CFFileDescriptorGetContext(self.0, context.as_mut_ptr());
|
||||
context.assume_init()
|
||||
}
|
||||
}
|
||||
|
||||
|
55
third_party/rust/core-foundation/src/lib.rs
vendored
55
third_party/rust/core-foundation/src/lib.rs
vendored
@ -6,8 +6,15 @@
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
//! This crate provides wrappers around the underlying CoreFoundation
|
||||
//! types and functions that are available on Apple's operating systems.
|
||||
//!
|
||||
//! It also provides a framework for other crates to use when wrapping
|
||||
//! other frameworks that use the CoreFoundation framework.
|
||||
|
||||
extern crate core_foundation_sys;
|
||||
extern crate libc;
|
||||
|
||||
@ -18,6 +25,34 @@ use base::TCFType;
|
||||
|
||||
pub unsafe trait ConcreteCFType: TCFType {}
|
||||
|
||||
/// Declare a Rust type that wraps an underlying CoreFoundation type.
|
||||
///
|
||||
/// This will provide an implementation of `Drop` using [`CFRelease`].
|
||||
/// The type must have an implementation of the [`TCFType`] trait, usually
|
||||
/// provided using the [`impl_TCFType`] macro.
|
||||
///
|
||||
/// ```
|
||||
/// #[macro_use] extern crate core_foundation;
|
||||
/// // Make sure that the `TCFType` trait is in scope.
|
||||
/// use core_foundation::base::{CFTypeID, TCFType};
|
||||
///
|
||||
/// extern "C" {
|
||||
/// // We need a function that returns the `CFTypeID`.
|
||||
/// pub fn ShrubberyGetTypeID() -> CFTypeID;
|
||||
/// }
|
||||
///
|
||||
/// pub struct __Shrubbery {}
|
||||
/// // The ref type must be a pointer to the underlying struct.
|
||||
/// pub type ShrubberyRef = *const __Shrubbery;
|
||||
///
|
||||
/// declare_TCFType!(Shrubbery, ShrubberyRef);
|
||||
/// impl_TCFType!(Shrubbery, ShrubberyRef, ShrubberyGetTypeID);
|
||||
/// # fn main() {}
|
||||
/// ```
|
||||
///
|
||||
/// [`CFRelease`]: https://developer.apple.com/documentation/corefoundation/1521153-cfrelease
|
||||
/// [`TCFType`]: base/trait.TCFType.html
|
||||
/// [`impl_TCFType`]: macro.impl_TCFType.html
|
||||
#[macro_export]
|
||||
macro_rules! declare_TCFType {
|
||||
(
|
||||
@ -35,6 +70,13 @@ macro_rules! declare_TCFType {
|
||||
}
|
||||
}
|
||||
|
||||
/// Provide an implementation of the [`TCFType`] trait for the Rust
|
||||
/// wrapper type around an underlying CoreFoundation type.
|
||||
///
|
||||
/// See [`declare_TCFType`] for details.
|
||||
///
|
||||
/// [`declare_TCFType`]: macro.declare_TCFType.html
|
||||
/// [`TCFType`]: base/trait.TCFType.html
|
||||
#[macro_export]
|
||||
macro_rules! impl_TCFType {
|
||||
($ty:ident, $ty_ref:ident, $ty_id:ident) => {
|
||||
@ -122,6 +164,18 @@ macro_rules! impl_TCFType {
|
||||
}
|
||||
|
||||
|
||||
/// Implement `std::fmt::Debug` for the given type.
|
||||
///
|
||||
/// This will invoke the implementation of `Debug` for [`CFType`]
|
||||
/// which invokes [`CFCopyDescription`].
|
||||
///
|
||||
/// The type must have an implementation of the [`TCFType`] trait, usually
|
||||
/// provided using the [`impl_TCFType`] macro.
|
||||
///
|
||||
/// [`CFType`]: base/struct.CFType.html#impl-Debug
|
||||
/// [`CFCopyDescription`]: https://developer.apple.com/documentation/corefoundation/1521252-cfcopydescription?language=objc
|
||||
/// [`TCFType`]: base/trait.TCFType.html
|
||||
/// [`impl_TCFType`]: macro.impl_TCFType.html
|
||||
#[macro_export]
|
||||
macro_rules! impl_CFTypeDescription {
|
||||
($ty:ident) => {
|
||||
@ -162,6 +216,7 @@ pub mod array;
|
||||
pub mod attributed_string;
|
||||
pub mod base;
|
||||
pub mod boolean;
|
||||
pub mod characterset;
|
||||
pub mod data;
|
||||
pub mod date;
|
||||
pub mod dictionary;
|
||||
|
18
third_party/rust/core-foundation/src/number.rs
vendored
18
third_party/rust/core-foundation/src/number.rs
vendored
@ -11,7 +11,7 @@
|
||||
|
||||
use core_foundation_sys::base::kCFAllocatorDefault;
|
||||
pub use core_foundation_sys::number::*;
|
||||
use std::mem;
|
||||
use std::os::raw::c_void;
|
||||
|
||||
use base::TCFType;
|
||||
|
||||
@ -30,7 +30,7 @@ impl CFNumber {
|
||||
pub fn to_i32(&self) -> Option<i32> {
|
||||
unsafe {
|
||||
let mut value: i32 = 0;
|
||||
let ok = CFNumberGetValue(self.0, kCFNumberSInt32Type, mem::transmute(&mut value));
|
||||
let ok = CFNumberGetValue(self.0, kCFNumberSInt32Type, &mut value as *mut i32 as *mut c_void);
|
||||
if ok { Some(value) } else { None }
|
||||
}
|
||||
}
|
||||
@ -39,7 +39,7 @@ impl CFNumber {
|
||||
pub fn to_i64(&self) -> Option<i64> {
|
||||
unsafe {
|
||||
let mut value: i64 = 0;
|
||||
let ok = CFNumberGetValue(self.0, kCFNumberSInt64Type, mem::transmute(&mut value));
|
||||
let ok = CFNumberGetValue(self.0, kCFNumberSInt64Type, &mut value as *mut i64 as *mut c_void);
|
||||
if ok { Some(value) } else { None }
|
||||
}
|
||||
}
|
||||
@ -48,7 +48,7 @@ impl CFNumber {
|
||||
pub fn to_f32(&self) -> Option<f32> {
|
||||
unsafe {
|
||||
let mut value: f32 = 0.0;
|
||||
let ok = CFNumberGetValue(self.0, kCFNumberFloat32Type, mem::transmute(&mut value));
|
||||
let ok = CFNumberGetValue(self.0, kCFNumberFloat32Type, &mut value as *mut f32 as *mut c_void);
|
||||
if ok { Some(value) } else { None }
|
||||
}
|
||||
}
|
||||
@ -57,7 +57,7 @@ impl CFNumber {
|
||||
pub fn to_f64(&self) -> Option<f64> {
|
||||
unsafe {
|
||||
let mut value: f64 = 0.0;
|
||||
let ok = CFNumberGetValue(self.0, kCFNumberFloat64Type, mem::transmute(&mut value));
|
||||
let ok = CFNumberGetValue(self.0, kCFNumberFloat64Type, &mut value as *mut f64 as *mut c_void);
|
||||
if ok { Some(value) } else { None }
|
||||
}
|
||||
}
|
||||
@ -70,7 +70,7 @@ impl From<i32> for CFNumber {
|
||||
let number_ref = CFNumberCreate(
|
||||
kCFAllocatorDefault,
|
||||
kCFNumberSInt32Type,
|
||||
mem::transmute(&value),
|
||||
&value as *const i32 as *const c_void,
|
||||
);
|
||||
TCFType::wrap_under_create_rule(number_ref)
|
||||
}
|
||||
@ -84,7 +84,7 @@ impl From<i64> for CFNumber {
|
||||
let number_ref = CFNumberCreate(
|
||||
kCFAllocatorDefault,
|
||||
kCFNumberSInt64Type,
|
||||
mem::transmute(&value),
|
||||
&value as *const i64 as *const c_void,
|
||||
);
|
||||
TCFType::wrap_under_create_rule(number_ref)
|
||||
}
|
||||
@ -98,7 +98,7 @@ impl From<f32> for CFNumber {
|
||||
let number_ref = CFNumberCreate(
|
||||
kCFAllocatorDefault,
|
||||
kCFNumberFloat32Type,
|
||||
mem::transmute(&value),
|
||||
&value as *const f32 as *const c_void,
|
||||
);
|
||||
TCFType::wrap_under_create_rule(number_ref)
|
||||
}
|
||||
@ -112,7 +112,7 @@ impl From<f64> for CFNumber {
|
||||
let number_ref = CFNumberCreate(
|
||||
kCFAllocatorDefault,
|
||||
kCFNumberFloat64Type,
|
||||
mem::transmute(&value),
|
||||
&value as *const f64 as *const c_void,
|
||||
);
|
||||
TCFType::wrap_under_create_rule(number_ref)
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ impl CFPropertyList {
|
||||
|
||||
#[inline]
|
||||
pub unsafe fn wrap_under_get_rule(reference: CFPropertyListRef) -> CFPropertyList {
|
||||
let reference = mem::transmute(CFRetain(mem::transmute(reference)));
|
||||
let reference = CFRetain(reference);
|
||||
CFPropertyList(reference)
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ impl CFPropertyList {
|
||||
|
||||
#[inline]
|
||||
pub fn as_CFTypeRef(&self) -> ::core_foundation_sys::base::CFTypeRef {
|
||||
unsafe { mem::transmute(self.as_concrete_TypeRef()) }
|
||||
self.as_concrete_TypeRef()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -208,7 +208,7 @@ impl CFPropertyList {
|
||||
/// // Cast it up to a property list.
|
||||
/// let propertylist: CFPropertyList = string.to_CFPropertyList();
|
||||
/// // Cast it down again.
|
||||
/// assert!(propertylist.downcast::<CFString>().unwrap().to_string() == "FooBar");
|
||||
/// assert_eq!(propertylist.downcast::<CFString>().unwrap().to_string(), "FooBar");
|
||||
/// ```
|
||||
///
|
||||
/// [`CFPropertyList`]: struct.CFPropertyList.html
|
||||
@ -271,7 +271,7 @@ pub mod test {
|
||||
let data = create_data(dict1.as_CFTypeRef(), kCFPropertyListXMLFormat_v1_0).unwrap();
|
||||
let (dict2, _) = create_with_data(data, kCFPropertyListImmutable).unwrap();
|
||||
unsafe {
|
||||
assert!(CFEqual(dict1.as_CFTypeRef(), dict2) == 1);
|
||||
assert_eq!(CFEqual(dict1.as_CFTypeRef(), dict2), 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,7 +291,7 @@ pub mod test {
|
||||
#[test]
|
||||
fn downcast_string() {
|
||||
let propertylist = CFString::from_static_string("Bar").to_CFPropertyList();
|
||||
assert!(propertylist.downcast::<CFString>().unwrap().to_string() == "Bar");
|
||||
assert_eq!(propertylist.downcast::<CFString>().unwrap().to_string(), "Bar");
|
||||
assert!(propertylist.downcast::<CFBoolean>().is_none());
|
||||
}
|
||||
|
||||
@ -319,7 +319,7 @@ pub mod test {
|
||||
assert_eq!(string.retain_count(), 2);
|
||||
|
||||
let string2 = propertylist.downcast_into::<CFString>().unwrap();
|
||||
assert!(string2.to_string() == "Bar");
|
||||
assert_eq!(string2.to_string(), "Bar");
|
||||
assert_eq!(string2.retain_count(), 2);
|
||||
}
|
||||
}
|
||||
|
11
third_party/rust/core-foundation/src/runloop.rs
vendored
11
third_party/rust/core-foundation/src/runloop.rs
vendored
@ -165,14 +165,13 @@ mod test {
|
||||
start_time: now,
|
||||
elapsed_tx,
|
||||
};
|
||||
let mut context = unsafe { CFRunLoopTimerContext {
|
||||
let mut context = CFRunLoopTimerContext {
|
||||
version: 0,
|
||||
info: &mut info as *mut _ as *mut c_void,
|
||||
retain: mem::zeroed(),
|
||||
release: mem::zeroed(),
|
||||
copyDescription: mem::zeroed(),
|
||||
} };
|
||||
|
||||
retain: None,
|
||||
release: None,
|
||||
copyDescription: None,
|
||||
};
|
||||
|
||||
let run_loop_timer = CFRunLoopTimer::new(now + 0.20f64, 0f64, 0, 0, timer_popped, &mut context);
|
||||
unsafe {
|
||||
|
3
third_party/rust/core-foundation/src/set.rs
vendored
3
third_party/rust/core-foundation/src/set.rs
vendored
@ -14,7 +14,6 @@ use core_foundation_sys::base::{CFTypeRef, CFRelease, kCFAllocatorDefault};
|
||||
|
||||
use base::{CFIndexConvertible, TCFType};
|
||||
|
||||
use std::mem;
|
||||
use std::os::raw::c_void;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
@ -36,7 +35,7 @@ impl CFSet {
|
||||
unsafe {
|
||||
let elems: Vec<CFTypeRef> = elems.iter().map(|elem| elem.as_CFTypeRef()).collect();
|
||||
let set_ref = CFSetCreate(kCFAllocatorDefault,
|
||||
mem::transmute(elems.as_ptr()),
|
||||
elems.as_ptr(),
|
||||
elems.len().to_CFIndex(),
|
||||
&kCFTypeSetCallBacks);
|
||||
TCFType::wrap_under_create_rule(set_ref)
|
||||
|
@ -50,7 +50,7 @@ impl<'a> From<&'a CFString> for Cow<'a, str> {
|
||||
unsafe {
|
||||
// Do this without allocating if we can get away with it
|
||||
let c_string = CFStringGetCStringPtr(cf_str.0, kCFStringEncodingUTF8);
|
||||
if c_string != ptr::null() {
|
||||
if !c_string.is_null() {
|
||||
let c_str = CStr::from_ptr(c_string);
|
||||
Cow::Borrowed(str::from_utf8_unchecked(c_str.to_bytes()))
|
||||
} else {
|
||||
@ -79,11 +79,11 @@ impl<'a> From<&'a CFString> for Cow<'a, str> {
|
||||
buffer.as_mut_ptr(),
|
||||
buffer.len().to_CFIndex(),
|
||||
&mut bytes_used);
|
||||
assert!(chars_written == char_len);
|
||||
assert_eq!(chars_written, char_len);
|
||||
|
||||
// This is dangerous; we over-allocate and null-terminate the string (during
|
||||
// initialization).
|
||||
assert!(bytes_used == buffer.len().to_CFIndex());
|
||||
assert_eq!(bytes_used, buffer.len().to_CFIndex());
|
||||
Cow::Owned(String::from_utf8_unchecked(buffer))
|
||||
}
|
||||
}
|
||||
@ -146,5 +146,5 @@ fn string_and_back() {
|
||||
let original = "The quick brown fox jumped over the slow lazy dog.";
|
||||
let cfstr = CFString::from_static_string(original);
|
||||
let converted = cfstr.to_string();
|
||||
assert!(converted == original);
|
||||
assert_eq!(converted, original);
|
||||
}
|
||||
|
8
third_party/rust/core-foundation/src/url.rs
vendored
8
third_party/rust/core-foundation/src/url.rs
vendored
@ -16,11 +16,11 @@ use string::{CFString};
|
||||
|
||||
use core_foundation_sys::base::{kCFAllocatorDefault, Boolean};
|
||||
use std::fmt;
|
||||
use std::mem::MaybeUninit;
|
||||
use std::ptr;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::mem;
|
||||
|
||||
use libc::{strlen, PATH_MAX};
|
||||
use libc::{c_char, strlen, PATH_MAX};
|
||||
|
||||
#[cfg(unix)]
|
||||
use std::os::unix::ffi::OsStrExt;
|
||||
@ -78,12 +78,12 @@ impl CFURL {
|
||||
pub fn to_path(&self) -> Option<PathBuf> {
|
||||
// implementing this on Windows is more complicated because of the different OsStr representation
|
||||
unsafe {
|
||||
let mut buf: [u8; PATH_MAX as usize] = mem::uninitialized();
|
||||
let mut buf = [0u8; PATH_MAX as usize];
|
||||
let result = CFURLGetFileSystemRepresentation(self.0, true as Boolean, buf.as_mut_ptr(), buf.len() as CFIndex);
|
||||
if result == false as Boolean {
|
||||
return None;
|
||||
}
|
||||
let len = strlen(buf.as_ptr() as *const i8);
|
||||
let len = strlen(buf.as_ptr() as *const c_char);
|
||||
let path = OsStr::from_bytes(&buf[0..len]);
|
||||
Some(PathBuf::from(path))
|
||||
}
|
||||
|
8
third_party/rust/core-foundation/src/uuid.rs
vendored
8
third_party/rust/core-foundation/src/uuid.rs
vendored
@ -38,6 +38,12 @@ impl CFUUID {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for CFUUID {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "with-uuid")]
|
||||
impl Into<Uuid> for CFUUID {
|
||||
fn into(self) -> Uuid {
|
||||
@ -107,6 +113,6 @@ mod test {
|
||||
let cf_uuid = CFUUID::new();
|
||||
let uuid: Uuid = cf_uuid.clone().into();
|
||||
let converted = CFUUID::from(uuid);
|
||||
assert!(cf_uuid == converted);
|
||||
assert_eq!(cf_uuid, converted);
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"ff714d37c339428ee9c8958414b52f0f49578de1001cd27e732b8cc965ad0326","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"4a45abeb1e684e30bb361dfa7db59189423348e18d310cbae694b7c8c57cd86a","src/base.rs":"5faaadaf17d93c370a20f358be6c3f12958ab7d3f99ccc634421e28758fec88b","src/color.rs":"4c8ec4ab828cbc1b2a1538a34a51f5b380927f2f1daf187dff6f732f57a43656","src/color_space.rs":"b3d7ee8a21703c789160867cb8eb2188bd1daa193e3d030f21adb6f1a6f872de","src/context.rs":"6b14ec712e5d0af4af6beb0cb1a998bf1262ec6ab6ad2b3efad9e0362ade83c9","src/data_provider.rs":"22614a6ce7f857dec33e6d2dc01261b71b1bc5d5609a54ee55e04c049670c072","src/display.rs":"5b04d1fded021fc1eecb89b6350a66f6668e802b51e75cf69892ca082257443c","src/event.rs":"f2ade1c2c112bae7bc4f5df1eda63c13d1c32e5db255228f139ce17fb37c1a4b","src/event_source.rs":"d55a4f5b5e62789325028febc51bbf54c74b15ab1a4e70c6ad749a2f9753e081","src/font.rs":"63b7e50243a56254c800421df586abee59aead84f735f7df838ae04693aedf4b","src/geometry.rs":"cdeb9624df601d235bcc34d46e35bea302079ce1e3668253356a618486693a9f","src/image.rs":"0af720ee020fb1c6a2f4b1ce49e3d27f8f21f0be6b81ba4b9c824f87564efa58","src/lib.rs":"9b9601462de1bbc806e881b2b42e86b16372cad8eeefe1a96b772a9f7329958d","src/path.rs":"c429afeaed999b02ac00f89a867b5fc64f1e223039079a4e0529306b734ff117","src/private.rs":"da3fd61338bab2d8e26aa5433b2e18ecd2a0a408c62e1ac2b33a0f87f2dad88a","src/sys.rs":"cc90b690f172da51a87ffb234f6e74a9f501c4f1630d7b51fa2d5846e80fc164","src/window.rs":"2f6c3dc958ae2c0c9e2fc5033300b96e60ed0abee9823ea1f03797d64df0911a"},"package":"56790968ab1c8a1202a102e6de05fc6e1ec87da99e4e93e9a7d13efbfc1e95a9"}
|
||||
{"files":{"COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"fccf58052cf6a36aba8ce4936d5e62d953f73a1fbedbe89b6d099bcd3848a5a5","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"6745c3c38183d2eda9b1fa265fb0a95018db5c110cbabc00b32327d951bbe2ea","src/base.rs":"89e01071e66f0c66fa22d94fd666100c89f6a20d988fb8bacbf86b8ed633bcbd","src/color.rs":"4c8ec4ab828cbc1b2a1538a34a51f5b380927f2f1daf187dff6f732f57a43656","src/color_space.rs":"b3d7ee8a21703c789160867cb8eb2188bd1daa193e3d030f21adb6f1a6f872de","src/context.rs":"b4b05d7c75337e8f8ece3143d1f1a48b3ae6868c473469c2ce7fd030512f9aff","src/data_provider.rs":"9e8a17075b1527f87111fd4102252e086bf9fde147483f21a661773e133f7c71","src/display.rs":"cc691712c3d27342ae97f04df6032d6f682570239ba51936fcc796c61bf08c8b","src/event.rs":"593d7f6c0621f8803546562548f98985f171eb74b513d6f9b9081fe6f2d1a1a8","src/event_source.rs":"d55a4f5b5e62789325028febc51bbf54c74b15ab1a4e70c6ad749a2f9753e081","src/font.rs":"e1d2be7f909fd5876f3cd1649d54ef0a9d7dcd4151c027a25049be7084ca8a9f","src/geometry.rs":"49d27dde6672e5654f796ec3399216ab6d1cf9ed9d3506a824c8e9eec6e3db00","src/image.rs":"0af720ee020fb1c6a2f4b1ce49e3d27f8f21f0be6b81ba4b9c824f87564efa58","src/lib.rs":"9b9601462de1bbc806e881b2b42e86b16372cad8eeefe1a96b772a9f7329958d","src/path.rs":"c429afeaed999b02ac00f89a867b5fc64f1e223039079a4e0529306b734ff117","src/private.rs":"da3fd61338bab2d8e26aa5433b2e18ecd2a0a408c62e1ac2b33a0f87f2dad88a","src/sys.rs":"cc90b690f172da51a87ffb234f6e74a9f501c4f1630d7b51fa2d5846e80fc164","src/window.rs":"2f6c3dc958ae2c0c9e2fc5033300b96e60ed0abee9823ea1f03797d64df0911a"},"package":"59e78b2e0aaf43f08e7ae0d6bc96895ef72ff0921c7d4ff4762201b2dba376dd"}
|
8
third_party/rust/core-graphics/Cargo.toml
vendored
8
third_party/rust/core-graphics/Cargo.toml
vendored
@ -3,7 +3,7 @@
|
||||
# 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
|
||||
# to registry (e.g., crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
@ -12,9 +12,9 @@
|
||||
|
||||
[package]
|
||||
name = "core-graphics"
|
||||
version = "0.17.3"
|
||||
version = "0.19.0"
|
||||
authors = ["The Servo Project Developers"]
|
||||
description = "Bindings to Core Graphics for OS X"
|
||||
description = "Bindings to Core Graphics for macOS"
|
||||
homepage = "https://github.com/servo/core-graphics-rs"
|
||||
license = "MIT / Apache-2.0"
|
||||
repository = "https://github.com/servo/core-foundation-rs"
|
||||
@ -22,7 +22,7 @@ repository = "https://github.com/servo/core-foundation-rs"
|
||||
version = "1.0"
|
||||
|
||||
[dependencies.core-foundation]
|
||||
version = "0.6"
|
||||
version = "0.7"
|
||||
|
||||
[dependencies.foreign-types]
|
||||
version = "0.3.0"
|
||||
|
2
third_party/rust/core-graphics/README.md
vendored
2
third_party/rust/core-graphics/README.md
vendored
@ -1,3 +1,3 @@
|
||||
# core-graphics-rs
|
||||
|
||||
[![Build Status](https://travis-ci.org/servo/core-graphics-rs.svg?branch=master)](https://travis-ci.org/servo/core-graphics-rs)
|
||||
[![Build Status](https://travis-ci.com/servo/core-graphics-rs.svg?branch=master)](https://travis-ci.com/servo/core-graphics-rs)
|
||||
|
2
third_party/rust/core-graphics/src/base.rs
vendored
2
third_party/rust/core-graphics/src/base.rs
vendored
@ -26,7 +26,7 @@ pub type CGFloat = libc::c_double;
|
||||
#[cfg(not(target_pointer_width = "64"))]
|
||||
pub type CGFloat = libc::c_float;
|
||||
|
||||
pub type CGError = libc::int32_t;
|
||||
pub type CGError = i32;
|
||||
|
||||
pub const kCGImageAlphaNone: u32 = 0;
|
||||
pub const kCGImageAlphaPremultipliedLast: u32 = 1;
|
||||
|
284
third_party/rust/core-graphics/src/context.rs
vendored
284
third_party/rust/core-graphics/src/context.rs
vendored
@ -69,6 +69,32 @@ pub enum CGTextDrawingMode {
|
||||
CGTextClip
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum CGLineCap {
|
||||
CGLineCapButt,
|
||||
CGLineCapRound,
|
||||
CGLineCapSquare,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum CGLineJoin {
|
||||
CGLineJoinMiter,
|
||||
CGLineJoinRound,
|
||||
CGLineJoinBevel,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum CGPathDrawingMode {
|
||||
CGPathFill,
|
||||
CGPathEOFill,
|
||||
CGPathStroke,
|
||||
CGPathFillStroke,
|
||||
CGPathEOFillStroke,
|
||||
}
|
||||
|
||||
foreign_type! {
|
||||
#[doc(hidden)]
|
||||
type CType = ::sys::CGContext;
|
||||
@ -140,6 +166,12 @@ impl CGContextRef {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn clip_bounding_box(&self) -> CGRect {
|
||||
unsafe {
|
||||
CGContextGetClipBoundingBox(self.as_ptr())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_fill_color(&self, color: &CGColor) {
|
||||
unsafe {
|
||||
CGContextSetFillColorWithColor(self.as_ptr(), color.to_void());
|
||||
@ -152,6 +184,12 @@ impl CGContextRef {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_rgb_stroke_color(&self, red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat) {
|
||||
unsafe {
|
||||
CGContextSetRGBStrokeColor(self.as_ptr(), red, green, blue, alpha)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_gray_fill_color(&self, gray: CGFloat, alpha: CGFloat) {
|
||||
unsafe {
|
||||
CGContextSetGrayFillColor(self.as_ptr(), gray, alpha)
|
||||
@ -224,30 +262,195 @@ impl CGContextRef {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_line_cap(&self, cap: CGLineCap) {
|
||||
unsafe {
|
||||
CGContextSetLineCap(self.as_ptr(), cap)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_line_dash(&self, phase: CGFloat, lengths: &[CGFloat]) {
|
||||
unsafe {
|
||||
CGContextSetLineDash(self.as_ptr(), phase, lengths.as_ptr(), lengths.len())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_line_join(&self, join: CGLineJoin) {
|
||||
unsafe {
|
||||
CGContextSetLineJoin(self.as_ptr(), join)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_line_width(&self, width: CGFloat) {
|
||||
unsafe {
|
||||
CGContextSetLineWidth(self.as_ptr(), width)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_miter_limit(&self, limit: CGFloat) {
|
||||
unsafe {
|
||||
CGContextSetMiterLimit(self.as_ptr(), limit)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_path(&self, path: &CGPathRef) {
|
||||
unsafe {
|
||||
CGContextAddPath(self.as_ptr(), path.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_curve_to_point(&self,
|
||||
cp1x: CGFloat,
|
||||
cp1y: CGFloat,
|
||||
cp2x: CGFloat,
|
||||
cp2y: CGFloat,
|
||||
x: CGFloat,
|
||||
y: CGFloat) {
|
||||
unsafe {
|
||||
CGContextAddCurveToPoint(self.as_ptr(),
|
||||
cp1x, cp1y,
|
||||
cp2x, cp2y,
|
||||
x, y);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_quad_curve_to_point(&self,
|
||||
cpx: CGFloat,
|
||||
cpy: CGFloat,
|
||||
x: CGFloat,
|
||||
y: CGFloat) {
|
||||
unsafe {
|
||||
CGContextAddQuadCurveToPoint(self.as_ptr(),
|
||||
cpx, cpy,
|
||||
x, y);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_line_to_point(&self, x: CGFloat, y: CGFloat) {
|
||||
unsafe {
|
||||
CGContextAddLineToPoint(self.as_ptr(), x, y);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn begin_path(&self) {
|
||||
unsafe {
|
||||
CGContextBeginPath(self.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn close_path(&self) {
|
||||
unsafe {
|
||||
CGContextClosePath(self.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn move_to_point(&self, x: CGFloat, y: CGFloat) {
|
||||
unsafe {
|
||||
CGContextMoveToPoint(self.as_ptr(), x, y);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn clip(&self) {
|
||||
unsafe {
|
||||
CGContextClip(self.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn eo_clip(&self) {
|
||||
unsafe {
|
||||
CGContextEOClip(self.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn draw_path(&self, mode: CGPathDrawingMode) {
|
||||
unsafe {
|
||||
CGContextDrawPath(self.as_ptr(), mode);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fill_path(&self) {
|
||||
unsafe {
|
||||
CGContextFillPath(self.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn eo_fill_path(&self) {
|
||||
unsafe {
|
||||
CGContextEOFillPath(self.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn stroke_path(&self) {
|
||||
unsafe {
|
||||
CGContextStrokePath(self.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fill_rect(&self, rect: CGRect) {
|
||||
unsafe {
|
||||
CGContextFillRect(self.as_ptr(), rect)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fill_rects(&self, rects: &[CGRect]) {
|
||||
unsafe {
|
||||
CGContextFillRects(self.as_ptr(), rects.as_ptr(), rects.len())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn clear_rect(&self, rect: CGRect) {
|
||||
unsafe {
|
||||
CGContextClearRect(self.as_ptr(), rect)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn stroke_rect(&self, rect: CGRect) {
|
||||
unsafe {
|
||||
CGContextStrokeRect(self.as_ptr(), rect)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn stroke_rect_with_width(&self, rect: CGRect, width: CGFloat) {
|
||||
unsafe {
|
||||
CGContextStrokeRectWithWidth(self.as_ptr(), rect, width)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn clip_to_rect(&self, rect: CGRect) {
|
||||
unsafe {
|
||||
CGContextClipToRect(self.as_ptr(), rect)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn clip_to_rects(&self, rects: &[CGRect]) {
|
||||
unsafe {
|
||||
CGContextClipToRects(self.as_ptr(), rects.as_ptr(), rects.len())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn replace_path_with_stroked_path(&self) {
|
||||
unsafe {
|
||||
CGContextReplacePathWithStrokedPath(self.as_ptr())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fill_ellipse_in_rect(&self, rect: CGRect) {
|
||||
unsafe {
|
||||
CGContextFillEllipseInRect(self.as_ptr(), rect)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn stroke_ellipse_in_rect(&self, rect: CGRect) {
|
||||
unsafe {
|
||||
CGContextStrokeEllipseInRect(self.as_ptr(), rect)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn stroke_line_segments(&self, points: &[CGPoint]) {
|
||||
unsafe {
|
||||
CGContextStrokeLineSegments(self.as_ptr(), points.as_ptr(), points.len())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn draw_image(&self, rect: CGRect, image: &CGImage) {
|
||||
unsafe {
|
||||
CGContextDrawImage(self.as_ptr(), rect, image.as_ptr());
|
||||
@ -314,6 +517,24 @@ impl CGContextRef {
|
||||
CGContextScaleCTM(self.as_ptr(), sx, sy);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn rotate(&self, angle: CGFloat) {
|
||||
unsafe {
|
||||
CGContextRotateCTM(self.as_ptr(), angle);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_ctm(&self) -> CGAffineTransform {
|
||||
unsafe {
|
||||
CGContextGetCTM(self.as_ptr())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn concat_ctm(&self, transform: CGAffineTransform) {
|
||||
unsafe {
|
||||
CGContextConcatCTM(self.as_ptr(), transform)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -327,6 +548,7 @@ fn create_bitmap_context_test() {
|
||||
&cs,
|
||||
::base::kCGImageAlphaPremultipliedLast);
|
||||
ctx.set_rgb_fill_color(1.,0.,1.,1.);
|
||||
ctx.set_miter_limit(4.);
|
||||
ctx.fill_rect(CGRect::new(&CGPoint::new(0.,0.), &CGSize::new(8.,8.)));
|
||||
let img = ctx.create_image().unwrap();
|
||||
assert_eq!(16, img.width());
|
||||
@ -356,6 +578,7 @@ extern {
|
||||
fn CGBitmapContextGetBytesPerRow(context: ::sys::CGContextRef) -> size_t;
|
||||
fn CGBitmapContextCreateImage(context: ::sys::CGContextRef) -> ::sys::CGImageRef;
|
||||
fn CGContextGetTypeID() -> CFTypeID;
|
||||
fn CGContextGetClipBoundingBox(c: ::sys::CGContextRef) -> CGRect;
|
||||
fn CGContextFlush(c: ::sys::CGContextRef);
|
||||
fn CGContextSetBlendMode(c: ::sys::CGContextRef, blendMode: CGBlendMode);
|
||||
fn CGContextSetAllowsFontSmoothing(c: ::sys::CGContextRef, allowsFontSmoothing: bool);
|
||||
@ -373,17 +596,75 @@ extern {
|
||||
shouldSubpixelPositionFonts: bool);
|
||||
fn CGContextSetTextDrawingMode(c: ::sys::CGContextRef, mode: CGTextDrawingMode);
|
||||
fn CGContextSetFillColorWithColor(c: ::sys::CGContextRef, color: *const c_void);
|
||||
fn CGContextSetLineCap(c: ::sys::CGContextRef, cap: CGLineCap);
|
||||
fn CGContextSetLineDash(c: ::sys::CGContextRef, phase: CGFloat, lengths: *const CGFloat, count: size_t);
|
||||
fn CGContextSetLineJoin(c: ::sys::CGContextRef, join: CGLineJoin);
|
||||
fn CGContextSetLineWidth(c: ::sys::CGContextRef, width: CGFloat);
|
||||
fn CGContextSetMiterLimit(c: ::sys::CGContextRef, limit: CGFloat);
|
||||
|
||||
fn CGContextAddPath(c: ::sys::CGContextRef, path: ::sys::CGPathRef);
|
||||
fn CGContextAddCurveToPoint(c: ::sys::CGContextRef,
|
||||
cp1x: CGFloat,
|
||||
cp1y: CGFloat,
|
||||
cp2x: CGFloat,
|
||||
cp2y: CGFloat,
|
||||
x: CGFloat,
|
||||
y: CGFloat);
|
||||
fn CGContextAddQuadCurveToPoint(c: ::sys::CGContextRef,
|
||||
cpx: CGFloat,
|
||||
cpy: CGFloat,
|
||||
x: CGFloat,
|
||||
y: CGFloat);
|
||||
fn CGContextAddLineToPoint(c: ::sys::CGContextRef,
|
||||
x: CGFloat,
|
||||
y: CGFloat);
|
||||
fn CGContextBeginPath(c: ::sys::CGContextRef);
|
||||
fn CGContextClosePath(c: ::sys::CGContextRef);
|
||||
fn CGContextMoveToPoint(c: ::sys::CGContextRef,
|
||||
x: CGFloat,
|
||||
y: CGFloat);
|
||||
fn CGContextDrawPath(c: ::sys::CGContextRef, mode: CGPathDrawingMode);
|
||||
fn CGContextFillPath(c: ::sys::CGContextRef);
|
||||
fn CGContextEOFillPath(c: ::sys::CGContextRef);
|
||||
fn CGContextClip(c: ::sys::CGContextRef);
|
||||
fn CGContextEOClip(c: ::sys::CGContextRef);
|
||||
fn CGContextStrokePath(c: ::sys::CGContextRef);
|
||||
fn CGContextSetRGBFillColor(context: ::sys::CGContextRef,
|
||||
red: CGFloat,
|
||||
green: CGFloat,
|
||||
blue: CGFloat,
|
||||
alpha: CGFloat);
|
||||
fn CGContextSetRGBStrokeColor(context: ::sys::CGContextRef,
|
||||
red: CGFloat,
|
||||
green: CGFloat,
|
||||
blue: CGFloat,
|
||||
alpha: CGFloat);
|
||||
fn CGContextSetGrayFillColor(context: ::sys::CGContextRef, gray: CGFloat, alpha: CGFloat);
|
||||
fn CGContextClearRect(context: ::sys::CGContextRef,
|
||||
rect: CGRect);
|
||||
fn CGContextFillRect(context: ::sys::CGContextRef,
|
||||
rect: CGRect);
|
||||
fn CGContextFillRects(context: ::sys::CGContextRef,
|
||||
rects: *const CGRect,
|
||||
count: size_t);
|
||||
fn CGContextStrokeRect(context: ::sys::CGContextRef,
|
||||
rect: CGRect);
|
||||
fn CGContextStrokeRectWithWidth(context: ::sys::CGContextRef,
|
||||
rect: CGRect,
|
||||
width: CGFloat);
|
||||
fn CGContextClipToRect(context: ::sys::CGContextRef,
|
||||
rect: CGRect);
|
||||
fn CGContextClipToRects(context: ::sys::CGContextRef,
|
||||
rects: *const CGRect,
|
||||
count: size_t);
|
||||
fn CGContextReplacePathWithStrokedPath(context: ::sys::CGContextRef);
|
||||
fn CGContextFillEllipseInRect(context: ::sys::CGContextRef,
|
||||
rect: CGRect);
|
||||
fn CGContextStrokeEllipseInRect(context: ::sys::CGContextRef,
|
||||
rect: CGRect);
|
||||
fn CGContextStrokeLineSegments(context: ::sys::CGContextRef,
|
||||
points: *const CGPoint,
|
||||
count: size_t);
|
||||
fn CGContextDrawImage(c: ::sys::CGContextRef, rect: CGRect, image: ::sys::CGImageRef);
|
||||
fn CGContextSetFont(c: ::sys::CGContextRef, font: ::sys::CGFontRef);
|
||||
fn CGContextSetFontSize(c: ::sys::CGContextRef, size: CGFloat);
|
||||
@ -397,5 +678,8 @@ extern {
|
||||
fn CGContextRestoreGState(c: ::sys::CGContextRef);
|
||||
fn CGContextTranslateCTM(c: ::sys::CGContextRef, tx: CGFloat, ty: CGFloat);
|
||||
fn CGContextScaleCTM(c: ::sys::CGContextRef, sx: CGFloat, sy: CGFloat);
|
||||
fn CGContextRotateCTM(c: ::sys::CGContextRef, angle: CGFloat);
|
||||
fn CGContextGetCTM(c: ::sys::CGContextRef) -> CGAffineTransform;
|
||||
fn CGContextConcatCTM(c: ::sys::CGContextRef, transform: CGAffineTransform);
|
||||
}
|
||||
|
||||
|
@ -77,14 +77,14 @@ impl CGDataProvider {
|
||||
///
|
||||
/// This is double-boxed because the Core Text API requires that the userdata be a single
|
||||
/// pointer.
|
||||
pub unsafe fn from_custom_data(custom_data: Box<Box<CustomData>>) -> Self {
|
||||
pub unsafe fn from_custom_data(custom_data: Box<Box<dyn CustomData>>) -> Self {
|
||||
let (ptr, len) = (custom_data.ptr() as *const c_void, custom_data.len());
|
||||
let userdata = mem::transmute::<Box<Box<CustomData>>, &mut c_void>(custom_data);
|
||||
let userdata = mem::transmute::<Box<Box<dyn CustomData>>, &mut c_void>(custom_data);
|
||||
let data_provider = CGDataProviderCreateWithData(userdata, ptr, len, Some(release));
|
||||
return CGDataProvider::from_ptr(data_provider);
|
||||
|
||||
unsafe extern "C" fn release(info: *mut c_void, _: *const c_void, _: size_t) {
|
||||
drop(mem::transmute::<*mut c_void, Box<Box<CustomData>>>(info))
|
||||
drop(mem::transmute::<*mut c_void, Box<Box<dyn CustomData>>>(info))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
85
third_party/rust/core-graphics/src/display.rs
vendored
85
third_party/rust/core-graphics/src/display.rs
vendored
@ -21,13 +21,13 @@ use core_foundation::base::{CFRetain, TCFType};
|
||||
use image::CGImage;
|
||||
use foreign_types::ForeignType;
|
||||
|
||||
pub type CGDirectDisplayID = libc::uint32_t;
|
||||
pub type CGWindowID = libc::uint32_t;
|
||||
pub type CGDirectDisplayID = u32;
|
||||
pub type CGWindowID = u32;
|
||||
|
||||
pub const kCGNullWindowID: CGWindowID = 0 as CGWindowID;
|
||||
pub const kCGNullDirectDisplayID: CGDirectDisplayID = 0 as CGDirectDisplayID;
|
||||
|
||||
|
||||
pub type CGWindowListOption = libc::uint32_t;
|
||||
pub type CGWindowListOption = u32;
|
||||
|
||||
pub const kCGWindowListOptionAll: CGWindowListOption = 0;
|
||||
pub const kCGWindowListOptionOnScreenOnly: CGWindowListOption = 1 << 0;
|
||||
@ -36,7 +36,7 @@ pub const kCGWindowListOptionOnScreenBelowWindow: CGWindowListOption = 1 << 2;
|
||||
pub const kCGWindowListOptionIncludingWindow: CGWindowListOption = 1 << 3;
|
||||
pub const kCGWindowListExcludeDesktopElements: CGWindowListOption = 1 << 4;
|
||||
|
||||
pub type CGWindowImageOption = libc::uint32_t;
|
||||
pub type CGWindowImageOption = u32;
|
||||
|
||||
pub const kCGWindowImageDefault: CGWindowImageOption = 0;
|
||||
pub const kCGWindowImageBoundsIgnoreFraming: CGWindowImageOption = 1 << 0;
|
||||
@ -123,6 +123,11 @@ impl CGDisplay {
|
||||
CGDisplay::new(unsafe { CGMainDisplayID() })
|
||||
}
|
||||
|
||||
/// A value that will never correspond to actual hardware.
|
||||
pub fn null_display() -> CGDisplay {
|
||||
CGDisplay::new(kCGNullDirectDisplayID)
|
||||
}
|
||||
|
||||
/// Returns the bounds of a display in the global display coordinate space.
|
||||
#[inline]
|
||||
pub fn bounds(&self) -> CGRect {
|
||||
@ -200,6 +205,37 @@ impl CGDisplay {
|
||||
}
|
||||
}
|
||||
|
||||
/// Configures the origin of a display in the global display coordinate space.
|
||||
pub fn configure_display_origin(
|
||||
&self,
|
||||
config_ref: &CGDisplayConfigRef,
|
||||
x: i32,
|
||||
y: i32,
|
||||
) -> Result<(), CGError> {
|
||||
let result = unsafe { CGConfigureDisplayOrigin(*config_ref, self.id, x, y) };
|
||||
|
||||
if result == 0 {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(result)
|
||||
}
|
||||
}
|
||||
|
||||
/// Changes the configuration of a mirroring set.
|
||||
pub fn configure_display_mirror_of_display(
|
||||
&self,
|
||||
config_ref: &CGDisplayConfigRef,
|
||||
master: &CGDisplay,
|
||||
) -> Result<(), CGError> {
|
||||
let result = unsafe { CGConfigureDisplayMirrorOfDisplay(*config_ref, self.id, master.id) };
|
||||
|
||||
if result == 0 {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(result)
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns an image containing the contents of the specified display.
|
||||
#[inline]
|
||||
pub fn image(&self) -> Option<CGImage> {
|
||||
@ -261,7 +297,7 @@ impl CGDisplay {
|
||||
) -> Option<CFArray> {
|
||||
let relative_to_window = relative_to_window.unwrap_or(kCGNullWindowID);
|
||||
let array_ref = unsafe { CGWindowListCopyWindowInfo(option, relative_to_window) };
|
||||
if array_ref != ptr::null() {
|
||||
if !array_ref.is_null() {
|
||||
Some(unsafe { TCFType::wrap_under_create_rule(array_ref) })
|
||||
} else {
|
||||
None
|
||||
@ -398,7 +434,7 @@ impl CGDisplay {
|
||||
/// Provides a list of displays that are active (or drawable).
|
||||
#[inline]
|
||||
pub fn active_displays() -> Result<Vec<CGDirectDisplayID>, CGError> {
|
||||
let count = try!(CGDisplay::active_display_count());
|
||||
let count = CGDisplay::active_display_count()?;
|
||||
let mut buf: Vec<CGDirectDisplayID> = vec![0; count as usize];
|
||||
let result =
|
||||
unsafe { CGGetActiveDisplayList(count as u32, buf.as_mut_ptr(), ptr::null_mut()) };
|
||||
@ -412,7 +448,7 @@ impl CGDisplay {
|
||||
/// Provides count of displays that are active (or drawable).
|
||||
#[inline]
|
||||
pub fn active_display_count() -> Result<u32, CGError> {
|
||||
let mut count: libc::uint32_t = 0;
|
||||
let mut count: u32 = 0;
|
||||
let result = unsafe { CGGetActiveDisplayList(0, ptr::null_mut(), &mut count) };
|
||||
if result == 0 {
|
||||
Ok(count as u32)
|
||||
@ -488,7 +524,7 @@ impl CGDisplayMode {
|
||||
) -> Option<Vec<CGDisplayMode>> {
|
||||
let array_opt: Option<CFArray> = unsafe {
|
||||
let array_ref = CGDisplayCopyAllDisplayModes(display_id, options);
|
||||
if array_ref != ptr::null() {
|
||||
if !array_ref.is_null() {
|
||||
Some(CFArray::wrap_under_create_rule(array_ref))
|
||||
} else {
|
||||
None
|
||||
@ -597,28 +633,28 @@ extern "C" {
|
||||
pub fn CGDisplayPrimaryDisplay(display: CGDirectDisplayID) -> CGDirectDisplayID;
|
||||
pub fn CGDisplayRotation(display: CGDirectDisplayID) -> libc::c_double;
|
||||
pub fn CGDisplayScreenSize(display: CGDirectDisplayID) -> CGSize;
|
||||
pub fn CGDisplaySerialNumber(display: CGDirectDisplayID) -> libc::uint32_t;
|
||||
pub fn CGDisplayUnitNumber(display: CGDirectDisplayID) -> libc::uint32_t;
|
||||
pub fn CGDisplaySerialNumber(display: CGDirectDisplayID) -> u32;
|
||||
pub fn CGDisplayUnitNumber(display: CGDirectDisplayID) -> u32;
|
||||
pub fn CGDisplayUsesOpenGLAcceleration(display: CGDirectDisplayID) -> boolean_t;
|
||||
pub fn CGDisplayVendorNumber(display: CGDirectDisplayID) -> libc::uint32_t;
|
||||
pub fn CGDisplayVendorNumber(display: CGDirectDisplayID) -> u32;
|
||||
pub fn CGGetActiveDisplayList(
|
||||
max_displays: libc::uint32_t,
|
||||
max_displays: u32,
|
||||
active_displays: *mut CGDirectDisplayID,
|
||||
display_count: *mut libc::uint32_t,
|
||||
display_count: *mut u32,
|
||||
) -> CGError;
|
||||
pub fn CGGetDisplaysWithRect(
|
||||
rect: CGRect,
|
||||
max_displays: libc::uint32_t,
|
||||
max_displays: u32,
|
||||
displays: *mut CGDirectDisplayID,
|
||||
matching_display_count: *mut libc::uint32_t,
|
||||
matching_display_count: *mut u32,
|
||||
) -> CGError;
|
||||
pub fn CGDisplayModelNumber(display: CGDirectDisplayID) -> libc::uint32_t;
|
||||
pub fn CGDisplayModelNumber(display: CGDirectDisplayID) -> u32;
|
||||
pub fn CGDisplayPixelsHigh(display: CGDirectDisplayID) -> libc::size_t;
|
||||
pub fn CGDisplayPixelsWide(display: CGDirectDisplayID) -> libc::size_t;
|
||||
pub fn CGDisplayBounds(display: CGDirectDisplayID) -> CGRect;
|
||||
pub fn CGDisplayCreateImage(display: CGDirectDisplayID) -> ::sys::CGImageRef;
|
||||
|
||||
pub fn CGBeginDisplayConfiguration(config: *const CGDisplayConfigRef) -> CGError;
|
||||
pub fn CGBeginDisplayConfiguration(config: *mut CGDisplayConfigRef) -> CGError;
|
||||
pub fn CGCancelDisplayConfiguration(config: CGDisplayConfigRef) -> CGError;
|
||||
pub fn CGCompleteDisplayConfiguration(
|
||||
config: CGDisplayConfigRef,
|
||||
@ -630,6 +666,17 @@ extern "C" {
|
||||
mode: ::sys::CGDisplayModeRef,
|
||||
options: CFDictionaryRef,
|
||||
) -> CGError;
|
||||
pub fn CGConfigureDisplayMirrorOfDisplay(
|
||||
config: CGDisplayConfigRef,
|
||||
display: CGDirectDisplayID,
|
||||
master: CGDirectDisplayID,
|
||||
) -> CGError;
|
||||
pub fn CGConfigureDisplayOrigin(
|
||||
config: CGDisplayConfigRef,
|
||||
display: CGDirectDisplayID,
|
||||
x: i32,
|
||||
y: i32,
|
||||
) -> CGError;
|
||||
|
||||
pub fn CGDisplayCopyDisplayMode(display: CGDirectDisplayID) -> ::sys::CGDisplayModeRef;
|
||||
pub fn CGDisplayModeGetHeight(mode: ::sys::CGDisplayModeRef) -> libc::size_t;
|
||||
@ -637,7 +684,7 @@ extern "C" {
|
||||
pub fn CGDisplayModeGetPixelHeight(mode: ::sys::CGDisplayModeRef) -> libc::size_t;
|
||||
pub fn CGDisplayModeGetPixelWidth(mode: ::sys::CGDisplayModeRef) -> libc::size_t;
|
||||
pub fn CGDisplayModeGetRefreshRate(mode: ::sys::CGDisplayModeRef) -> libc::c_double;
|
||||
pub fn CGDisplayModeGetIOFlags(mode: ::sys::CGDisplayModeRef) -> libc::uint32_t;
|
||||
pub fn CGDisplayModeGetIOFlags(mode: ::sys::CGDisplayModeRef) -> u32;
|
||||
pub fn CGDisplayModeCopyPixelEncoding(mode: ::sys::CGDisplayModeRef) -> CFStringRef;
|
||||
|
||||
pub fn CGDisplayCopyAllDisplayModes(
|
||||
|
16
third_party/rust/core-graphics/src/event.rs
vendored
16
third_party/rust/core-graphics/src/event.rs
vendored
@ -8,9 +8,9 @@ use libc;
|
||||
|
||||
use foreign_types::ForeignType;
|
||||
|
||||
pub type CGEventField = libc::uint32_t;
|
||||
pub type CGKeyCode = libc::uint16_t;
|
||||
pub type CGScrollEventUnit = libc::uint32_t;
|
||||
pub type CGEventField = u32;
|
||||
pub type CGKeyCode = u16;
|
||||
pub type CGScrollEventUnit = u32;
|
||||
|
||||
/// Flags for events
|
||||
///
|
||||
@ -105,7 +105,7 @@ impl ScrollEventUnit {
|
||||
/// Constants that specify the different types of input events.
|
||||
///
|
||||
/// [Ref](http://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-700/IOHIDSystem/IOKit/hidsystem/IOLLEvent.h)
|
||||
#[repr(C)]
|
||||
#[repr(u32)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum CGEventType {
|
||||
Null = 0,
|
||||
@ -589,10 +589,10 @@ extern {
|
||||
fn CGEventCreateScrollWheelEvent2(
|
||||
source: ::sys::CGEventSourceRef,
|
||||
units: CGScrollEventUnit,
|
||||
wheelCount: libc::uint32_t,
|
||||
wheel1: libc::int32_t,
|
||||
wheel2: libc::int32_t,
|
||||
wheel3: libc::int32_t,
|
||||
wheelCount: u32,
|
||||
wheel1: i32,
|
||||
wheel2: i32,
|
||||
wheel3: i32,
|
||||
) -> ::sys::CGEventRef;
|
||||
|
||||
/// Post an event into the event stream at a specified location.
|
||||
|
3
third_party/rust/core-graphics/src/font.rs
vendored
3
third_party/rust/core-graphics/src/font.rs
vendored
@ -7,7 +7,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::ptr;
|
||||
use core_foundation::base::{CFRelease, CFRetain, CFTypeID, TCFType};
|
||||
use core_foundation::array::{CFArray, CFArrayRef};
|
||||
use core_foundation::data::{CFData, CFDataRef};
|
||||
@ -117,7 +116,7 @@ impl CGFont {
|
||||
|
||||
pub fn copy_table_for_tag(&self, tag: u32) -> Option<CFData> {
|
||||
let data_ref = unsafe { CGFontCopyTableForTag(self.as_ptr(), tag) };
|
||||
if data_ref != ptr::null() {
|
||||
if !data_ref.is_null() {
|
||||
Some(unsafe { TCFType::wrap_under_create_rule(data_ref) })
|
||||
} else {
|
||||
None
|
||||
|
15
third_party/rust/core-graphics/src/geometry.rs
vendored
15
third_party/rust/core-graphics/src/geometry.rs
vendored
@ -33,7 +33,7 @@ pub const CG_AFFINE_TRANSFORM_IDENTITY: CGAffineTransform = CGAffineTransform {
|
||||
};
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||
pub struct CGSize {
|
||||
pub width: CGFloat,
|
||||
pub height: CGFloat,
|
||||
@ -57,7 +57,7 @@ impl CGSize {
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||
pub struct CGPoint {
|
||||
pub x: CGFloat,
|
||||
pub y: CGFloat,
|
||||
@ -181,6 +181,15 @@ impl CGAffineTransform {
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for CGAffineTransform {
|
||||
#[inline]
|
||||
fn eq(&self, other: &CGAffineTransform) -> bool {
|
||||
unsafe {
|
||||
ffi::CGAffineTransformEqualToTransform(*self, *other) != 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mod ffi {
|
||||
use base::{CGFloat, boolean_t};
|
||||
use geometry::{CGAffineTransform, CGPoint, CGRect, CGSize};
|
||||
@ -196,6 +205,8 @@ mod ffi {
|
||||
pub fn CGRectEqualToRect(rect1: CGRect, rect2: CGRect) -> boolean_t;
|
||||
|
||||
pub fn CGAffineTransformInvert(t: CGAffineTransform) -> CGAffineTransform;
|
||||
pub fn CGAffineTransformEqualToTransform(t1: CGAffineTransform,
|
||||
t2: CGAffineTransform) -> boolean_t;
|
||||
|
||||
pub fn CGPointApplyAffineTransform(point: CGPoint, t: CGAffineTransform) -> CGPoint;
|
||||
pub fn CGRectApplyAffineTransform(rect: CGRect, t: CGAffineTransform) -> CGRect;
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"73555748fd27f22bd31d4e17f95397ec4120e1a610b0d29333d750d8ecad228d","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"0c82015d302c9937e6376debd961350afeaeb6dde228aac95e3a3115c5813613","src/font.rs":"f4094760cf28ad8c99a5fa427702008d0638abbc1d0adc02bc7f874744ff00dd","src/font_collection.rs":"02de0ce2a61683314897a521d31ab9cc572a8b10ceda2ac47181fbe18bf4f235","src/font_descriptor.rs":"37b6af08ceaca9f15971ea009805bed00884294a035f152c617b43b333fdb471","src/font_manager.rs":"0abebafad90fc1cc74742493c812ec617a44a80969bab64807d6e32ae70033c0","src/lib.rs":"bd072cf53ebb643e4d21379d4487e60745999d20eab9caee8e56daa430cb65ca"},"package":"f3f46450d6f2397261af420b4ccce23807add2e45fa206410a03d66fb7f050ae"}
|
||||
{"files":{"COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"f45c41b63719e265b213500c162ffd643098b6d09b762a6f56ec4b9afab38c64","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"98d25015857a430aac32f34bdc979a1a66e672a0ea42c5f92dd9cfe23c1fccfd","src/font.rs":"aacf7a01fa8b4fe6fc598d08fcbec39cca368161806bcf8a68ca141115758638","src/font_collection.rs":"02de0ce2a61683314897a521d31ab9cc572a8b10ceda2ac47181fbe18bf4f235","src/font_descriptor.rs":"43910d733140861b8daf615b832d816a2e1a525af0a1c370c5e21dbaf5e42c65","src/font_manager.rs":"0abebafad90fc1cc74742493c812ec617a44a80969bab64807d6e32ae70033c0","src/frame.rs":"357691ef297a437ac88c2147312e3db0cb7f1c97c28bd6c22961b9931af961f6","src/framesetter.rs":"0f60f02dbb0673ec37914196b5c88f9533769e9015b5ec715b1bebd0b9d8d80c","src/lib.rs":"74646976f818f56abe5c68d67e7731080e2ca898ffd66f806625b92a8f3dd666","src/line.rs":"a53f2c36271eb9d0393af5e67ab4873b9326312f7c5af236bfe7145a109e1e24","src/run.rs":"9f127a6b6bde12f4e9ff6cf4524c1813d565dfbfe52c81d6e709792bdaf7fb17","src/string_attributes.rs":"ea0f854d64097d3626a03002323e2276e28affae7a698aaadd89dd6b744dd80f"},"package":"131b3fd1f8bd5db9f2b398fa4fdb6008c64afc04d447c306ac2c7e98fba2a61d"}
|
8
third_party/rust/core-text/Cargo.toml
vendored
8
third_party/rust/core-text/Cargo.toml
vendored
@ -3,7 +3,7 @@
|
||||
# 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
|
||||
# to registry (e.g., crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
@ -12,16 +12,16 @@
|
||||
|
||||
[package]
|
||||
name = "core-text"
|
||||
version = "13.0.0"
|
||||
version = "15.0.0"
|
||||
authors = ["The Servo Project Developers"]
|
||||
description = "Bindings to the Core Text framework."
|
||||
license = "MIT/Apache-2.0"
|
||||
repository = "https://github.com/servo/core-foundation-rs"
|
||||
[dependencies.core-foundation]
|
||||
version = "0.6"
|
||||
version = "0.7"
|
||||
|
||||
[dependencies.core-graphics]
|
||||
version = "0.17"
|
||||
version = "0.19"
|
||||
|
||||
[dependencies.foreign-types]
|
||||
version = "0.3"
|
||||
|
2
third_party/rust/core-text/README.md
vendored
2
third_party/rust/core-text/README.md
vendored
@ -1,3 +1,3 @@
|
||||
# core-text-rs
|
||||
|
||||
[![Build Status](https://travis-ci.org/servo/core-text-rs.svg?branch=master)](https://travis-ci.org/servo/core-text-rs)
|
||||
[![Build Status](https://travis-ci.com/servo/core-text-rs.svg?branch=master)](https://travis-ci.com/servo/core-text-rs)
|
||||
|
27
third_party/rust/core-text/src/font.rs
vendored
27
third_party/rust/core-text/src/font.rs
vendored
@ -88,6 +88,9 @@ declare_TCFType! {
|
||||
impl_TCFType!(CTFont, CTFontRef, CTFontGetTypeID);
|
||||
impl_CFTypeDescription!(CTFont);
|
||||
|
||||
unsafe impl Send for CTFont {}
|
||||
unsafe impl Sync for CTFont {}
|
||||
|
||||
pub fn new_from_CGFont(cgfont: &CGFont, pt_size: f64) -> CTFont {
|
||||
unsafe {
|
||||
let font_ref = CTFontCreateWithGraphicsFont(cgfont.as_ptr() as *mut _,
|
||||
@ -297,6 +300,13 @@ impl CTFont {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_glyph_with_name(&self, glyph_name: &str) -> CGGlyph {
|
||||
let glyph_name = CFString::new(glyph_name);
|
||||
unsafe {
|
||||
CTFontGetGlyphWithName(self.0, glyph_name.as_concrete_TypeRef())
|
||||
}
|
||||
}
|
||||
|
||||
pub unsafe fn get_glyphs_for_characters(&self,
|
||||
characters: *const UniChar,
|
||||
glyphs: *mut CGGlyph,
|
||||
@ -339,6 +349,17 @@ impl CTFont {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_available_font_tables(&self) -> Option<CFArray<CTFontTableTag>> {
|
||||
unsafe {
|
||||
let result = CTFontCopyAvailableTables(self.0, kCTFontTableOptionsExcludeSynthetic);
|
||||
if result.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(TCFType::wrap_under_create_rule(result))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_bounding_rects_for_glyphs(&self, orientation: CTFontOrientation, glyphs: &[CGGlyph])
|
||||
-> CGRect {
|
||||
unsafe {
|
||||
@ -351,7 +372,7 @@ impl CTFont {
|
||||
}
|
||||
|
||||
pub fn draw_glyphs(&self, glyphs: &[CGGlyph], positions: &[CGPoint], context: CGContext) {
|
||||
assert!(glyphs.len() == positions.len());
|
||||
assert_eq!(glyphs.len(), positions.len());
|
||||
unsafe {
|
||||
CTFontDrawGlyphs(self.as_concrete_TypeRef(),
|
||||
glyphs.as_ptr(),
|
||||
@ -558,7 +579,7 @@ extern {
|
||||
/* Getting Glyph Data */
|
||||
fn CTFontCreatePathForGlyph(font: CTFontRef, glyph: CGGlyph, matrix: *const CGAffineTransform)
|
||||
-> CGPathRef;
|
||||
//fn CTFontGetGlyphWithName
|
||||
fn CTFontGetGlyphWithName(font: CTFontRef, glyphName: CFStringRef) -> CGGlyph;
|
||||
fn CTFontGetBoundingRectsForGlyphs(font: CTFontRef,
|
||||
orientation: CTFontOrientation,
|
||||
glyphs: *const CGGlyph,
|
||||
@ -605,7 +626,7 @@ extern {
|
||||
//fn CTFontCreateWithQuickdrawInstance
|
||||
|
||||
/* Getting Font Table Data */
|
||||
//fn CTFontCopyAvailableTables(font: CTFontRef, options: CTFontTableOptions) -> CFArrayRef;
|
||||
fn CTFontCopyAvailableTables(font: CTFontRef, options: CTFontTableOptions) -> CFArrayRef;
|
||||
fn CTFontCopyTable(font: CTFontRef, table: CTFontTableTag, options: CTFontTableOptions) -> CFDataRef;
|
||||
|
||||
fn CTFontGetTypeID() -> CFTypeID;
|
||||
|
@ -15,11 +15,10 @@ use core_foundation::dictionary::{CFDictionary, CFDictionaryRef};
|
||||
use core_foundation::number::{CFNumber, CFNumberRef};
|
||||
use core_foundation::set::CFSetRef;
|
||||
use core_foundation::string::{CFString, CFStringRef};
|
||||
use core_foundation::url::CFURL;
|
||||
use core_foundation::url::{CFURL, CFURLRef};
|
||||
use core_graphics::base::CGFloat;
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use std::mem;
|
||||
use std::path::PathBuf;
|
||||
|
||||
/*
|
||||
@ -206,7 +205,7 @@ impl CTFontDescriptor {
|
||||
|
||||
let value = CFType::wrap_under_create_rule(value);
|
||||
assert!(value.instance_of::<CFString>());
|
||||
let s = CFString::wrap_under_get_rule(mem::transmute(value.as_CFTypeRef()));
|
||||
let s = CFString::wrap_under_get_rule(value.as_CFTypeRef() as CFStringRef);
|
||||
Some(s.to_string())
|
||||
}
|
||||
}
|
||||
@ -242,6 +241,20 @@ impl CTFontDescriptor {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn font_format(&self) -> Option<CTFontFormat> {
|
||||
unsafe {
|
||||
let value = CTFontDescriptorCopyAttribute(self.0, kCTFontFormatAttribute);
|
||||
if value.is_null() {
|
||||
return None;
|
||||
}
|
||||
|
||||
let value = CFType::wrap_under_create_rule(value);
|
||||
assert!(value.instance_of::<CFNumber>());
|
||||
let format = CFNumber::wrap_under_get_rule(value.as_CFTypeRef() as CFNumberRef);
|
||||
format.to_i32().map(|x| x as CTFontFormat)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn font_path(&self) -> Option<PathBuf> {
|
||||
unsafe {
|
||||
let value = CTFontDescriptorCopyAttribute(self.0, kCTFontURLAttribute);
|
||||
@ -251,7 +264,7 @@ impl CTFontDescriptor {
|
||||
|
||||
let value = CFType::wrap_under_create_rule(value);
|
||||
assert!(value.instance_of::<CFURL>());
|
||||
let url = CFURL::wrap_under_get_rule(mem::transmute(value.as_CFTypeRef()));
|
||||
let url = CFURL::wrap_under_get_rule(value.as_CFTypeRef() as CFURLRef);
|
||||
url.to_path()
|
||||
}
|
||||
}
|
||||
@ -262,7 +275,7 @@ impl CTFontDescriptor {
|
||||
assert!(!value.is_null());
|
||||
let value = CFType::wrap_under_create_rule(value);
|
||||
assert!(value.instance_of::<CFDictionary>());
|
||||
CFDictionary::wrap_under_get_rule(mem::transmute(value.as_CFTypeRef()))
|
||||
CFDictionary::wrap_under_get_rule(value.as_CFTypeRef() as CFDictionaryRef)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
38
third_party/rust/core-text/src/frame.rs
vendored
Normal file
38
third_party/rust/core-text/src/frame.rs
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core_foundation::base::{CFTypeID, TCFType};
|
||||
use core_graphics::context::{CGContext, CGContextRef};
|
||||
use foreign_types::{ForeignType, ForeignTypeRef};
|
||||
|
||||
#[repr(C)]
|
||||
pub struct __CTFrame(c_void);
|
||||
|
||||
pub type CTFrameRef = *const __CTFrame;
|
||||
|
||||
declare_TCFType! {
|
||||
CTFrame, CTFrameRef
|
||||
}
|
||||
impl_TCFType!(CTFrame, CTFrameRef, CTFrameGetTypeID);
|
||||
impl_CFTypeDescription!(CTFrame);
|
||||
|
||||
impl CTFrame {
|
||||
pub fn draw(&self, context: &CGContextRef) {
|
||||
unsafe {
|
||||
CTFrameDraw(self.as_concrete_TypeRef(), context.as_ptr());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "CoreText", kind = "framework")]
|
||||
extern {
|
||||
fn CTFrameGetTypeID() -> CFTypeID;
|
||||
fn CTFrameDraw(frame: CTFrameRef, context: *mut <CGContext as ForeignType>::CType);
|
||||
}
|
57
third_party/rust/core-text/src/framesetter.rs
vendored
Normal file
57
third_party/rust/core-text/src/framesetter.rs
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core_foundation::attributed_string::CFAttributedStringRef;
|
||||
use core_foundation::base::{CFRange, CFTypeID, TCFType};
|
||||
use core_graphics::path::{CGPath, CGPathRef};
|
||||
use foreign_types::{ForeignType, ForeignTypeRef};
|
||||
use std::ptr::null;
|
||||
use super::frame::{CTFrameRef, CTFrame};
|
||||
|
||||
#[repr(C)]
|
||||
pub struct __CTFramesetter(c_void);
|
||||
|
||||
pub type CTFramesetterRef = *const __CTFramesetter;
|
||||
|
||||
declare_TCFType! {
|
||||
CTFramesetter, CTFramesetterRef
|
||||
}
|
||||
impl_TCFType!(CTFramesetter, CTFramesetterRef, CTFramesetterGetTypeID);
|
||||
impl_CFTypeDescription!(CTFramesetter);
|
||||
|
||||
impl CTFramesetter {
|
||||
pub fn new_with_attributed_string(string: CFAttributedStringRef) -> Self {
|
||||
unsafe {
|
||||
let ptr = CTFramesetterCreateWithAttributedString(string);
|
||||
CTFramesetter::wrap_under_create_rule(ptr)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn create_frame(&self, string_range: CFRange, path: &CGPathRef) -> CTFrame {
|
||||
unsafe {
|
||||
let ptr = CTFramesetterCreateFrame(
|
||||
self.as_concrete_TypeRef(), string_range, path.as_ptr(), null());
|
||||
|
||||
CTFrame::wrap_under_create_rule(ptr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "CoreText", kind = "framework")]
|
||||
extern {
|
||||
fn CTFramesetterGetTypeID() -> CFTypeID;
|
||||
fn CTFramesetterCreateWithAttributedString(string: CFAttributedStringRef) -> CTFramesetterRef;
|
||||
fn CTFramesetterCreateFrame(
|
||||
framesetter: CTFramesetterRef,
|
||||
string_range: CFRange,
|
||||
path: *mut <CGPath as ForeignType>::CType,
|
||||
attributes: *const c_void,
|
||||
) -> CTFrameRef;
|
||||
}
|
5
third_party/rust/core-text/src/lib.rs
vendored
5
third_party/rust/core-text/src/lib.rs
vendored
@ -23,3 +23,8 @@ pub mod font;
|
||||
pub mod font_collection;
|
||||
pub mod font_descriptor;
|
||||
pub mod font_manager;
|
||||
pub mod frame;
|
||||
pub mod framesetter;
|
||||
pub mod line;
|
||||
pub mod run;
|
||||
pub mod string_attributes;
|
||||
|
47
third_party/rust/core-text/src/line.rs
vendored
Normal file
47
third_party/rust/core-text/src/line.rs
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::os::raw::c_void;
|
||||
use core_foundation::attributed_string::CFAttributedStringRef;
|
||||
use core_foundation::array::{CFArray, CFArrayRef};
|
||||
use core_foundation::base::{CFTypeID, TCFType};
|
||||
use run::CTRun;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct __CTLine(c_void);
|
||||
|
||||
pub type CTLineRef = *const __CTLine;
|
||||
|
||||
declare_TCFType! {
|
||||
CTLine, CTLineRef
|
||||
}
|
||||
impl_TCFType!(CTLine, CTLineRef, CTLineGetTypeID);
|
||||
impl_CFTypeDescription!(CTLine);
|
||||
|
||||
impl CTLine {
|
||||
pub fn new_with_attributed_string(string: CFAttributedStringRef) -> Self {
|
||||
unsafe {
|
||||
let ptr = CTLineCreateWithAttributedString(string);
|
||||
CTLine::wrap_under_create_rule(ptr)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn glyph_runs(&self) -> CFArray<CTRun> {
|
||||
unsafe {
|
||||
TCFType::wrap_under_get_rule(CTLineGetGlyphRuns(self.0))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "CoreText", kind = "framework")]
|
||||
extern {
|
||||
fn CTLineGetTypeID() -> CFTypeID;
|
||||
fn CTLineGetGlyphRuns(line: CTLineRef) -> CFArrayRef;
|
||||
fn CTLineCreateWithAttributedString(string: CFAttributedStringRef) -> CTLineRef;
|
||||
}
|
128
third_party/rust/core-text/src/run.rs
vendored
Normal file
128
third_party/rust/core-text/src/run.rs
vendored
Normal file
@ -0,0 +1,128 @@
|
||||
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::os::raw::c_void;
|
||||
use std::slice;
|
||||
use core_foundation::base::{CFIndex, CFTypeID, TCFType, CFType, CFRange};
|
||||
use core_foundation::dictionary::{CFDictionary, CFDictionaryRef};
|
||||
use core_foundation::string::CFString;
|
||||
use core_graphics::font::CGGlyph;
|
||||
use core_graphics::geometry::CGPoint;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct __CTRun(c_void);
|
||||
|
||||
pub type CTRunRef = *const __CTRun;
|
||||
|
||||
declare_TCFType! {
|
||||
CTRun, CTRunRef
|
||||
}
|
||||
impl_TCFType!(CTRun, CTRunRef, CTRunGetTypeID);
|
||||
impl_CFTypeDescription!(CTRun);
|
||||
|
||||
impl CTRun {
|
||||
pub fn attributes(&self) -> Option<CFDictionary<CFString, CFType>> {
|
||||
unsafe {
|
||||
let attrs = CTRunGetAttributes(self.0);
|
||||
if attrs.is_null() {
|
||||
return None;
|
||||
}
|
||||
Some(TCFType::wrap_under_get_rule(attrs))
|
||||
}
|
||||
}
|
||||
pub fn glyph_count(&self) -> CFIndex {
|
||||
unsafe {
|
||||
CTRunGetGlyphCount(self.0)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn glyphs(&self) -> Cow<[CGGlyph]> {
|
||||
unsafe {
|
||||
// CTRunGetGlyphsPtr can return null under some not understood circumstances.
|
||||
// If it does the Apple documentation tells us to allocate our own buffer and call
|
||||
// CTRunGetGlyphs
|
||||
let count = CTRunGetGlyphCount(self.0);
|
||||
let glyphs_ptr = CTRunGetGlyphsPtr(self.0);
|
||||
if !glyphs_ptr.is_null() {
|
||||
Cow::from(slice::from_raw_parts(glyphs_ptr, count as usize))
|
||||
} else {
|
||||
let mut vec = Vec::with_capacity(count as usize);
|
||||
// "If the length of the range is set to 0, then the copy operation will continue
|
||||
// from the start index of the range to the end of the run"
|
||||
CTRunGetGlyphs(self.0, CFRange::init(0, 0), vec.as_mut_ptr());
|
||||
vec.set_len(count as usize);
|
||||
Cow::from(vec)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn positions(&self) -> Cow<[CGPoint]> {
|
||||
unsafe {
|
||||
// CTRunGetPositionsPtr can return null under some not understood circumstances.
|
||||
// If it does the Apple documentation tells us to allocate our own buffer and call
|
||||
// CTRunGetPositions
|
||||
let count = CTRunGetGlyphCount(self.0);
|
||||
let positions_ptr = CTRunGetPositionsPtr(self.0);
|
||||
if !positions_ptr.is_null() {
|
||||
Cow::from(slice::from_raw_parts(positions_ptr, count as usize))
|
||||
} else {
|
||||
let mut vec = Vec::with_capacity(count as usize);
|
||||
// "If the length of the range is set to 0, then the copy operation will continue
|
||||
// from the start index of the range to the end of the run"
|
||||
CTRunGetPositions(self.0, CFRange::init(0, 0), vec.as_mut_ptr());
|
||||
vec.set_len(count as usize);
|
||||
Cow::from(vec)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn create_runs() {
|
||||
use core_foundation::attributed_string::CFMutableAttributedString;
|
||||
use string_attributes::*;
|
||||
use line::*;
|
||||
use font;
|
||||
let mut string = CFMutableAttributedString::new();
|
||||
string.replace_str(&CFString::new("Food"), CFRange::init(0, 0));
|
||||
let len = string.char_len();
|
||||
unsafe {
|
||||
string.set_attribute(CFRange::init(0, len), kCTFontAttributeName, font::new_from_name("Helvetica", 16.).unwrap());
|
||||
}
|
||||
let line = CTLine::new_with_attributed_string(string.as_concrete_TypeRef());
|
||||
let runs = line.glyph_runs();
|
||||
assert_eq!(runs.len(), 1);
|
||||
for run in runs.iter() {
|
||||
assert_eq!(run.glyph_count(), 4);
|
||||
let font = run.attributes().unwrap().get(CFString::new("NSFont")).downcast::<font::CTFont>().unwrap();
|
||||
assert_eq!(font.pt_size(), 16.);
|
||||
|
||||
let positions = run.positions();
|
||||
assert_eq!(positions.len(), 4);
|
||||
assert!(positions[0].x < positions[1].x);
|
||||
|
||||
let glyphs = run.glyphs();
|
||||
assert_eq!(glyphs.len(), 4);
|
||||
assert_ne!(glyphs[0], glyphs[1]);
|
||||
assert_eq!(glyphs[1], glyphs[2]);
|
||||
}
|
||||
}
|
||||
|
||||
#[link(name = "CoreText", kind = "framework")]
|
||||
extern {
|
||||
fn CTRunGetTypeID() -> CFTypeID;
|
||||
fn CTRunGetAttributes(run: CTRunRef) -> CFDictionaryRef;
|
||||
fn CTRunGetGlyphCount(run: CTRunRef) -> CFIndex;
|
||||
fn CTRunGetPositionsPtr(run: CTRunRef) -> *const CGPoint;
|
||||
fn CTRunGetPositions(run: CTRunRef, range: CFRange, buffer: *const CGPoint);
|
||||
fn CTRunGetGlyphsPtr(run: CTRunRef) -> *const CGGlyph;
|
||||
fn CTRunGetGlyphs(run: CTRunRef, range: CFRange, buffer: *const CGGlyph);
|
||||
}
|
19
third_party/rust/core-text/src/string_attributes.rs
vendored
Normal file
19
third_party/rust/core-text/src/string_attributes.rs
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
use core_foundation::string::CFStringRef;
|
||||
|
||||
extern {
|
||||
pub static kCTCharacterShapeAttributeName: CFStringRef;
|
||||
pub static kCTFontAttributeName: CFStringRef;
|
||||
pub static kCTKernAttributeName: CFStringRef;
|
||||
pub static kCTLigatureAttributeName: CFStringRef;
|
||||
pub static kCTForegroundColorAttributeName: CFStringRef;
|
||||
pub static kCTForegroundColorFromContextAttributeName: CFStringRef;
|
||||
pub static kCTParagraphStyleAttributeName: CFStringRef;
|
||||
pub static kCTStrokeWidthAttributeName: CFStringRef;
|
||||
pub static kCTStrokeColorAttributeName: CFStringRef;
|
||||
pub static kCTSuperscriptAttributeName: CFStringRef;
|
||||
pub static kCTUnderlineColorAttributeName: CFStringRef;
|
||||
pub static kCTUnderlineStyleAttributeName: CFStringRef;
|
||||
pub static kCTVerticalFormsAttributeName: CFStringRef;
|
||||
pub static kCTGlyphInfoAttributeName: CFStringRef;
|
||||
pub static kCTRunDelegateAttributeName: CFStringRef;
|
||||
}
|
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"35acbd2f8633a6109f3d3e554bef8d847c049ce6ef7a5f570468819e41344d7f","src/aggregate_device.rs":"7d2bd5f5fd7f3d008ebb69ad81f522ca0cb73db6d7b3e50ed1a63ea26ff721f4","src/audio_object.rs":"df10160d9fd83a2c23a49e69b78d39db3a9d6389607df6acfc05821293b6af5f","src/audio_unit.rs":"d783878930df4923b57ad230138c0f3fd6b0b9bb80a39725092ff4c6615162d8","src/cf_mutable_dict.rs":"fc42edd270c6dfb02f123214d2d8e487bbd62b5bd923b71eec13190fd0104d2a","src/dispatch.rs":"0f4b05076bf4ce8e9ce2a98c65149fcdd716b772a7ab111f37f9d12678552e1e","src/lib.rs":"bcc559d69ef6ed0cbea5b2a36fec89d8c011eb9da70e2f26c00f881ad97a2546","src/string.rs":"28f88b816c768bcfcc674a60d962b93f1c94e5e0f4cc8ed2a1301138b91039e7"},"package":null}
|
||||
{"files":{"Cargo.toml":"687cac990359786f1ee9d82e5c89963fb0a137ba5720cdcb85bac2e2e4aa0b17","src/aggregate_device.rs":"7d2bd5f5fd7f3d008ebb69ad81f522ca0cb73db6d7b3e50ed1a63ea26ff721f4","src/audio_object.rs":"df10160d9fd83a2c23a49e69b78d39db3a9d6389607df6acfc05821293b6af5f","src/audio_unit.rs":"d783878930df4923b57ad230138c0f3fd6b0b9bb80a39725092ff4c6615162d8","src/cf_mutable_dict.rs":"fc42edd270c6dfb02f123214d2d8e487bbd62b5bd923b71eec13190fd0104d2a","src/dispatch.rs":"0f4b05076bf4ce8e9ce2a98c65149fcdd716b772a7ab111f37f9d12678552e1e","src/lib.rs":"bcc559d69ef6ed0cbea5b2a36fec89d8c011eb9da70e2f26c00f881ad97a2546","src/string.rs":"28f88b816c768bcfcc674a60d962b93f1c94e5e0f4cc8ed2a1301138b91039e7"},"package":null}
|
@ -6,7 +6,7 @@ edition = "2018"
|
||||
license = "ISC"
|
||||
|
||||
[dependencies]
|
||||
core-foundation-sys = { version = "0.6" }
|
||||
core-foundation-sys = { version = "0.7" }
|
||||
|
||||
[dependencies.coreaudio-sys]
|
||||
default-features = false
|
||||
|
@ -1 +1 @@
|
||||
{"files":{".editorconfig":"4e53b182bcc78b83d7e1b5c03efa14d22d4955c4ed2514d1ba4e99c1eb1a50ba",".githooks/pre-push":"8b8b26544cd56f54c0c33812551f786bb25cb08c86dbfeb6bf3daad881c826a1",".travis.yml":"dc07bac53f70f16c9bdf52264bdc58500ae6018c1b4c567bc7642f6b4ca3cc35","Cargo.toml":"502a60129a9416424a8d1581a986caf87bdec5bca8085eb8b31aa45c445a472c","LICENSE":"6e6f56aff5bbf3cbc60747e152fb1a719bd0716aaf6d711c554f57d92e96297c","README.md":"7ad20571c123054867aa4b924dce75baaee478cb1386d66f2ddb323c44f7d195","install_git_hook.sh":"d38c8e51e636f6b90b489621ac34ccd1d1b1f40dccce3d178ed1da1c5068f16d","install_rustfmt_clippy.sh":"4ae90d8dcb9757cb3ae4ae142ef80e5377c0dde61c63f4a3c32418646e80ca7b","run_device_tests.sh":"4b7d65eb638c1a278ffc8ecb6d30d47b3b8405392e976cae38c6f744e2bed532","run_sanitizers.sh":"2f0934ba01cbcd74485f19d50147f6b604cf9730bbd3a3d3f3d958e40d0f799f","run_tests.sh":"ae341fc9cbd700699b838331e5c7792d6120fc771b612e9473a87f5d7900174e","src/backend/aggregate_device.rs":"ae21129aa6b3c7bd3376751b6a94d1ebe6c9f7afcd1db3107fb4d703d04da6b3","src/backend/auto_release.rs":"050fdcee74cf46b9a8a85a877e166d72a853d33220f59cf734cbb6ea09daa441","src/backend/buffer_manager.rs":"ef5214f6e7e306c20eef86718ad02a522fb805a1cbc83a292e4aebf714d37c5d","src/backend/device_property.rs":"d43642ea6e5f40e29c2a59ec7d81b42c154134685e417585045785359aa31686","src/backend/mixer.rs":"0c237bd5ca63b028c4b22ddc5bc026d7e21c0fa9b4e337f00b6131ed0a0806a5","src/backend/mod.rs":"b6ff0d6eea8ba71cffec41d28a653d109789d8d0e6bc3a739689a180d6767268","src/backend/resampler.rs":"fd1281d28a4db1659d2f75e43b8457651745e1b6eb5a53a77f04d752135f6dc7","src/backend/tests/aggregate_device.rs":"107f5c637844cd5ae43d2b42cec4ef3369bb702751586078c0a9d50f039161cd","src/backend/tests/api.rs":"839bc8d082b0c07e382c62a23eee889ecc4161bd3fb3d324d58183ea5e1ad975","src/backend/tests/backlog.rs":"3b189a7e036543c467cc242af0ed3332721179ee2b1c8847a6db563546f1ac52","src/backend/tests/device_change.rs":"8261f561f69dabd374ac47d69aa484812b65070a9e9581dfb2605e8404eaad6d","src/backend/tests/device_property.rs":"373f76d3bee83b263db3f02be3b94b408bdf852d84e4b5153273fda34b11a374","src/backend/tests/interfaces.rs":"14943e84a79976a7ef52882edeb9330350705d5190db6647f98b4ffa851a8396","src/backend/tests/manual.rs":"dc707836dab31f83d4b325afbc4dc4c8104ac8036e87f59ade3309ee83fe2d3f","src/backend/tests/mod.rs":"8dba770023d7f9c4228f0e11915347f0e07da5fd818e3ee4478c4b197af9aa2a","src/backend/tests/parallel.rs":"f9e1883660d6146b6e5075806561f5f689810e25c5e7764dfd28c9b939821a49","src/backend/tests/tone.rs":"16150438317ce501986734167b5fb97bfec567228acbcd8f3b4c4484c22f29e0","src/backend/tests/utils.rs":"1bb99ef71d3c18545bca49767e7b6bfffbe11896246994f41be7ed372772fd48","src/backend/utils.rs":"5ce1b753af0ffb654b6b2038d649aea88eebd27390a607a6d5988a9e40a4a717","src/capi.rs":"21b66b70545bf04ec719928004d1d9adb45b24ced51288f5b2993d79aaf78f5f","src/lib.rs":"5e586d45cd6b3722f0a6736d9252593299269817a153eef1930a5fb9bfbb56f5","todo.md":"29545b4d9c516396f82bd392797e2713d4602036eaba0f151b384af764f8515f"},"package":null}
|
||||
{"files":{".editorconfig":"4e53b182bcc78b83d7e1b5c03efa14d22d4955c4ed2514d1ba4e99c1eb1a50ba",".githooks/pre-push":"8b8b26544cd56f54c0c33812551f786bb25cb08c86dbfeb6bf3daad881c826a1",".travis.yml":"dc07bac53f70f16c9bdf52264bdc58500ae6018c1b4c567bc7642f6b4ca3cc35","Cargo.toml":"502a60129a9416424a8d1581a986caf87bdec5bca8085eb8b31aa45c445a472c","LICENSE":"6e6f56aff5bbf3cbc60747e152fb1a719bd0716aaf6d711c554f57d92e96297c","README.md":"7ad20571c123054867aa4b924dce75baaee478cb1386d66f2ddb323c44f7d195","install_git_hook.sh":"d38c8e51e636f6b90b489621ac34ccd1d1b1f40dccce3d178ed1da1c5068f16d","install_rustfmt_clippy.sh":"4ae90d8dcb9757cb3ae4ae142ef80e5377c0dde61c63f4a3c32418646e80ca7b","run_device_tests.sh":"4b7d65eb638c1a278ffc8ecb6d30d47b3b8405392e976cae38c6f744e2bed532","run_sanitizers.sh":"2f0934ba01cbcd74485f19d50147f6b604cf9730bbd3a3d3f3d958e40d0f799f","run_tests.sh":"3dd76659f6dceeb0490dd92b355e113301ba0d0a8f034993a56f40e09edd25b2","src/backend/aggregate_device.rs":"ae21129aa6b3c7bd3376751b6a94d1ebe6c9f7afcd1db3107fb4d703d04da6b3","src/backend/auto_release.rs":"050fdcee74cf46b9a8a85a877e166d72a853d33220f59cf734cbb6ea09daa441","src/backend/buffer_manager.rs":"ef5214f6e7e306c20eef86718ad02a522fb805a1cbc83a292e4aebf714d37c5d","src/backend/device_property.rs":"d43642ea6e5f40e29c2a59ec7d81b42c154134685e417585045785359aa31686","src/backend/mixer.rs":"0c237bd5ca63b028c4b22ddc5bc026d7e21c0fa9b4e337f00b6131ed0a0806a5","src/backend/mod.rs":"56336497138a5bb24b1effc17b2ea00b4ddcb3aa12aab9866c2a15a2bd788c96","src/backend/resampler.rs":"fd1281d28a4db1659d2f75e43b8457651745e1b6eb5a53a77f04d752135f6dc7","src/backend/tests/aggregate_device.rs":"107f5c637844cd5ae43d2b42cec4ef3369bb702751586078c0a9d50f039161cd","src/backend/tests/api.rs":"839bc8d082b0c07e382c62a23eee889ecc4161bd3fb3d324d58183ea5e1ad975","src/backend/tests/backlog.rs":"3b189a7e036543c467cc242af0ed3332721179ee2b1c8847a6db563546f1ac52","src/backend/tests/device_change.rs":"8261f561f69dabd374ac47d69aa484812b65070a9e9581dfb2605e8404eaad6d","src/backend/tests/device_property.rs":"373f76d3bee83b263db3f02be3b94b408bdf852d84e4b5153273fda34b11a374","src/backend/tests/interfaces.rs":"14943e84a79976a7ef52882edeb9330350705d5190db6647f98b4ffa851a8396","src/backend/tests/manual.rs":"dc707836dab31f83d4b325afbc4dc4c8104ac8036e87f59ade3309ee83fe2d3f","src/backend/tests/mod.rs":"8dba770023d7f9c4228f0e11915347f0e07da5fd818e3ee4478c4b197af9aa2a","src/backend/tests/parallel.rs":"f9e1883660d6146b6e5075806561f5f689810e25c5e7764dfd28c9b939821a49","src/backend/tests/tone.rs":"16150438317ce501986734167b5fb97bfec567228acbcd8f3b4c4484c22f29e0","src/backend/tests/utils.rs":"1bb99ef71d3c18545bca49767e7b6bfffbe11896246994f41be7ed372772fd48","src/backend/utils.rs":"5ce1b753af0ffb654b6b2038d649aea88eebd27390a607a6d5988a9e40a4a717","src/capi.rs":"21b66b70545bf04ec719928004d1d9adb45b24ced51288f5b2993d79aaf78f5f","src/lib.rs":"5e586d45cd6b3722f0a6736d9252593299269817a153eef1930a5fb9bfbb56f5","todo.md":"7323051fa7f0c51eb2eb0d495dcd951502e4cc8ce0088e6e7b3b3a95180f43d4"},"package":null}
|
31
third_party/rust/cubeb-coreaudio/run_tests.sh
vendored
31
third_party/rust/cubeb-coreaudio/run_tests.sh
vendored
@ -1,3 +1,4 @@
|
||||
# Bail out once getting an error.
|
||||
set -e
|
||||
|
||||
echo "\n\nTest suite for cubeb-coreaudio\n========================================"
|
||||
@ -8,28 +9,6 @@ if [[ -z "${RUST_BACKTRACE}" ]]; then
|
||||
fi
|
||||
echo "RUST_BACKTRACE is set to ${RUST_BACKTRACE}\n"
|
||||
|
||||
format_check() {
|
||||
cargo fmt --all -- --check
|
||||
local result=$?
|
||||
if [[ $result -ne 0 ]]; then
|
||||
echo "Please format the code with 'cargo fmt' (version $(cargo fmt -- --version))"
|
||||
fi
|
||||
return $result
|
||||
}
|
||||
|
||||
lints_check() {
|
||||
if [[ -n "$1" ]]; then
|
||||
cargo clippy -p $1 -- -D warnings
|
||||
else
|
||||
cargo clippy -- -D warnings
|
||||
fi
|
||||
local result=$?
|
||||
if [[ $result -ne 0 ]]; then
|
||||
echo "Please fix errors with 'cargo clippy' (version $(cargo clippy -- --version))"
|
||||
fi
|
||||
return $result
|
||||
}
|
||||
|
||||
# Run tests in the sub crate
|
||||
# Run the tests by `cargo * -p <SUB_CRATE>` if it's possible. By doing so, the duplicate compiling
|
||||
# between this crate and the <SUB_CRATE> can be saved. The compiling for <SUB_CRATE> can be reused
|
||||
@ -41,11 +20,11 @@ SUB_CRATE="coreaudio-sys-utils"
|
||||
# `cargo fmt -p *` is only usable in workspaces, so a workaround is to enter to the sub crate
|
||||
# and then exit from it.
|
||||
cd $SUB_CRATE
|
||||
format_check || exit $?
|
||||
cargo fmt --all -- --check
|
||||
cd ..
|
||||
|
||||
# Lints check
|
||||
(lints_check $SUB_CRATE) || exit $?
|
||||
cargo clippy -p $SUB_CRATE -- -D warnings
|
||||
|
||||
# Regular Tests
|
||||
cargo test -p $SUB_CRATE
|
||||
@ -53,10 +32,10 @@ cargo test -p $SUB_CRATE
|
||||
# Run tests in the main crate
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# Format check
|
||||
format_check || exit $?
|
||||
cargo fmt --all -- --check
|
||||
|
||||
# Lints check
|
||||
lints_check || exit $?
|
||||
cargo clippy -- -D warnings
|
||||
|
||||
# Regular Tests
|
||||
cargo test --verbose
|
||||
|
@ -606,7 +606,10 @@ extern "C" fn audiounit_output_callback(
|
||||
cubeb_log!("Dropping {} frames in input buffer.", popped_samples);
|
||||
}
|
||||
|
||||
if input_frames_needed > buffered_input_frames {
|
||||
if input_frames_needed > buffered_input_frames
|
||||
&& (stm.switching_device.load(Ordering::SeqCst)
|
||||
|| stm.frames_read.load(Ordering::SeqCst) == 0)
|
||||
{
|
||||
let silent_frames_to_push = input_frames_needed - buffered_input_frames;
|
||||
let silent_samples_to_push = silent_frames_to_push * input_channels;
|
||||
input_buffer_manager.push_silent_data(silent_samples_to_push);
|
||||
@ -617,19 +620,18 @@ extern "C" fn audiounit_output_callback(
|
||||
stm.core_stream_data.stm_ptr,
|
||||
if stm.frames_read.load(Ordering::SeqCst) == 0 {
|
||||
"input hasn't started,"
|
||||
} else if stm.switching_device.load(Ordering::SeqCst) {
|
||||
"device switching,"
|
||||
} else {
|
||||
"drop out,"
|
||||
assert!(stm.switching_device.load(Ordering::SeqCst));
|
||||
"device switching,"
|
||||
},
|
||||
silent_frames_to_push
|
||||
);
|
||||
}
|
||||
|
||||
let input_samples_needed = input_frames_needed * input_channels;
|
||||
let input_samples_needed = buffered_input_frames * input_channels;
|
||||
(
|
||||
input_buffer_manager.get_linear_data(input_samples_needed),
|
||||
input_frames_needed as i64,
|
||||
buffered_input_frames as i64,
|
||||
)
|
||||
} else {
|
||||
(ptr::null_mut::<c_void>(), 0)
|
||||
|
56
third_party/rust/cubeb-coreaudio/todo.md
vendored
56
third_party/rust/cubeb-coreaudio/todo.md
vendored
@ -1,6 +1,7 @@
|
||||
# TO DO
|
||||
|
||||
## General
|
||||
|
||||
- Some of bugs are found when adding tests. Search *FIXIT* to find them.
|
||||
- Remove `#[allow(non_camel_case_types)]`, `#![allow(unused_assignments)]`, `#![allow(unused_must_use)]`
|
||||
- Use `ErrorChain`
|
||||
@ -12,59 +13,71 @@
|
||||
- Use `Option<AggregateDevice>` rather than `AggregateDevice` for `aggregate_device` in `CoreStreamData`
|
||||
|
||||
### Type of stream
|
||||
|
||||
- Use `Option<device_info>` rather than `device_info` for `{input, output}_device` in `CoreStreamData`
|
||||
- Use `Option<StreamParams>` rather than `StreamParams` for `{input, output}_stream_params` in `CoreStreamData`
|
||||
- Same as `{input, output}_desc`, `{input, output}_hw_rate`, ...etc
|
||||
- It would much clearer if we have a `struct X` to wrap all the above stuff and use `input_x` and `output_x` in `CoreStreamData`
|
||||
|
||||
### Generics
|
||||
- Create a _generics_ for `input_linear_buffer`
|
||||
- Consider replacing `AutoArrayWrapper` by [`ringbuf`](https://github.com/agerasev/ringbuf)
|
||||
|
||||
## Separate the stream implementation from the interface
|
||||
|
||||
The goal is to separate the audio stream into two parts(modules).
|
||||
One is _inner_, the other is _outer_.
|
||||
|
||||
- The _outer_ stream implements the cubeb interface, based on the _inner_ stream.
|
||||
- The _inner_ stream implements the stream operations based on the _CoreAudio_ APIs.
|
||||
Now the _outer_ stream is named `AudioUnitStream`, the _inner_ stream is named `CoreStreamData`.
|
||||
|
||||
The problem now is that we don't have a clear boundry of the data ownership
|
||||
between the _outer_ stream and _inner_ stream. They access the data owned by the other.
|
||||
|
||||
- `audiounit_property_listener_callback` is tied to _outer_ stream
|
||||
but the event listeners are in _inner_ stream
|
||||
- `audiounit_input_callback`, `audiounit_output_callback` are registered by the _inner_ stream
|
||||
but the main logic are tied to _outer_ stream
|
||||
|
||||
### Callback separation
|
||||
|
||||
- Create static callbacks in _inner_ stream
|
||||
- Render _inner_ stream's callbacks to _outer_ stream's callbacks
|
||||
|
||||
### Reinitialization
|
||||
|
||||
If the _outer_ stream and the _inner_ stream are separate properly,
|
||||
when we need to reinitialize the stream, we can just drop the _inner_ stream
|
||||
and create a new one. It's easier than the current implementation.
|
||||
|
||||
## Aggregate device
|
||||
|
||||
### Usage policy
|
||||
|
||||
- [BMO 1563475][bmo1563475]: Only use _aggregate device_ when the mic is a input-only and the speaker is output-only device.
|
||||
- Test if we should do drift compensation.
|
||||
- Add a test for `should_use_aggregate_device`
|
||||
- Create a dummy stream and check
|
||||
- Check again after reinit
|
||||
- Input only: expect false
|
||||
- Output only: expect false
|
||||
- Duplex
|
||||
- Default input and output are different and they are mic-only and speaker-only: expect true
|
||||
- Otherwise: expect false
|
||||
- Create a dummy stream and check
|
||||
- Check again after reinit
|
||||
- Input only: expect false
|
||||
- Output only: expect false
|
||||
- Duplex
|
||||
- Default input and output are different and they are mic-only and speaker-only: expect true
|
||||
- Otherwise: expect false
|
||||
|
||||
[bmo1563475]: https://bugzilla.mozilla.org/show_bug.cgi?id=1563475#c4
|
||||
|
||||
### Get sub devices
|
||||
|
||||
- A better pattern for `AggregateDevice::get_sub_devices`
|
||||
|
||||
### Set sub devices
|
||||
|
||||
- We will add overlapping devices between `input_sub_devices` and `output_sub_devices`.
|
||||
- if they are same device
|
||||
- if either one of them or both of them are aggregate devices
|
||||
|
||||
### Setting master device
|
||||
|
||||
- We always set the master device to the first subdevice of the default output device
|
||||
but the output device (forming the aggregate device) may not be the default output device
|
||||
- Check if the first subdevice of the default output device is in the list of
|
||||
@ -72,39 +85,40 @@ and create a new one. It's easier than the current implementation.
|
||||
- Check the `name: CFStringRef` of the master device is not `NULL`
|
||||
|
||||
### Mixer
|
||||
|
||||
- Don't force output device to mono or stereo when the output device has one or two channel
|
||||
- unless the output devicv is _Bose QC35, mark 1 and 2_.
|
||||
- unless the output devicv is _Bose QC35, mark 1 and 2_.
|
||||
|
||||
## Interface to system types and APIs
|
||||
|
||||
- Check if we need `AudioDeviceID` and `AudioObjectID` at the same time
|
||||
- Create wrapper for `AudioObjectGetPropertyData(Size)` with _qualifier_ info
|
||||
- Create wrapper for `CF` related types
|
||||
- Create wrapper struct for `AudioObjectId`
|
||||
- Add `get_data`, `get_data_size`, `set_data`
|
||||
- Add `get_data`, `get_data_size`, `set_data`
|
||||
- Create wrapper struct for `AudioUnit`
|
||||
- Implement `get_data`, `set_data`
|
||||
- Implement `get_data`, `set_data`
|
||||
- Create wrapper for `audio_unit_{add, remove}_property_listener`, `audio_object_{add, remove}_property_listener` and their callbacks
|
||||
- Add/Remove listener with generic `*mut T` data, fire their callback with generic `*mut T` data
|
||||
|
||||
## Interface to other module
|
||||
- Create a binding layer for the `resampler`
|
||||
- Add/Remove listener with generic `*mut T` data, fire their callback with generic `*mut T` data
|
||||
|
||||
## [Cubeb Interface][cubeb-rs]
|
||||
|
||||
- Implement `From` trait for `enum cubeb_device_type` so we can use `devtype.into()` to get `ffi::CUBEB_DEVICE_TYPE_*`.
|
||||
- Implement `to_owned` in [`StreamParamsRef`][cubeb-rs-stmparamsref]
|
||||
- Check the passed parameters like what [cubeb.c][cubeb] does!
|
||||
- Check the input `StreamParams` parameters properly, or we will set a invalid format into `AudioUnit`.
|
||||
- For example, for a duplex stream, the format of the input stream and output stream should be same.
|
||||
- Check the input `StreamParams` parameters properly, or we will set a invalid format into `AudioUnit`.
|
||||
- For example, for a duplex stream, the format of the input stream and output stream should be same.
|
||||
Using different stream formats will cause memory corruption
|
||||
since our resampler assumes the types (_short_ or _float_) of input stream (buffer) and output stream (buffer) are same
|
||||
(The resampler will use the format of the input stream if it exists, otherwise it uses the format of the output stream).
|
||||
- In fact, we should check **all** the parameters properly so we can make sure we don't mess up the streams/devices settings!
|
||||
- In fact, we should check **all** the parameters properly so we can make sure we don't mess up the streams/devices settings!
|
||||
|
||||
[cubeb-rs]: https://github.com/djg/cubeb-rs "cubeb-rs"
|
||||
[cubeb-rs-stmparamsref]: https://github.com/djg/cubeb-rs/blob/78ed9459b8ac2ca50ea37bb72f8a06847eb8d379/cubeb-core/src/stream.rs#L61 "StreamParamsRef"
|
||||
|
||||
## Test
|
||||
|
||||
- Rewrite some tests under _cubeb/test/*_ in _Rust_ as part of the integration tests
|
||||
- Add tests for capturing/recording, output, duplex streams
|
||||
- Add tests for capturing/recording, output, duplex streams
|
||||
- Update the manual tests
|
||||
- Those tests are created in the middle of the development. Thay might be not outdated now.
|
||||
- Those tests are created in the middle of the development. Thay might be not outdated now.
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"59c2a87f5273f966fe55c9697ebbcaafd36ae8ada389db9e03a0346496f539af","README.md":"0b5008f38b9cf1bda9de72f8ca467c399404df0e75daf3b1e5796f4d1fd7568f","shaders/blit.metal":"b243873ac0d7ded37b199d17d1a7b53d5332b4a57bfa22f99dcf60273730be45","shaders/clear.metal":"796a612c1cb48e46fc94b7227feaab993d7ddeed293b69e9f09b2dd88e6a1189","shaders/fill.metal":"2642b5df62f8eb2246a442137d083010d2a3132110d9be4eb25b479123098d25","shaders/gfx_shaders.metallib":"d98a657dce490f62503b76f18f0bb76a183140a309e13b5bae446c268eac40b9","shaders/macros.h":"a4550ac7c180935c2edb57aa7a5f8442b53f1f3dc65df8cc800d0afb8289cdeb","src/command.rs":"a3c816d85e2648505d5b5c06b64aa12c4237d005b90fd6cca010cf346694d8a9","src/conversions.rs":"ab9daf8e97b7d28bea3b8e6773afc287b3441d148a1cc12822c646cdbba2a37f","src/device.rs":"833b5dc4cf42c29ca8e1c6eef92724ec0032f5da2ca97172bc0def1f16366a05","src/internal.rs":"922ff850465db0bd7aacf1a451f4c73752eb8310967683069bdd33c3024e938b","src/lib.rs":"f0402323cf08ec56419b1965550fb394c44da2e2939b9c83d3ed548e4cd3f2de","src/native.rs":"516229d72433df23296f11b1490278f080d5a90646e7961f0e928da036f7f28d","src/soft.rs":"795767c3756a95b5a1e3bf28d2d4ce3eb85fb358ef098a4fbe0af893509e3941","src/window.rs":"cebbe53f2fb45dbdfcf03ba18ca181fa966997665cec65ae1a1d77d0c193f20b"},"package":"8de5c71f18ba805c95b84d6c78c472ef44485a6fc46e3b49fe1e6739c8d7b0c0"}
|
||||
{"files":{"Cargo.toml":"9160602c7e183274efa52c346003522912cc285e7065a32a2f7fefc9de7c908e","README.md":"0b5008f38b9cf1bda9de72f8ca467c399404df0e75daf3b1e5796f4d1fd7568f","shaders/blit.metal":"b243873ac0d7ded37b199d17d1a7b53d5332b4a57bfa22f99dcf60273730be45","shaders/clear.metal":"796a612c1cb48e46fc94b7227feaab993d7ddeed293b69e9f09b2dd88e6a1189","shaders/fill.metal":"2642b5df62f8eb2246a442137d083010d2a3132110d9be4eb25b479123098d25","shaders/gfx-shaders-ios.metallib":"b93c70027cf196548eac31a3cf5f37947ee2b13655445bc03c68c8224dad9613","shaders/gfx-shaders-macos.metallib":"cc7e8a6ad0a0d99197bdd9c65939e3a4d9960fa8aa181467363aa3578d68af54","shaders/macros.h":"a4550ac7c180935c2edb57aa7a5f8442b53f1f3dc65df8cc800d0afb8289cdeb","src/command.rs":"06578d5f260ea9c440e81b7239f14a4a0216664a1afbc786a3df5f6687609484","src/conversions.rs":"ab9daf8e97b7d28bea3b8e6773afc287b3441d148a1cc12822c646cdbba2a37f","src/device.rs":"1d475ace1313b3c82a5f1e122ab7c818ca746f45d82ecd6e24932021cb743167","src/internal.rs":"93039ce3266f771c40d186f887f434bbef403e3deef02bc606b7a1a2f6031db1","src/lib.rs":"43bc34e00352819340e92b48516fa101fb1d20b2e6f8d275df9d0a0a31c95a49","src/native.rs":"516229d72433df23296f11b1490278f080d5a90646e7961f0e928da036f7f28d","src/soft.rs":"795767c3756a95b5a1e3bf28d2d4ce3eb85fb358ef098a4fbe0af893509e3941","src/window.rs":"cebbe53f2fb45dbdfcf03ba18ca181fa966997665cec65ae1a1d77d0c193f20b"},"package":"b19262dc17be65f2c5b5c72fe5199ab2017faf51f9e0e353c4a68b63a88f933b"}
|
@ -13,7 +13,7 @@
|
||||
[package]
|
||||
edition = "2018"
|
||||
name = "gfx-backend-metal"
|
||||
version = "0.4.0"
|
||||
version = "0.4.4"
|
||||
authors = ["The Gfx-rs Developers"]
|
||||
description = "Metal API backend for gfx-rs"
|
||||
homepage = "https://github.com/gfx-rs/gfx"
|
||||
@ -41,13 +41,13 @@ version = "1.0"
|
||||
version = "0.1"
|
||||
|
||||
[dependencies.cocoa]
|
||||
version = "0.19"
|
||||
version = "0.20"
|
||||
|
||||
[dependencies.copyless]
|
||||
version = "0.1.4"
|
||||
|
||||
[dependencies.core-graphics]
|
||||
version = "0.17"
|
||||
version = "0.19"
|
||||
|
||||
[dependencies.dispatch]
|
||||
version = "0.1"
|
||||
@ -67,7 +67,7 @@ version = "1"
|
||||
version = "0.4"
|
||||
|
||||
[dependencies.metal]
|
||||
version = "0.17"
|
||||
version = "0.18"
|
||||
features = ["private"]
|
||||
|
||||
[dependencies.objc]
|
||||
|
BIN
third_party/rust/gfx-backend-metal/shaders/gfx-shaders-ios.metallib
vendored
Normal file
BIN
third_party/rust/gfx-backend-metal/shaders/gfx-shaders-ios.metallib
vendored
Normal file
Binary file not shown.
BIN
third_party/rust/gfx-backend-metal/shaders/gfx-shaders-macos.metallib
vendored
Normal file
BIN
third_party/rust/gfx-backend-metal/shaders/gfx-shaders-macos.metallib
vendored
Normal file
Binary file not shown.
Binary file not shown.
@ -378,11 +378,12 @@ impl State {
|
||||
}
|
||||
}
|
||||
|
||||
fn make_render_commands(
|
||||
&self,
|
||||
aspects: Aspects,
|
||||
) -> impl Iterator<Item = soft::RenderCommand<&soft::Ref>> {
|
||||
// Apply previously bound values for this command buffer
|
||||
fn make_viewport_and_scissor_commands(
|
||||
&self
|
||||
) -> (
|
||||
Option<soft::RenderCommand<&soft::Ref>>,
|
||||
Option<soft::RenderCommand<&soft::Ref>>,
|
||||
) {
|
||||
let com_vp = self
|
||||
.viewport
|
||||
.as_ref()
|
||||
@ -390,6 +391,14 @@ impl State {
|
||||
let com_scissor = self
|
||||
.scissors
|
||||
.map(|sr| soft::RenderCommand::SetScissor(Self::clamp_scissor(sr, self.target_extent)));
|
||||
(com_vp, com_scissor)
|
||||
}
|
||||
|
||||
fn make_render_commands(
|
||||
&self,
|
||||
aspects: Aspects,
|
||||
) -> impl Iterator<Item = soft::RenderCommand<&soft::Ref>> {
|
||||
// Apply previously bound values for this command buffer
|
||||
let com_blend = if aspects.contains(Aspects::COLOR) {
|
||||
self.blend_color.map(soft::RenderCommand::SetBlendColor)
|
||||
} else {
|
||||
@ -409,6 +418,7 @@ impl State {
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let (com_vp, com_scissor) = self.make_viewport_and_scissor_commands();
|
||||
let (com_pso, com_rast) = self.make_pso_commands();
|
||||
|
||||
let render_resources = iter::once(&self.resources_vs).chain(iter::once(&self.resources_ps));
|
||||
@ -2976,6 +2986,7 @@ impl com::CommandBuffer<Backend> for CommandBuffer {
|
||||
}
|
||||
|
||||
// reset all the affected states
|
||||
let (com_viewport, com_scissor) = self.state.make_viewport_and_scissor_commands();
|
||||
let (com_pso, com_rast) = self.state.make_pso_commands();
|
||||
|
||||
let device_lock = &self.shared.device;
|
||||
@ -3015,6 +3026,8 @@ impl com::CommandBuffer<Backend> for CommandBuffer {
|
||||
let commands = com_pso
|
||||
.into_iter()
|
||||
.chain(com_rast)
|
||||
.chain(com_viewport)
|
||||
.chain(com_scissor)
|
||||
.chain(com_ds)
|
||||
.chain(com_vs)
|
||||
.chain(com_ps);
|
||||
|
18
third_party/rust/gfx-backend-metal/src/device.rs
vendored
18
third_party/rust/gfx-backend-metal/src/device.rs
vendored
@ -1442,7 +1442,7 @@ impl hal::device::Device<Backend> for Device {
|
||||
{
|
||||
let desc = pipeline
|
||||
.color_attachments()
|
||||
.object_at(i)
|
||||
.object_at(i as NSUInteger)
|
||||
.expect("too many color attachments");
|
||||
|
||||
desc.set_pixel_format(mtl_format);
|
||||
@ -1523,7 +1523,7 @@ impl hal::device::Device<Backend> for Device {
|
||||
// pass the refined data to Metal
|
||||
let mtl_attribute_desc = vertex_descriptor
|
||||
.attributes()
|
||||
.object_at(location as usize)
|
||||
.object_at(location as NSUInteger)
|
||||
.expect("too many vertex attributes");
|
||||
let mtl_vertex_format =
|
||||
conv::map_vertex_format(element.format).expect("unsupported vertex format");
|
||||
@ -1535,7 +1535,7 @@ impl hal::device::Device<Backend> for Device {
|
||||
for (i, (vb, _)) in vertex_buffers.iter().enumerate() {
|
||||
let mtl_buffer_desc = vertex_descriptor
|
||||
.layouts()
|
||||
.object_at(self.shared.private_caps.max_buffers_per_stage as usize - 1 - i)
|
||||
.object_at(self.shared.private_caps.max_buffers_per_stage as NSUInteger - 1 - i as NSUInteger)
|
||||
.expect("too many vertex descriptor layouts");
|
||||
if vb.stride % STRIDE_GRANULARITY != 0 {
|
||||
error!(
|
||||
@ -2125,12 +2125,12 @@ impl hal::device::Device<Backend> for Device {
|
||||
debug_assert!(!bindings[&write.binding]
|
||||
.content
|
||||
.contains(n::DescriptorContent::IMMUTABLE_SAMPLER));
|
||||
encoder.set_sampler_state(sampler.raw.as_ref().unwrap(), arg_index);
|
||||
encoder.set_sampler_state(arg_index, sampler.raw.as_ref().unwrap());
|
||||
arg_index += 1;
|
||||
}
|
||||
pso::Descriptor::Image(image, _layout) => {
|
||||
let tex_ref = image.texture.as_ref();
|
||||
encoder.set_texture(tex_ref, arg_index);
|
||||
encoder.set_texture(arg_index, tex_ref);
|
||||
data.ptr = (&**tex_ref).as_ptr();
|
||||
arg_index += 1;
|
||||
}
|
||||
@ -2149,26 +2149,26 @@ impl hal::device::Device<Backend> for Device {
|
||||
+ (binding.count as NSUInteger)
|
||||
);
|
||||
encoder.set_sampler_state(
|
||||
sampler.raw.as_ref().unwrap(),
|
||||
arg_index + binding.count as NSUInteger,
|
||||
sampler.raw.as_ref().unwrap(),
|
||||
);
|
||||
}
|
||||
let tex_ref = image.texture.as_ref();
|
||||
encoder.set_texture(tex_ref, arg_index);
|
||||
encoder.set_texture(arg_index, tex_ref);
|
||||
data.ptr = (&**tex_ref).as_ptr();
|
||||
}
|
||||
pso::Descriptor::UniformTexelBuffer(view)
|
||||
| pso::Descriptor::StorageTexelBuffer(view) => {
|
||||
encoder.set_texture(&view.raw, arg_index);
|
||||
encoder.set_texture(arg_index, &view.raw);
|
||||
data.ptr = (&**view.raw).as_ptr();
|
||||
arg_index += 1;
|
||||
}
|
||||
pso::Descriptor::Buffer(buffer, ref desc_range) => {
|
||||
let (buf_raw, buf_range) = buffer.as_bound();
|
||||
encoder.set_buffer(
|
||||
arg_index,
|
||||
buf_raw,
|
||||
buf_range.start + desc_range.start.unwrap_or(0),
|
||||
arg_index,
|
||||
);
|
||||
data.ptr = (&**buf_raw).as_ptr();
|
||||
arg_index += 1;
|
||||
|
@ -299,7 +299,7 @@ impl ImageClearPipes {
|
||||
for (i, &format) in key.color_formats.iter().enumerate() {
|
||||
pipeline
|
||||
.color_attachments()
|
||||
.object_at(i)
|
||||
.object_at(i as u64)
|
||||
.unwrap()
|
||||
.set_pixel_format(format);
|
||||
}
|
||||
@ -330,7 +330,7 @@ impl ImageClearPipes {
|
||||
for i in 0 .. 1 {
|
||||
let mtl_attribute_desc = vertex_descriptor
|
||||
.attributes()
|
||||
.object_at(i)
|
||||
.object_at(i as u64)
|
||||
.expect("too many vertex attributes");
|
||||
mtl_attribute_desc.set_buffer_index(0);
|
||||
mtl_attribute_desc.set_offset((i * mem::size_of::<[f32; 4]>()) as _);
|
||||
@ -426,7 +426,7 @@ impl ImageBlitPipes {
|
||||
for i in 0 .. 2 {
|
||||
let mtl_attribute_desc = vertex_descriptor
|
||||
.attributes()
|
||||
.object_at(i)
|
||||
.object_at(i as u64)
|
||||
.expect("too many vertex attributes");
|
||||
mtl_attribute_desc.set_buffer_index(0);
|
||||
mtl_attribute_desc.set_offset((i * mem::size_of::<[f32; 4]>()) as _);
|
||||
@ -451,7 +451,11 @@ pub struct ServicePipes {
|
||||
|
||||
impl ServicePipes {
|
||||
pub fn new(device: &metal::DeviceRef) -> Self {
|
||||
let data = include_bytes!("./../shaders/gfx_shaders.metallib");
|
||||
let data = if cfg!(target_os = "macos") {
|
||||
&include_bytes!("./../shaders/gfx-shaders-macos.metallib")[..]
|
||||
} else {
|
||||
&include_bytes!("./../shaders/gfx-shaders-ios.metallib")[..]
|
||||
};
|
||||
let library = device.new_library_with_data(data).unwrap();
|
||||
|
||||
let copy_buffer = Self::create_copy_buffer(&library, device);
|
||||
|
@ -757,7 +757,9 @@ impl PrivateCapabilities {
|
||||
os_is_mac,
|
||||
os_version: (major as u32, minor as u32),
|
||||
msl_version: if os_is_mac {
|
||||
if Self::version_at_least(major, minor, 10, 14) {
|
||||
if Self::version_at_least(major, minor, 10, 15) {
|
||||
MTLLanguageVersion::V2_2
|
||||
} else if Self::version_at_least(major, minor, 10, 14) {
|
||||
MTLLanguageVersion::V2_1
|
||||
} else if Self::version_at_least(major, minor, 10, 13) {
|
||||
MTLLanguageVersion::V2_0
|
||||
@ -768,6 +770,8 @@ impl PrivateCapabilities {
|
||||
} else {
|
||||
MTLLanguageVersion::V1_0
|
||||
}
|
||||
} else if Self::version_at_least(major, minor, 13, 0) {
|
||||
MTLLanguageVersion::V2_2
|
||||
} else if Self::version_at_least(major, minor, 12, 0) {
|
||||
MTLLanguageVersion::V2_1
|
||||
} else if Self::version_at_least(major, minor, 11, 0) {
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"9b7f10d02014d4221b88d1283d75ec575e3bff017cc92581179b03caf19b76b2","README.md":"8cc42e022567870c58a53ff1cb6f94e961482e789fe5e22f9960408a43cf8405","src/command.rs":"4fb6d6ffb4b3e312f0e84818e80adaeef6206fe87827c447cf1b25d3effb74a5","src/conv.rs":"075f844081adb4fb7a76ab3950b017a44648a5eb9bf3721647a4f5bce617105b","src/device.rs":"1331e5820806d3a7c1286e141c41a6bd2e8fba0b50783ba9702bef8310f9c5e2","src/info.rs":"4a21b54f85ff73c538ca2f57f4d371eb862b5a28f126cd0ecafd37fc6dfd1318","src/lib.rs":"6feddaec1156bc91aa02a474fd866f2767954d27dfe33dd40f860836db3ef9a5","src/native.rs":"fc8c7d40054f59eeb36db5c4c439e2173cd9e967c4d69797f223e1c58748f71d","src/pool.rs":"8bfd5f750baef41a7edc539433f7e417e367dc60debfcb002188e12b0f9bd933","src/window.rs":"297d8995fa35c1faa1e9cde52210dc4241a9f4bb0741dbf870d7301c4a2baa29"},"package":"62538fedd66a78968a162e8e1a29d085ffbc97f8782634684b2f7da7aea59207"}
|
||||
{"files":{"Cargo.toml":"a9c1718fe065e2e4e9bb5f9d35472f1d515b948ce313520f207b3d6c006c6a66","README.md":"8cc42e022567870c58a53ff1cb6f94e961482e789fe5e22f9960408a43cf8405","src/command.rs":"4fb6d6ffb4b3e312f0e84818e80adaeef6206fe87827c447cf1b25d3effb74a5","src/conv.rs":"075f844081adb4fb7a76ab3950b017a44648a5eb9bf3721647a4f5bce617105b","src/device.rs":"f53127dc3f66899a8feb736425a50d498a493cdd3794782856bdbd6dfadc0059","src/info.rs":"4a21b54f85ff73c538ca2f57f4d371eb862b5a28f126cd0ecafd37fc6dfd1318","src/lib.rs":"fb6db733b117d87511af0217e8157e5313bb1d4bd99e1671203db9bf1111709e","src/native.rs":"fc8c7d40054f59eeb36db5c4c439e2173cd9e967c4d69797f223e1c58748f71d","src/pool.rs":"8bfd5f750baef41a7edc539433f7e417e367dc60debfcb002188e12b0f9bd933","src/window.rs":"9f6f7593ed74e013c475504cc0d40b9d0989c7a7a2138172861aa86874d3bc2f"},"package":"f1b8d901941d1734d307dacd8e5f00c89ee8fb8e78b4dab3edd91248150b26b4"}
|
@ -13,7 +13,7 @@
|
||||
[package]
|
||||
edition = "2018"
|
||||
name = "gfx-backend-vulkan"
|
||||
version = "0.4.0"
|
||||
version = "0.4.3"
|
||||
authors = ["The Gfx-rs Developers"]
|
||||
description = "Vulkan API backend for gfx-rs"
|
||||
homepage = "https://github.com/gfx-rs/gfx"
|
||||
@ -66,7 +66,7 @@ optional = true
|
||||
version = "0.8"
|
||||
optional = true
|
||||
[target."cfg(target_os = \"macos\")".dependencies.core-graphics]
|
||||
version = "0.17"
|
||||
version = "0.19"
|
||||
|
||||
[target."cfg(target_os = \"macos\")".dependencies.objc]
|
||||
version = "0.2.5"
|
||||
|
0
third_party/rust/gfx-backend-vulkan/README.md
vendored
Executable file → Normal file
0
third_party/rust/gfx-backend-vulkan/README.md
vendored
Executable file → Normal file
0
third_party/rust/gfx-backend-vulkan/src/command.rs
vendored
Executable file → Normal file
0
third_party/rust/gfx-backend-vulkan/src/command.rs
vendored
Executable file → Normal file
0
third_party/rust/gfx-backend-vulkan/src/conv.rs
vendored
Executable file → Normal file
0
third_party/rust/gfx-backend-vulkan/src/conv.rs
vendored
Executable file → Normal file
1
third_party/rust/gfx-backend-vulkan/src/device.rs
vendored
Executable file → Normal file
1
third_party/rust/gfx-backend-vulkan/src/device.rs
vendored
Executable file → Normal file
@ -2124,6 +2124,7 @@ impl d::Device<B> for Device {
|
||||
let swapchain = w::Swapchain {
|
||||
raw: swapchain_raw,
|
||||
functor,
|
||||
vendor_id: self.vendor_id,
|
||||
};
|
||||
|
||||
let images = backbuffer_images
|
||||
|
0
third_party/rust/gfx-backend-vulkan/src/info.rs
vendored
Executable file → Normal file
0
third_party/rust/gfx-backend-vulkan/src/info.rs
vendored
Executable file → Normal file
13
third_party/rust/gfx-backend-vulkan/src/lib.rs
vendored
Executable file → Normal file
13
third_party/rust/gfx-backend-vulkan/src/lib.rs
vendored
Executable file → Normal file
@ -293,7 +293,7 @@ unsafe extern "system" fn debug_utils_messenger_callback(
|
||||
message
|
||||
);
|
||||
|
||||
for (info_label, info) in additional_info.into_iter() {
|
||||
for (info_label, info) in additional_info.iter() {
|
||||
match info {
|
||||
Some(data) => {
|
||||
msg = format!("{}\n{}: {}", msg, info_label, data);
|
||||
@ -567,11 +567,10 @@ impl hal::Instance<Backend> for Instance {
|
||||
RawWindowHandle::Xcb(handle) if self.extensions.contains(&extensions::khr::XcbSurface::name()) => {
|
||||
Ok(self.create_surface_from_xcb(handle.connection as *mut _, handle.window))
|
||||
}
|
||||
// #[cfg(target_os = "android")]
|
||||
// RawWindowHandle::ANativeWindowHandle(handle) => {
|
||||
// let native_window = unimplemented!();
|
||||
// self.create_surface_android(native_window)
|
||||
//}
|
||||
#[cfg(target_os = "android")]
|
||||
RawWindowHandle::Android(handle) => {
|
||||
Ok(self.create_surface_android(handle.a_native_window))
|
||||
}
|
||||
#[cfg(windows)]
|
||||
RawWindowHandle::Windows(handle) => {
|
||||
use winapi::um::libloaderapi::GetModuleHandleW;
|
||||
@ -692,6 +691,7 @@ impl adapter::PhysicalDevice<Backend> for PhysicalDevice {
|
||||
|
||||
let device = Device {
|
||||
raw: Arc::new(RawDevice(device_raw, requested_features, self.instance.clone())),
|
||||
vendor_id: self.properties.vendor_id,
|
||||
};
|
||||
|
||||
let device_arc = device.raw.clone();
|
||||
@ -1390,6 +1390,7 @@ impl queue::CommandQueue<Backend> for CommandQueue {
|
||||
#[derive(Debug)]
|
||||
pub struct Device {
|
||||
raw: Arc<RawDevice>,
|
||||
vendor_id: u32,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)]
|
||||
|
0
third_party/rust/gfx-backend-vulkan/src/native.rs
vendored
Executable file → Normal file
0
third_party/rust/gfx-backend-vulkan/src/native.rs
vendored
Executable file → Normal file
0
third_party/rust/gfx-backend-vulkan/src/pool.rs
vendored
Executable file → Normal file
0
third_party/rust/gfx-backend-vulkan/src/pool.rs
vendored
Executable file → Normal file
5
third_party/rust/gfx-backend-vulkan/src/window.rs
vendored
Executable file → Normal file
5
third_party/rust/gfx-backend-vulkan/src/window.rs
vendored
Executable file → Normal file
@ -12,7 +12,7 @@ use ash::{extensions::khr, version::DeviceV1_0 as _, vk};
|
||||
use hal::{format::Format, window as w};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::{conv, native};
|
||||
use crate::{conv, info, native};
|
||||
use crate::{
|
||||
Backend,
|
||||
Device,
|
||||
@ -550,6 +550,7 @@ impl w::PresentationSurface<Backend> for Surface {
|
||||
pub struct Swapchain {
|
||||
pub(crate) raw: vk::SwapchainKHR,
|
||||
pub(crate) functor: khr::Swapchain,
|
||||
pub(crate) vendor_id: u32,
|
||||
}
|
||||
|
||||
impl fmt::Debug for Swapchain {
|
||||
@ -574,6 +575,8 @@ impl w::Swapchain<Backend> for Swapchain {
|
||||
.acquire_next_image(self.raw, timeout_ns, semaphore, fence);
|
||||
|
||||
match index {
|
||||
// special case for Intel Vulkan returning bizzare values (ugh)
|
||||
Ok((i, _)) if self.vendor_id == info::intel::VENDOR && i > 0x100 => Err(w::AcquireError::OutOfDate),
|
||||
Ok((i, true)) => Ok((i, Some(w::Suboptimal))),
|
||||
Ok((i, false)) => Ok((i, None)),
|
||||
Err(vk::Result::NOT_READY) => Err(w::AcquireError::NotReady),
|
||||
|
@ -1 +1 @@
|
||||
{"files":{"Cargo.toml":"20527e88deb658382bf29a8661b688313385ab3cc0cfcefa81bce47472960e59","src/adapter.rs":"7076bac0db2368278d295db347e06b6d088b5a6448fc77c68ef64b3a59c024a3","src/buffer.rs":"8068981cbe8a640520e63274d084dc8d83b1fb7b05265976a5b70366f107c86a","src/command/clear.rs":"f0f08993f966a1f82091fa2a8dc226da28946f4a04bc3eca4307079bc4b14b43","src/command/mod.rs":"2c8050344f996eae3fca10724afbc89ba8df5adad5c94341af426ec77eecaade","src/command/structs.rs":"00b5850540ae21227c6578866e86cc741d074601239f8b1bbd0342a5e5f74623","src/device.rs":"31bf744cd16d0ac7c3bef0016dd7adb99ee8e76a6c3552b47a0b8f9abad86842","src/format.rs":"6d864c354dc5af0a31dd11f379b64f37609949d38f7e7349a546ec7c6e808307","src/image.rs":"621895798256182eac069b0f5f5040fc1bd0b38d62faf19f8ee5c54964a4c6a0","src/lib.rs":"d6f5404c0d6014e7602d5dc9fca41483f7a213fa5c014405688b79e2bb961616","src/memory.rs":"a8e3b745f44e54e74cce48bb0fffd6439498a9d96163a05cec4d4e6faa3fb500","src/pass.rs":"5dc3657ed879c1da91e310cc43287b4ec8feeeee1edaad0db5242e5bd8c5cf6d","src/pool.rs":"85330ac11f6a154694353615865cfddd52feec9435e20b0ff3a8ec6c7f7fe353","src/pso/compute.rs":"fb9a5748c3b9174924db13c1c59388bcd75279ff6d40d1a068fb52e70e5ccb94","src/pso/descriptor.rs":"0e4edf70bdd2e85ed9481f836312c24077220d66f23b7caea19e7059b26b0aa0","src/pso/graphics.rs":"b572990d08112b2f76d044ee48359d82f50a3ea29bcdeecb62249fc15d7bbefb","src/pso/input_assembler.rs":"c6ac5a0e70b2efd0056a8f393b95a5159ace65f23eed0e5a32b1ffedd44c4e53","src/pso/mod.rs":"d3ab00d99ab12e10a8386aa16349f793680d7da01cf61fc46437d78d6c5902bc","src/pso/output_merger.rs":"174cceec8080a68d22f68a0a51044c16fa8a45028adc503b9a65919b68550827","src/pso/specialization.rs":"fb90dc6a34908b283514edb040293d382a3471e0c8fa0bd11ec5f98cceec5799","src/query.rs":"f8541c41370b4812c001dc3f3d4487f2832652e9ea4abac391ed8ca2d0d1d7e4","src/queue/family.rs":"80bc451a615b4643a1e0958ad8dd28c37c11801edad035fd9079fae489dfe315","src/queue/mod.rs":"19c10c5434ecbe29b35caf0bd74045e3576688c643b5020400e3a1337bc06206","src/range.rs":"94486dad94f5d7fafaaf019c7dd9715212b25447da76ea55e867f1a91a35e606","src/window.rs":"4fc9333199f5ef055498cc667a693f132092657ba0153fd5cf426a7f33562301"},"package":"977716fea7800ab5bc9a1e048dd2f72b23af166d8c2f48c6fb6d1ce37d77ca7e"}
|
||||
{"files":{"Cargo.toml":"7fd90ffc01d0c91cbb8a545731350e210f681f9398c12b2826e90aeb6da08bbf","src/adapter.rs":"7076bac0db2368278d295db347e06b6d088b5a6448fc77c68ef64b3a59c024a3","src/buffer.rs":"576f59309efe8aebaf6b6826160cb7f4730b1d730b1bfefd3aa26b2f0398115b","src/command/clear.rs":"f0f08993f966a1f82091fa2a8dc226da28946f4a04bc3eca4307079bc4b14b43","src/command/mod.rs":"2c8050344f996eae3fca10724afbc89ba8df5adad5c94341af426ec77eecaade","src/command/structs.rs":"00b5850540ae21227c6578866e86cc741d074601239f8b1bbd0342a5e5f74623","src/device.rs":"766bea8943cba3934374359e5b56e8824b3ba3e709bb362c0eaa706890c4aa91","src/format.rs":"6d864c354dc5af0a31dd11f379b64f37609949d38f7e7349a546ec7c6e808307","src/image.rs":"c9c8fa1a63d616ed21cfa237a1f2f53aa0e923a63ed0ca30bdc9125306e95a5c","src/lib.rs":"d6f5404c0d6014e7602d5dc9fca41483f7a213fa5c014405688b79e2bb961616","src/memory.rs":"a8e3b745f44e54e74cce48bb0fffd6439498a9d96163a05cec4d4e6faa3fb500","src/pass.rs":"5dc3657ed879c1da91e310cc43287b4ec8feeeee1edaad0db5242e5bd8c5cf6d","src/pool.rs":"85330ac11f6a154694353615865cfddd52feec9435e20b0ff3a8ec6c7f7fe353","src/pso/compute.rs":"fb9a5748c3b9174924db13c1c59388bcd75279ff6d40d1a068fb52e70e5ccb94","src/pso/descriptor.rs":"f854d37aced6a3391d0c563fad472823a6536eabaf55f0c5e0a7babd2f146de6","src/pso/graphics.rs":"b572990d08112b2f76d044ee48359d82f50a3ea29bcdeecb62249fc15d7bbefb","src/pso/input_assembler.rs":"c6ac5a0e70b2efd0056a8f393b95a5159ace65f23eed0e5a32b1ffedd44c4e53","src/pso/mod.rs":"2dc44e5b494e1cc3823608c4faadccfcc19e7ae266590fd2db0b090c376f1ab9","src/pso/output_merger.rs":"174cceec8080a68d22f68a0a51044c16fa8a45028adc503b9a65919b68550827","src/pso/specialization.rs":"fb90dc6a34908b283514edb040293d382a3471e0c8fa0bd11ec5f98cceec5799","src/query.rs":"59a1e10bbf6efdb2837da7f20bb60218b4deadd541a1237e2470461e45d0a339","src/queue/family.rs":"80bc451a615b4643a1e0958ad8dd28c37c11801edad035fd9079fae489dfe315","src/queue/mod.rs":"19c10c5434ecbe29b35caf0bd74045e3576688c643b5020400e3a1337bc06206","src/range.rs":"94486dad94f5d7fafaaf019c7dd9715212b25447da76ea55e867f1a91a35e606","src/window.rs":"2251d16a62a83dea8078432bf1ba04f518feaf68e2ac44c427e5f62759864a52"},"package":"7c88981665c780447bb08eb099e1ded330754a7246719bab927ee4a949c0ba7f"}
|
2
third_party/rust/gfx-hal/Cargo.toml
vendored
2
third_party/rust/gfx-hal/Cargo.toml
vendored
@ -13,7 +13,7 @@
|
||||
[package]
|
||||
edition = "2018"
|
||||
name = "gfx-hal"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
authors = ["The Gfx-rs Developers"]
|
||||
description = "gfx-rs hardware abstraction layer"
|
||||
homepage = "https://github.com/gfx-rs/gfx"
|
||||
|
37
third_party/rust/gfx-hal/src/buffer.rs
vendored
37
third_party/rust/gfx-hal/src/buffer.rs
vendored
@ -35,6 +35,24 @@ impl From<device::OutOfMemory> for CreationError {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for CreationError {
|
||||
fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
CreationError::OutOfMemory(err) => write!(fmt, "Failed to create buffer: {}", err),
|
||||
CreationError::UnsupportedUsage { usage } => write!(fmt, "Failed to create buffer: Unsupported usage: {:?}", usage),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for CreationError {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
match self {
|
||||
CreationError::OutOfMemory(err) => Some(err),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Error creating a buffer view.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum ViewCreationError {
|
||||
@ -54,6 +72,25 @@ impl From<device::OutOfMemory> for ViewCreationError {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for ViewCreationError {
|
||||
fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
ViewCreationError::OutOfMemory(err) => write!(fmt, "Failed to create buffer view: {}", err),
|
||||
ViewCreationError::UnsupportedFormat { format: Some(format) } => write!(fmt, "Failed to create buffer view: Unsupported format {:?}", format),
|
||||
ViewCreationError::UnsupportedFormat { format: None } => write!(fmt, "Failed to create buffer view: Unspecified format"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for ViewCreationError {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
match self {
|
||||
ViewCreationError::OutOfMemory(err) => Some(err),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bitflags!(
|
||||
/// Buffer usage flags.
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user