From a51e58ef2b2dede06df7f6b8582b61d28ea04845 Mon Sep 17 00:00:00 2001 From: Travis Finkenauer Date: Wed, 5 Jan 2022 01:58:55 -0800 Subject: [PATCH 1/4] canvas_minimal: run `cargo fmt` --- examples/canvas_minimal/src/main.rs | 76 ++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 24 deletions(-) diff --git a/examples/canvas_minimal/src/main.rs b/examples/canvas_minimal/src/main.rs index 3f2940687..686bdc951 100644 --- a/examples/canvas_minimal/src/main.rs +++ b/examples/canvas_minimal/src/main.rs @@ -20,7 +20,9 @@ use pathfinder_renderer::gpu::options::{DestFramebuffer, RendererMode, RendererO use pathfinder_renderer::gpu::renderer::Renderer; use pathfinder_renderer::options::BuildOptions; use pathfinder_resources::embedded::EmbeddedResourceLoader; -use surfman::{Connection, ContextAttributeFlags, ContextAttributes, GLVersion as SurfmanGLVersion}; +use surfman::{ + Connection, ContextAttributeFlags, ContextAttributes, GLVersion as SurfmanGLVersion, +}; use surfman::{SurfaceAccess, SurfaceType}; use winit::dpi::LogicalSize; use winit::{ControlFlow, Event, EventsLoop, WindowBuilder, WindowEvent}; @@ -30,16 +32,19 @@ fn main() { let mut event_loop = EventsLoop::new(); let window_size = Size2D::new(640, 480); let logical_size = LogicalSize::new(window_size.width as f64, window_size.height as f64); - let window = WindowBuilder::new().with_title("Minimal example") - .with_dimensions(logical_size) - .build(&event_loop) - .unwrap(); + let window = WindowBuilder::new() + .with_title("Minimal example") + .with_dimensions(logical_size) + .build(&event_loop) + .unwrap(); window.show(); // Create a `surfman` device. On a multi-GPU system, we'll request the low-power integrated // GPU. let connection = Connection::from_winit_window(&window).unwrap(); - let native_widget = connection.create_native_widget_from_winit_window(&window).unwrap(); + let native_widget = connection + .create_native_widget_from_winit_window(&window) + .unwrap(); let adapter = connection.create_low_power_adapter().unwrap(); let mut device = connection.create_device(&adapter).unwrap(); @@ -48,14 +53,19 @@ fn main() { version: SurfmanGLVersion::new(3, 0), flags: ContextAttributeFlags::ALPHA, }; - let context_descriptor = device.create_context_descriptor(&context_attributes).unwrap(); + let context_descriptor = device + .create_context_descriptor(&context_attributes) + .unwrap(); // Make the OpenGL context via `surfman`, and load OpenGL functions. let surface_type = SurfaceType::Widget { native_widget }; let mut context = device.create_context(&context_descriptor).unwrap(); - let surface = device.create_surface(&context, SurfaceAccess::GPUOnly, surface_type) - .unwrap(); - device.bind_surface_to_context(&mut context, surface).unwrap(); + let surface = device + .create_surface(&context, SurfaceAccess::GPUOnly, surface_type) + .unwrap(); + device + .bind_surface_to_context(&mut context, surface) + .unwrap(); device.make_context_current(&context).unwrap(); gl::load_with(|symbol_name| device.get_proc_address(&context, symbol_name)); @@ -65,10 +75,11 @@ fn main() { let framebuffer_size = vec2i(physical_size.width as i32, physical_size.height as i32); // Create a Pathfinder GL device. - let default_framebuffer = device.context_surface_info(&context) - .unwrap() - .unwrap() - .framebuffer_object; + let default_framebuffer = device + .context_surface_info(&context) + .unwrap() + .unwrap() + .framebuffer_object; let pathfinder_device = GLDevice::new(GLVersion::GL3, default_framebuffer); // Create a Pathfinder renderer. @@ -87,17 +98,27 @@ fn main() { event_loop.run_forever(|event| { let mut should_render = is_first_render; match event { - Event::WindowEvent { event: WindowEvent::CloseRequested, .. } | - Event::WindowEvent { event: WindowEvent::KeyboardInput { .. }, .. } => return ControlFlow::Break, - Event::WindowEvent { event: WindowEvent::Refresh, .. } => { + Event::WindowEvent { + event: WindowEvent::CloseRequested, + .. + } + | Event::WindowEvent { + event: WindowEvent::KeyboardInput { .. }, + .. + } => return ControlFlow::Break, + Event::WindowEvent { + event: WindowEvent::Refresh, + .. + } => { should_render = true; } - _ => {}, + _ => {} } if should_render { // Make a canvas. We're going to draw a house. - let mut canvas = Canvas::new(framebuffer_size.to_f32()).get_context_2d(font_context.clone()); + let mut canvas = + Canvas::new(framebuffer_size.to_f32()).get_context_2d(font_context.clone()); // Set line width. canvas.set_line_width(10.0); @@ -117,15 +138,22 @@ fn main() { canvas.stroke_path(path); // Render the canvas to screen. - let mut scene = SceneProxy::from_scene(canvas.into_canvas().into_scene(), - renderer.mode().level, - RayonExecutor); + let mut scene = SceneProxy::from_scene( + canvas.into_canvas().into_scene(), + renderer.mode().level, + RayonExecutor, + ); scene.build_and_render(&mut renderer, BuildOptions::default()); // Present the surface. - let mut surface = device.unbind_surface_from_context(&mut context).unwrap().unwrap(); + let mut surface = device + .unbind_surface_from_context(&mut context) + .unwrap() + .unwrap(); device.present_surface(&mut context, &mut surface).unwrap(); - device.bind_surface_to_context(&mut context, surface).unwrap(); + device + .bind_surface_to_context(&mut context, surface) + .unwrap(); } is_first_render = false; From 88a28615170689a5f548826b806131de7060a2cc Mon Sep 17 00:00:00 2001 From: Travis Finkenauer Date: Wed, 5 Jan 2022 02:03:28 -0800 Subject: [PATCH 2/4] canvas_minimal: update winit 0.24 to fix crash The latest published surfman (0.4.3) expects winit 0.24. Upstream winit issue: https://github.com/rust-windowing/winit/issues/1773 --- Cargo.lock | 1080 +++++++++++++++++++++++---- examples/canvas_minimal/Cargo.toml | 5 +- examples/canvas_minimal/src/main.rs | 47 +- 3 files changed, 968 insertions(+), 164 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 797749ec1..4de16eb0f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,12 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13739d7177fbd22bb0ed28badfff9f372f8bef46c863db4e1c6248f6b223b6e" + [[package]] name = "addr2line" version = "0.13.0" @@ -67,6 +73,19 @@ dependencies = [ "xml-rs", ] +[[package]] +name = "andrew" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c4afb09dd642feec8408e33f92f3ffc4052946f6b20f32fb99c1f58cd4fa7cf" +dependencies = [ + "bitflags", + "rusttype 0.9.2", + "walkdir", + "xdg", + "xml-rs", +] + [[package]] name = "android_glue" version = "0.2.3" @@ -125,10 +144,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", - "libc 0.2.71", + "libc 0.2.112", "winapi 0.3.9", ] +[[package]] +name = "autocfg" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" + [[package]] name = "autocfg" version = "1.0.0" @@ -143,7 +168,7 @@ checksum = "46254cf2fdcdf1badb5934448c1bcbe046a56537b3987d96c51a7afc5d03f293" dependencies = [ "addr2line", "cfg-if 0.1.10", - "libc 0.2.71", + "libc 0.2.112", "miniz_oxide 0.4.0", "object", "rustc-demangle", @@ -232,7 +257,17 @@ checksum = "7aa2097be53a00de9e8fc349fea6d76221f398f5c4fa550d420669906962d160" dependencies = [ "mio", "mio-extras", - "nix", + "nix 0.14.1", +] + +[[package]] +name = "calloop" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b036167e76041694579972c28cf4877b4f92da222560ddb49008937b6a6727c" +dependencies = [ + "log", + "nix 0.18.0", ] [[package]] @@ -286,8 +321,8 @@ dependencies = [ "pathfinder_gpu", "pathfinder_renderer", "pathfinder_resources", - "surfman", - "winit 0.19.3", + "surfman 0.4.3", + "winit 0.24.0", ] [[package]] @@ -304,8 +339,8 @@ dependencies = [ "pathfinder_gpu", "pathfinder_renderer", "pathfinder_resources", - "surfman", - "winit 0.19.3", + "surfman 0.2.0", + "winit 0.18.1", ] [[package]] @@ -328,8 +363,8 @@ dependencies = [ "pathfinder_renderer", "pathfinder_resources", "pathfinder_simd", - "surfman", - "winit 0.19.3", + "surfman 0.4.3", + "winit 0.24.0", ] [[package]] @@ -404,7 +439,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" dependencies = [ - "libc 0.2.71", + "libc 0.2.112", ] [[package]] @@ -427,7 +462,7 @@ dependencies = [ "ansi_term", "atty", "bitflags", - "strsim", + "strsim 0.8.0", "textwrap", "unicode-width", "vec_map", @@ -462,7 +497,7 @@ dependencies = [ "core-foundation 0.6.4", "core-graphics 0.17.3", "foreign-types", - "libc 0.2.71", + "libc 0.2.112", "objc", ] @@ -477,7 +512,7 @@ dependencies = [ "core-foundation 0.6.4", "core-graphics 0.17.3", "foreign-types", - "libc 0.2.71", + "libc 0.2.112", "objc", ] @@ -492,7 +527,38 @@ dependencies = [ "core-foundation 0.7.0", "core-graphics 0.19.2", "foreign-types", - "libc 0.2.71", + "libc 0.2.112", + "objc", +] + +[[package]] +name = "cocoa" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63902e9223530efb4e26ccd0cf55ec30d592d3b42e21a28defc42a9586e832" +dependencies = [ + "bitflags", + "block", + "cocoa-foundation", + "core-foundation 0.9.2", + "core-graphics 0.22.3", + "foreign-types", + "libc 0.2.112", + "objc", +] + +[[package]] +name = "cocoa-foundation" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" +dependencies = [ + "bitflags", + "block", + "core-foundation 0.9.2", + "core-graphics-types", + "foreign-types", + "libc 0.2.112", "objc", ] @@ -558,7 +624,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" dependencies = [ "core-foundation-sys 0.6.2", - "libc 0.2.71", + "libc 0.2.112", ] [[package]] @@ -568,7 +634,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" dependencies = [ "core-foundation-sys 0.7.0", - "libc 0.2.71", + "libc 0.2.112", +] + +[[package]] +name = "core-foundation" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3" +dependencies = [ + "core-foundation-sys 0.8.3", + "libc 0.2.112", ] [[package]] @@ -583,6 +659,12 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + [[package]] name = "core-graphics" version = "0.17.3" @@ -592,7 +674,7 @@ dependencies = [ "bitflags", "core-foundation 0.6.4", "foreign-types", - "libc 0.2.71", + "libc 0.2.112", ] [[package]] @@ -604,7 +686,32 @@ dependencies = [ "bitflags", "core-foundation 0.7.0", "foreign-types", - "libc 0.2.71", + "libc 0.2.112", +] + +[[package]] +name = "core-graphics" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" +dependencies = [ + "bitflags", + "core-foundation 0.9.2", + "core-graphics-types", + "foreign-types", + "libc 0.2.112", +] + +[[package]] +name = "core-graphics-types" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" +dependencies = [ + "bitflags", + "core-foundation 0.9.2", + "foreign-types", + "libc 0.2.112", ] [[package]] @@ -616,7 +723,7 @@ dependencies = [ "core-foundation 0.6.4", "core-graphics 0.17.3", "foreign-types", - "libc 0.2.71", + "libc 0.2.112", ] [[package]] @@ -628,7 +735,7 @@ dependencies = [ "core-foundation 0.7.0", "core-graphics 0.19.2", "foreign-types", - "libc 0.2.71", + "libc 0.2.112", ] [[package]] @@ -640,7 +747,7 @@ dependencies = [ "cfg-if 0.1.10", "core-foundation-sys 0.7.0", "core-graphics 0.19.2", - "libc 0.2.71", + "libc 0.2.112", "objc", ] @@ -689,13 +796,13 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" dependencies = [ - "autocfg", + "autocfg 1.0.0", "cfg-if 0.1.10", "crossbeam-utils", "lazy_static 1.4.0", "maybe-uninit", - "memoffset", - "scopeguard", + "memoffset 0.5.5", + "scopeguard 1.1.0", ] [[package]] @@ -715,7 +822,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" dependencies = [ - "autocfg", + "autocfg 1.0.0", "cfg-if 0.1.10", "lazy_static 1.4.0", ] @@ -729,6 +836,41 @@ dependencies = [ "lazy_static 0.1.16", ] +[[package]] +name = "darling" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2 1.0.18", + "quote 1.0.7", + "strsim 0.9.3", + "syn 1.0.33", +] + +[[package]] +name = "darling_macro" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" +dependencies = [ + "darling_core", + "quote 1.0.7", + "syn 1.0.33", +] + [[package]] name = "data-url" version = "0.1.0" @@ -781,8 +923,19 @@ dependencies = [ "pathfinder_resources", "pathfinder_simd", "pretty_env_logger", - "surfman", - "winit 0.19.3", + "surfman 0.2.0", + "winit 0.18.1", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2 1.0.18", + "quote 1.0.7", + "syn 1.0.33", ] [[package]] @@ -801,7 +954,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a" dependencies = [ - "libc 0.2.71", + "libc 0.2.112", "redox_users", "winapi 0.3.9", ] @@ -833,6 +986,15 @@ dependencies = [ "libloading 0.6.2", ] +[[package]] +name = "dlib" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794" +dependencies = [ + "libloading 0.7.2", +] + [[package]] name = "doc-comment" version = "0.3.3" @@ -852,7 +1014,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bcdf488e3a52a7aa30a05732a3e58420e22acb4b2b75635a561fc6ffbcab59ef" dependencies = [ "lazy_static 1.4.0", - "libc 0.2.71", + "libc 0.2.112", "winapi 0.3.9", "wio", ] @@ -864,7 +1026,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a373bc9844200b1ff15bd1b245931d1c20d09d06e4ec09f361171f29a4b0752d" dependencies = [ "khronos", - "libc 0.2.71", + "libc 0.2.112", ] [[package]] @@ -931,7 +1093,7 @@ checksum = "68c90b0fc46cf89d227cc78b40e494ff81287a92dd07631e5af0d06fe3cf885e" dependencies = [ "cfg-if 0.1.10", "crc32fast", - "libc 0.2.71", + "libc 0.2.112", "miniz_oxide 0.4.0", ] @@ -947,6 +1109,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bad48618fdb549078c333a7a8528acb57af271d0433bdecd523eb620628364e" +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "font" version = "0.1.0" @@ -959,12 +1127,12 @@ dependencies = [ "inflate", "itertools 0.8.2", "log", - "nom", + "nom 5.1.2", "pathfinder_color", "pathfinder_content", "pathfinder_geometry", "pathfinder_renderer", - "rand", + "rand 0.7.3", "slotmap", "tuple", "walkdir", @@ -986,7 +1154,7 @@ dependencies = [ "float-ord", "freetype", "lazy_static 1.4.0", - "libc 0.2.71", + "libc 0.2.112", "log", "pathfinder_geometry", "pathfinder_simd", @@ -1016,7 +1184,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11926b2b410b469d0e9399eca4cbbe237a9ef02176c485803b29216307e8e028" dependencies = [ - "libc 0.2.71", + "libc 0.2.112", "servo-freetype-sys", ] @@ -1026,6 +1194,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674" +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" + [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -1073,7 +1247,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" dependencies = [ "cfg-if 0.1.10", - "libc 0.2.71", + "libc 0.2.112", "wasi", "wasm-bindgen", ] @@ -1258,7 +1432,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96282e96bfcd3da0d3aa9938bedf1e50df3269b6db08b4876d2da0bb1a0841cf" dependencies = [ "ahash", - "autocfg", + "autocfg 1.0.0", "serde", ] @@ -1268,7 +1442,7 @@ version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" dependencies = [ - "libc 0.2.71", + "libc 0.2.112", ] [[package]] @@ -1286,6 +1460,12 @@ dependencies = [ "quick-error", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "image" version = "0.23.6" @@ -1310,7 +1490,7 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe" dependencies = [ - "autocfg", + "autocfg 1.0.0", ] [[package]] @@ -1324,10 +1504,11 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.6" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b141fdc7836c525d4d594027d318c84161ca17aaf8113ab1f81ab93ae897485" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ + "cfg-if 1.0.0", "js-sys", "wasm-bindgen", "web-sys", @@ -1343,7 +1524,7 @@ dependencies = [ "core-foundation 0.6.4", "gleam", "leaky-cow", - "libc 0.2.71", + "libc 0.2.112", ] [[package]] @@ -1352,7 +1533,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" dependencies = [ - "libc 0.2.71", + "libc 0.2.112", ] [[package]] @@ -1396,7 +1577,7 @@ checksum = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45" dependencies = [ "cc", "fs_extra", - "libc 0.2.71", + "libc 0.2.112", ] [[package]] @@ -1406,7 +1587,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69" dependencies = [ "jemalloc-sys", - "libc 0.2.71", + "libc 0.2.112", ] [[package]] @@ -1536,9 +1717,9 @@ checksum = "e32a70cf75e5846d53a673923498228bbec6a8624708a9ea5645f075d6276122" [[package]] name = "libc" -version = "0.2.71" +version = "0.2.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" +checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" [[package]] name = "libloading" @@ -1559,6 +1740,16 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "libloading" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afe203d669ec979b7128619bae5a63b7b42e9203c1b29146079ee05e2f604b52" +dependencies = [ + "cfg-if 1.0.0", + "winapi 0.3.9", +] + [[package]] name = "line_drawing" version = "0.7.0" @@ -1568,13 +1759,32 @@ dependencies = [ "num-traits 0.2.12", ] +[[package]] +name = "lock_api" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" +dependencies = [ + "owning_ref", + "scopeguard 0.3.3", +] + [[package]] name = "lock_api" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" dependencies = [ - "scopeguard", + "scopeguard 1.1.0", +] + +[[package]] +name = "lock_api" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" +dependencies = [ + "scopeguard 1.1.0", ] [[package]] @@ -1615,7 +1825,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" dependencies = [ - "libc 0.2.71", + "libc 0.2.112", ] [[package]] @@ -1624,7 +1834,7 @@ version = "0.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" dependencies = [ - "libc 0.2.71", + "libc 0.2.112", ] [[package]] @@ -1657,7 +1867,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" dependencies = [ - "libc 0.2.71", + "libc 0.2.112", "winapi 0.3.9", ] @@ -1667,7 +1877,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b70ca2a6103ac8b665dc150b142ef0e4e89df640c9e6cf295d189c3caebe5a" dependencies = [ - "libc 0.2.71", + "libc 0.2.112", ] [[package]] @@ -1676,7 +1886,16 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f" dependencies = [ - "autocfg", + "autocfg 1.0.0", +] + +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg 1.0.0", ] [[package]] @@ -1709,6 +1928,12 @@ dependencies = [ "objc", ] +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.3.7" @@ -1738,7 +1963,7 @@ dependencies = [ "fuchsia-zircon-sys", "iovec", "kernel32-sys", - "libc 0.2.71", + "libc 0.2.112", "log", "miow", "net2", @@ -1770,6 +1995,51 @@ dependencies = [ "ws2_32-sys", ] +[[package]] +name = "ndk" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eb167c1febed0a496639034d0c76b3b74263636045db5489eee52143c246e73" +dependencies = [ + "jni-sys", + "ndk-sys", + "num_enum", + "thiserror", +] + +[[package]] +name = "ndk-glue" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdf399b8b7a39c6fb153c4ec32c72fd5fe789df24a647f229c239aa7adb15241" +dependencies = [ + "lazy_static 1.4.0", + "libc 0.2.112", + "log", + "ndk", + "ndk-macro", + "ndk-sys", +] + +[[package]] +name = "ndk-macro" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05d1c6307dc424d0f65b9b06e94f88248e6305726b14729fd67a5e47b2dc481d" +dependencies = [ + "darling", + "proc-macro-crate", + "proc-macro2 1.0.18", + "quote 1.0.7", + "syn 1.0.33", +] + +[[package]] +name = "ndk-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1bcdd74c20ad5d95aacd60ef9ba40fdf77f767051040541df557b7a9b2a2121" + [[package]] name = "net2" version = "0.2.34" @@ -1777,7 +2047,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" dependencies = [ "cfg-if 0.1.10", - "libc 0.2.71", + "libc 0.2.112", "winapi 0.3.9", ] @@ -1799,10 +2069,35 @@ dependencies = [ "bitflags", "cc", "cfg-if 0.1.10", - "libc 0.2.71", + "libc 0.2.112", "void", ] +[[package]] +name = "nix" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83450fe6a6142ddd95fb064b746083fc4ef1705fe81f64a64e1d4b39f54a1055" +dependencies = [ + "bitflags", + "cc", + "cfg-if 0.1.10", + "libc 0.2.112", +] + +[[package]] +name = "nix" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5e06129fb611568ef4e868c14b326274959aa70ff7776e9d55323531c374945" +dependencies = [ + "bitflags", + "cc", + "cfg-if 1.0.0", + "libc 0.2.112", + "memoffset 0.6.5", +] + [[package]] name = "nom" version = "5.1.2" @@ -1814,13 +2109,24 @@ dependencies = [ "version_check", ] +[[package]] +name = "nom" +version = "7.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1d11e1ef389c76fe5b81bcaf2ea32cf88b62bc494e19f493d0b30e7a930109" +dependencies = [ + "memchr", + "minimal-lexical", + "version_check", +] + [[package]] name = "num-integer" version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" dependencies = [ - "autocfg", + "autocfg 1.0.0", "num-traits 0.2.12", ] @@ -1830,7 +2136,7 @@ version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a6e6b7c748f995c4c29c5f5ae0248536e04a5739927c74ec0fa564805094b9f" dependencies = [ - "autocfg", + "autocfg 1.0.0", "num-integer", "num-traits 0.2.12", ] @@ -1841,7 +2147,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5b4d7360f362cfb50dde8143501e6940b22f644be75a4cc90b2d81968908138" dependencies = [ - "autocfg", + "autocfg 1.0.0", "num-integer", "num-traits 0.2.12", ] @@ -1861,7 +2167,7 @@ version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" dependencies = [ - "autocfg", + "autocfg 1.0.0", ] [[package]] @@ -1871,7 +2177,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ "hermit-abi", - "libc 0.2.71", + "libc 0.2.112", +] + +[[package]] +name = "num_enum" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca565a7df06f3d4b485494f25ba05da1435950f4dc263440eda7a6fa9b8e36e4" +dependencies = [ + "derivative", + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffa5a33ddddfee04c0283a7653987d634e880347e96b5b2ed64de07efb59db9d" +dependencies = [ + "proc-macro-crate", + "proc-macro2 1.0.18", + "quote 1.0.7", + "syn 1.0.33", ] [[package]] @@ -1928,6 +2256,12 @@ dependencies = [ "parking_lot 0.9.0", ] +[[package]] +name = "once_cell" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" + [[package]] name = "ordered-float" version = "1.1.0" @@ -1953,37 +2287,89 @@ dependencies = [ ] [[package]] -name = "parking_lot" -version = "0.9.0" +name = "owned_ttf_parser" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" +checksum = "9f923fb806c46266c02ab4a5b239735c144bdeda724a50ed058e5226f594cde3" dependencies = [ - "lock_api", - "parking_lot_core 0.6.2", - "rustc_version", + "ttf-parser", ] [[package]] -name = "parking_lot" -version = "0.10.2" +name = "owning_ref" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" +checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce" dependencies = [ - "lock_api", - "parking_lot_core 0.7.2", + "stable_deref_trait", ] [[package]] -name = "parking_lot_core" -version = "0.6.2" +name = "parking_lot" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" +checksum = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" dependencies = [ - "cfg-if 0.1.10", - "cloudabi", - "libc 0.2.71", - "redox_syscall", - "rustc_version", + "lock_api 0.1.5", + "parking_lot_core 0.4.0", +] + +[[package]] +name = "parking_lot" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" +dependencies = [ + "lock_api 0.3.4", + "parking_lot_core 0.6.2", + "rustc_version 0.2.3", +] + +[[package]] +name = "parking_lot" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" +dependencies = [ + "lock_api 0.3.4", + "parking_lot_core 0.7.2", +] + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api 0.4.5", + "parking_lot_core 0.8.5", +] + +[[package]] +name = "parking_lot_core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" +dependencies = [ + "libc 0.2.112", + "rand 0.6.5", + "rustc_version 0.2.3", + "smallvec 0.6.13", + "winapi 0.3.9", +] + +[[package]] +name = "parking_lot_core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" +dependencies = [ + "cfg-if 0.1.10", + "cloudabi", + "libc 0.2.112", + "redox_syscall 0.1.56", + "rustc_version 0.2.3", "smallvec 0.6.13", "winapi 0.3.9", ] @@ -1996,9 +2382,23 @@ checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" dependencies = [ "cfg-if 0.1.10", "cloudabi", - "libc 0.2.71", - "redox_syscall", - "smallvec 1.4.1", + "libc 0.2.112", + "redox_syscall 0.1.56", + "smallvec 1.7.0", + "winapi 0.3.9", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +dependencies = [ + "cfg-if 1.0.0", + "instant", + "libc 0.2.112", + "redox_syscall 0.2.10", + "smallvec 1.7.0", "winapi 0.3.9", ] @@ -2025,7 +2425,7 @@ dependencies = [ "foreign-types", "gl", "io-surface", - "libc 0.2.71", + "libc 0.2.112", "metal 0.18.0", "pathfinder_canvas", "pathfinder_color", @@ -2073,7 +2473,7 @@ dependencies = [ "pathfinder_geometry", "pathfinder_simd", "quickcheck", - "smallvec 1.4.1", + "smallvec 1.7.0", ] [[package]] @@ -2180,7 +2580,7 @@ dependencies = [ "pathfinder_svg", "pathfinder_ui", "rayon", - "smallvec 1.4.1", + "smallvec 1.7.0", "usvg", ] @@ -2197,7 +2597,7 @@ dependencies = [ "foreign-types", "half", "io-surface", - "libc 0.2.71", + "libc 0.2.112", "metal 0.18.0", "objc", "pathfinder_geometry", @@ -2230,7 +2630,7 @@ dependencies = [ "rayon", "serde", "serde_json", - "smallvec 1.4.1", + "smallvec 1.7.0", "vec_map", ] @@ -2240,9 +2640,9 @@ version = "0.5.0" [[package]] name = "pathfinder_simd" -version = "0.5.0" +version = "0.5.1" dependencies = [ - "rustc_version", + "rustc_version 0.3.3", ] [[package]] @@ -2350,7 +2750,7 @@ dependencies = [ "lzw", "md5", "num-traits 0.1.43", - "once_cell", + "once_cell 0.2.4", "ordermap", "pdf_derive", "snafu", @@ -2381,12 +2781,27 @@ dependencies = [ "pdf", ] +[[package]] +name = "percent-encoding" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" + [[package]] name = "percent-encoding" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +[[package]] +name = "pest" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +dependencies = [ + "ucd-trie", +] + [[package]] name = "pkg-config" version = "0.3.17" @@ -2421,6 +2836,15 @@ dependencies = [ "log", ] +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + [[package]] name = "proc-macro2" version = "0.4.30" @@ -2453,8 +2877,8 @@ checksum = "a44883e74aa97ad63db83c4bf8ca490f02b2fc02f92575e720c8551e843c945f" dependencies = [ "env_logger", "log", - "rand", - "rand_core", + "rand 0.7.3", + "rand_core 0.5.1", ] [[package]] @@ -2475,6 +2899,25 @@ dependencies = [ "proc-macro2 1.0.18", ] +[[package]] +name = "rand" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" +dependencies = [ + "autocfg 0.1.7", + "libc 0.2.112", + "rand_chacha 0.1.1", + "rand_core 0.4.2", + "rand_hc 0.1.0", + "rand_isaac", + "rand_jitter", + "rand_os", + "rand_pcg", + "rand_xorshift", + "winapi 0.3.9", +] + [[package]] name = "rand" version = "0.7.3" @@ -2482,10 +2925,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ "getrandom", - "libc 0.2.71", - "rand_chacha", - "rand_core", - "rand_hc", + "libc 0.2.112", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc 0.2.0", +] + +[[package]] +name = "rand_chacha" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +dependencies = [ + "autocfg 0.1.7", + "rand_core 0.3.1", ] [[package]] @@ -2495,9 +2948,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +dependencies = [ + "rand_core 0.4.2", ] +[[package]] +name = "rand_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" + [[package]] name = "rand_core" version = "0.5.1" @@ -2507,13 +2975,75 @@ dependencies = [ "getrandom", ] +[[package]] +name = "rand_hc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +dependencies = [ + "rand_core 0.3.1", +] + [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_isaac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "rand_jitter" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" +dependencies = [ + "libc 0.2.112", + "rand_core 0.4.2", + "winapi 0.3.9", +] + +[[package]] +name = "rand_os" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" +dependencies = [ + "cloudabi", + "fuchsia-cprng", + "libc 0.2.112", + "rand_core 0.4.2", + "rdrand", + "winapi 0.3.9", +] + +[[package]] +name = "rand_pcg" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" +dependencies = [ + "autocfg 0.1.7", + "rand_core 0.4.2", +] + +[[package]] +name = "rand_xorshift" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" +dependencies = [ + "rand_core 0.3.1", ] [[package]] @@ -2522,7 +3052,7 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a441a7a6c80ad6473bd4b74ec1c9a4c951794285bf941c2126f607c72e48211" dependencies = [ - "libc 0.2.71", + "libc 0.2.112", ] [[package]] @@ -2531,7 +3061,7 @@ version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62f02856753d04e03e26929f820d0a0a337ebe71f849801eea335d464b349080" dependencies = [ - "autocfg", + "autocfg 1.0.0", "crossbeam-deque", "either", "rayon-core", @@ -2556,12 +3086,30 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be9e29cb19c8fe84169fcb07f8f11e66bc9e6e0280efd4715c54818296f8a4a8" +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +dependencies = [ + "rand_core 0.3.1", +] + [[package]] name = "redox_syscall" version = "0.1.56" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +[[package]] +name = "redox_syscall" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +dependencies = [ + "bitflags", +] + [[package]] name = "redox_users" version = "0.3.4" @@ -2569,7 +3117,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431" dependencies = [ "getrandom", - "redox_syscall", + "redox_syscall 0.1.56", "rust-argon2", ] @@ -2624,7 +3172,16 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver", + "semver 0.9.0", +] + +[[package]] +name = "rustc_version" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +dependencies = [ + "semver 0.11.0", ] [[package]] @@ -2647,6 +3204,16 @@ dependencies = [ "stb_truetype", ] +[[package]] +name = "rusttype" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc7c727aded0be18c5b80c1640eae0ac8e396abf6fa8477d96cb37d18ee5ec59" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser", +] + [[package]] name = "ryu" version = "1.0.5" @@ -2674,6 +3241,12 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" +[[package]] +name = "scopeguard" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" + [[package]] name = "scopeguard" version = "1.1.0" @@ -2688,7 +3261,7 @@ checksum = "1f74124048ea86b5cd50236b2443f6f57cf4625a8e8818009b4e50dbb8729a43" dependencies = [ "bitflags", "lazy_static 1.4.0", - "libc 0.2.71", + "libc 0.2.112", "sdl2-sys", ] @@ -2699,7 +3272,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2e1deb61ff274d29fb985017d4611d4004b113676eaa9c06754194caf82094e" dependencies = [ "cfg-if 0.1.10", - "libc 0.2.71", + "libc 0.2.112", ] [[package]] @@ -2708,7 +3281,16 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser", + "semver-parser 0.7.0", +] + +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser 0.10.2", ] [[package]] @@ -2717,6 +3299,15 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +[[package]] +name = "semver-parser" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + [[package]] name = "serde" version = "1.0.114" @@ -2754,7 +3345,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a088f8d775a5c5314aae09bd77340bc9c67d72b9a45258be34c83548b4814cd9" dependencies = [ - "libc 0.2.71", + "libc 0.2.112", "servo-fontconfig-sys", ] @@ -2786,7 +3377,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11" dependencies = [ "lazy_static 1.4.0", - "libc 0.2.71", + "libc 0.2.112", ] [[package]] @@ -2841,9 +3432,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.4.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3757cb9d89161a2f24e1cf78efa0c1fcff485d18e3f55e0aa3480824ddaa0f3f" +checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" [[package]] name = "smithay-client-toolkit" @@ -2851,12 +3442,12 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ccb8c57049b2a34d2cc2b203fa785020ba0129d31920ef0d317430adaf748fa" dependencies = [ - "andrew", + "andrew 0.2.1", "bitflags", - "dlib", + "dlib 0.4.2", "lazy_static 1.4.0", "memmap", - "nix", + "nix 0.14.1", "wayland-client 0.21.13", "wayland-commons 0.21.13", "wayland-protocols 0.21.13", @@ -2868,16 +3459,35 @@ version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "421c8dc7acf5cb205b88160f8b4cc2c5cfabe210e43b2f80f009f4c1ef910f1d" dependencies = [ - "andrew", + "andrew 0.2.1", "bitflags", - "dlib", + "dlib 0.4.2", "lazy_static 1.4.0", "memmap", - "nix", + "nix 0.14.1", "wayland-client 0.23.6", "wayland-protocols 0.23.6", ] +[[package]] +name = "smithay-client-toolkit" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4750c76fd5d3ac95fa3ed80fe667d6a3d8590a960e5b575b98eea93339a80b80" +dependencies = [ + "andrew 0.3.1", + "bitflags", + "calloop 0.6.5", + "dlib 0.4.2", + "lazy_static 1.4.0", + "log", + "memmap2", + "nix 0.18.0", + "wayland-client 0.28.6", + "wayland-cursor", + "wayland-protocols 0.28.6", +] + [[package]] name = "snafu" version = "0.4.4" @@ -2900,6 +3510,12 @@ dependencies = [ "syn 0.15.44", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -2921,6 +3537,12 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +[[package]] +name = "strsim" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" + [[package]] name = "surfman" version = "0.2.0" @@ -2937,7 +3559,7 @@ dependencies = [ "gl_generator 0.13.1", "io-surface", "lazy_static 1.4.0", - "libc 0.2.71", + "libc 0.2.112", "log", "mach", "metal 0.17.1", @@ -2945,7 +3567,38 @@ dependencies = [ "parking_lot 0.9.0", "wayland-sys 0.24.1", "winapi 0.3.9", - "winit 0.19.3", + "winit 0.18.1", + "wio", + "x11", +] + +[[package]] +name = "surfman" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e4a723d26074814c0896e20ad30bbf32b9961c8f659e25cc414fc7dac2c3608" +dependencies = [ + "bitflags", + "cfg_aliases", + "cgl", + "cocoa 0.19.1", + "core-foundation 0.6.4", + "core-graphics 0.17.3", + "display-link", + "euclid", + "gl_generator 0.14.0", + "io-surface", + "lazy_static 1.4.0", + "libc 0.2.112", + "log", + "mach", + "metal 0.18.0", + "objc", + "parking_lot 0.10.2", + "raw-window-handle", + "wayland-sys 0.24.1", + "winapi 0.3.9", + "winit 0.24.0", "wio", "x11", ] @@ -2986,7 +3639,7 @@ dependencies = [ "inflate", "lzma-rs", "memchr", - "nom", + "nom 5.1.2", "swf-fixed", "swf-types", ] @@ -3059,6 +3712,26 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "thiserror" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "318234ffa22e0920fe9a40d7b8369b5f649d490980cf7aadcf1eb91594869b42" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cae2447b6282786c3493999f40a9be2a6ad20cb8bd268b0a0dbf5a065535c0ab" +dependencies = [ + "proc-macro2 1.0.18", + "quote 1.0.7", + "syn 1.0.33", +] + [[package]] name = "thread_local" version = "1.0.1" @@ -3085,7 +3758,7 @@ version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" dependencies = [ - "libc 0.2.71", + "libc 0.2.112", "winapi 0.3.9", ] @@ -3101,6 +3774,15 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed" +[[package]] +name = "toml" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +dependencies = [ + "serde", +] + [[package]] name = "ttf-parser" version = "0.6.2" @@ -3116,6 +3798,12 @@ dependencies = [ "serde", ] +[[package]] +name = "ucd-trie" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" + [[package]] name = "unicode-bidi" version = "0.3.4" @@ -3331,8 +4019,8 @@ checksum = "49963e5f9eeaf637bfcd1b9f0701c99fd5cd05225eb51035550d4272806f2713" dependencies = [ "bitflags", "downcast-rs", - "libc 0.2.71", - "nix", + "libc 0.2.112", + "nix 0.14.1", "wayland-commons 0.21.13", "wayland-scanner 0.21.13", "wayland-sys 0.21.13", @@ -3345,23 +4033,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1080ebe0efabcf12aef2132152f616038f2d7dcbbccf7b2d8c5270fe14bcda" dependencies = [ "bitflags", - "calloop", + "calloop 0.4.4", "downcast-rs", - "libc 0.2.71", + "libc 0.2.112", "mio", - "nix", + "nix 0.14.1", "wayland-commons 0.23.6", "wayland-scanner 0.23.6", "wayland-sys 0.23.6", ] +[[package]] +name = "wayland-client" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ab332350e502f159382201394a78e3cc12d0f04db863429260164ea40e0355" +dependencies = [ + "bitflags", + "downcast-rs", + "libc 0.2.112", + "nix 0.20.2", + "scoped-tls", + "wayland-commons 0.28.6", + "wayland-scanner 0.28.6", + "wayland-sys 0.28.6", +] + [[package]] name = "wayland-commons" version = "0.21.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c08896768b667e1df195d88a62a53a2d1351a1ed96188be79c196b35bb32ec" dependencies = [ - "nix", + "nix 0.14.1", "wayland-sys 0.21.13", ] @@ -3371,10 +4075,33 @@ version = "0.23.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb66b0d1a27c39bbce712b6372131c6e25149f03ffb0cd017cf8f7de8d66dbdb" dependencies = [ - "nix", + "nix 0.14.1", "wayland-sys 0.23.6", ] +[[package]] +name = "wayland-commons" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21817947c7011bbd0a27e11b17b337bfd022e8544b071a2641232047966fbda" +dependencies = [ + "nix 0.20.2", + "once_cell 1.9.0", + "smallvec 1.7.0", + "wayland-sys 0.28.6", +] + +[[package]] +name = "wayland-cursor" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be610084edd1586d45e7bdd275fe345c7c1873598caa464c4fb835dee70fa65a" +dependencies = [ + "nix 0.20.2", + "wayland-client 0.28.6", + "xcursor", +] + [[package]] name = "wayland-protocols" version = "0.21.13" @@ -3400,6 +4127,18 @@ dependencies = [ "wayland-scanner 0.23.6", ] +[[package]] +name = "wayland-protocols" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "286620ea4d803bacf61fa087a4242ee316693099ee5a140796aaba02b29f861f" +dependencies = [ + "bitflags", + "wayland-client 0.28.6", + "wayland-commons 0.28.6", + "wayland-scanner 0.28.6", +] + [[package]] name = "wayland-scanner" version = "0.21.13" @@ -3422,13 +4161,24 @@ dependencies = [ "xml-rs", ] +[[package]] +name = "wayland-scanner" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce923eb2deb61de332d1f356ec7b6bf37094dc5573952e1c8936db03b54c03f1" +dependencies = [ + "proc-macro2 1.0.18", + "quote 1.0.7", + "xml-rs", +] + [[package]] name = "wayland-sys" version = "0.21.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "520ab0fd578017a0ee2206623ba9ef4afe5e8f23ca7b42f6acfba2f4e66b1628" dependencies = [ - "dlib", + "dlib 0.4.2", "lazy_static 1.4.0", ] @@ -3438,7 +4188,7 @@ version = "0.23.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d94e89a86e6d6d7c7c9b19ebf48a03afaac4af6bc22ae570e9a24124b75358f4" dependencies = [ - "dlib", + "dlib 0.4.2", "lazy_static 1.4.0", ] @@ -3448,8 +4198,19 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "537500923d50be11d95a63c4cb538145e4c82edf61296b7debc1f94a1a6514ed" dependencies = [ - "dlib", + "dlib 0.4.2", + "lazy_static 1.4.0", +] + +[[package]] +name = "wayland-sys" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d841fca9aed7febf9bed2e9796c49bf58d4152ceda8ac949ebe00868d8f0feb8" +dependencies = [ + "dlib 0.5.0", "lazy_static 1.4.0", + "pkg-config", ] [[package]] @@ -3507,22 +4268,21 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "winit" -version = "0.19.3" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d0da905e61ae52d55c5ca6f8bea1e09daf5e325b6c77b0947c65a5179b49f5f" +checksum = "8c57c15bd4c0ef18dff33e263e452abe32d00e2e05771cacaa410a14cc1c0776" dependencies = [ "android_glue", "backtrace", - "bitflags", "cocoa 0.18.5", "core-foundation 0.6.4", "core-graphics 0.17.3", "lazy_static 1.4.0", - "libc 0.2.71", + "libc 0.2.112", "log", "objc", - "parking_lot 0.9.0", - "percent-encoding", + "parking_lot 0.7.1", + "percent-encoding 1.0.1", "smithay-client-toolkit 0.4.6", "wayland-client 0.21.13", "winapi 0.3.9", @@ -3544,13 +4304,13 @@ dependencies = [ "dispatch", "instant", "lazy_static 1.4.0", - "libc 0.2.71", + "libc 0.2.112", "log", "mio", "mio-extras", "objc", "parking_lot 0.10.2", - "percent-encoding", + "percent-encoding 2.1.0", "raw-window-handle", "smithay-client-toolkit 0.6.6", "wayland-client 0.23.6", @@ -3558,6 +4318,37 @@ dependencies = [ "x11-dl", ] +[[package]] +name = "winit" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da4eda6fce0eb84bd0a33e3c8794eb902e1033d0a1d5a31bc4f19b1b4bbff597" +dependencies = [ + "bitflags", + "cocoa 0.24.0", + "core-foundation 0.9.2", + "core-graphics 0.22.3", + "core-video-sys", + "dispatch", + "instant", + "lazy_static 1.4.0", + "libc 0.2.112", + "log", + "mio", + "mio-extras", + "ndk", + "ndk-glue", + "ndk-sys", + "objc", + "parking_lot 0.11.2", + "percent-encoding 2.1.0", + "raw-window-handle", + "smithay-client-toolkit 0.12.3", + "wayland-client 0.28.6", + "winapi 0.3.9", + "x11-dl", +] + [[package]] name = "wio" version = "0.2.2" @@ -3583,7 +4374,7 @@ version = "2.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77ecd092546cb16f25783a5451538e73afc8d32e242648d54f4ae5459ba1e773" dependencies = [ - "libc 0.2.71", + "libc 0.2.112", "pkg-config", ] @@ -3594,11 +4385,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bf981e3a5b3301209754218f962052d4d9ee97e478f4d26d4a6eced34c1fef8" dependencies = [ "lazy_static 1.4.0", - "libc 0.2.71", + "libc 0.2.112", "maybe-uninit", "pkg-config", ] +[[package]] +name = "xcursor" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "463705a63313cd4301184381c5e8042f0a7e9b4bb63653f216311d4ae74690b7" +dependencies = [ + "nom 7.1.0", +] + [[package]] name = "xdg" version = "2.2.0" diff --git a/examples/canvas_minimal/Cargo.toml b/examples/canvas_minimal/Cargo.toml index 16fe8ee84..25b1c21e0 100644 --- a/examples/canvas_minimal/Cargo.toml +++ b/examples/canvas_minimal/Cargo.toml @@ -36,9 +36,8 @@ path = "../../renderer" path = "../../resources" [dependencies.surfman] -git = "https://github.com/servo/surfman" -rev = "f3df871ac8c3926fe9106d86a3e51e20aa50d3cc" +version = "0.4.3" features = ["sm-winit", "sm-x11"] [dependencies.winit] -version = "<0.19.4" # 0.19.4 causes build errors https://github.com/rust-windowing/winit/pull/1105 +version = "0.24" diff --git a/examples/canvas_minimal/src/main.rs b/examples/canvas_minimal/src/main.rs index 686bdc951..0a9348038 100644 --- a/examples/canvas_minimal/src/main.rs +++ b/examples/canvas_minimal/src/main.rs @@ -20,28 +20,30 @@ use pathfinder_renderer::gpu::options::{DestFramebuffer, RendererMode, RendererO use pathfinder_renderer::gpu::renderer::Renderer; use pathfinder_renderer::options::BuildOptions; use pathfinder_resources::embedded::EmbeddedResourceLoader; -use surfman::{ - Connection, ContextAttributeFlags, ContextAttributes, GLVersion as SurfmanGLVersion, -}; +use surfman::{ContextAttributeFlags, ContextAttributes, GLVersion as SurfmanGLVersion}; use surfman::{SurfaceAccess, SurfaceType}; -use winit::dpi::LogicalSize; -use winit::{ControlFlow, Event, EventsLoop, WindowBuilder, WindowEvent}; +use winit::dpi::{LogicalSize, PhysicalSize}; +use winit::{ + event::{Event, WindowEvent}, + event_loop::{ControlFlow, EventLoop}, + window::WindowBuilder, +}; fn main() { // Open a window. - let mut event_loop = EventsLoop::new(); + let event_loop = EventLoop::new(); let window_size = Size2D::new(640, 480); let logical_size = LogicalSize::new(window_size.width as f64, window_size.height as f64); let window = WindowBuilder::new() .with_title("Minimal example") - .with_dimensions(logical_size) + .with_min_inner_size(logical_size) .build(&event_loop) .unwrap(); - window.show(); + window.set_visible(true); // Create a `surfman` device. On a multi-GPU system, we'll request the low-power integrated // GPU. - let connection = Connection::from_winit_window(&window).unwrap(); + let connection = surfman::Connection::from_winit_window(&window).unwrap(); let native_widget = connection .create_native_widget_from_winit_window(&window) .unwrap(); @@ -59,7 +61,7 @@ fn main() { // Make the OpenGL context via `surfman`, and load OpenGL functions. let surface_type = SurfaceType::Widget { native_widget }; - let mut context = device.create_context(&context_descriptor).unwrap(); + let mut context = device.create_context(&context_descriptor, None).unwrap(); let surface = device .create_surface(&context, SurfaceAccess::GPUOnly, surface_type) .unwrap(); @@ -70,8 +72,11 @@ fn main() { gl::load_with(|symbol_name| device.get_proc_address(&context, symbol_name)); // Get the real size of the window, taking HiDPI into account. - let hidpi_factor = window.get_current_monitor().get_hidpi_factor(); - let physical_size = logical_size.to_physical(hidpi_factor); + let scale_factor = window + .current_monitor() + .map(|monitor| monitor.scale_factor()) + .unwrap_or(1.0); + let physical_size: PhysicalSize = logical_size.to_physical(scale_factor); let framebuffer_size = vec2i(physical_size.width as i32, physical_size.height as i32); // Create a Pathfinder GL device. @@ -95,7 +100,7 @@ fn main() { let font_context = CanvasFontContext::from_system_source(); let mut is_first_render = true; // Wait for a keypress. - event_loop.run_forever(|event| { + event_loop.run(move |event, _, control_flow| { let mut should_render = is_first_render; match event { Event::WindowEvent { @@ -105,11 +110,15 @@ fn main() { | Event::WindowEvent { event: WindowEvent::KeyboardInput { .. }, .. - } => return ControlFlow::Break, - Event::WindowEvent { - event: WindowEvent::Refresh, - .. } => { + *control_flow = ControlFlow::Exit; + + // Clean up. + device + .destroy_context(&mut context) + .expect("Failed to destroy context"); + } + Event::RedrawRequested(_) => { should_render = true; } _ => {} @@ -157,9 +166,5 @@ fn main() { } is_first_render = false; - ControlFlow::Continue }); - - // Clean up. - drop(device.destroy_context(&mut context)); } From 72b7d0baf2345e51ec141c99dbdf58d31872f93d Mon Sep 17 00:00:00 2001 From: Travis Finkenauer Date: Wed, 5 Jan 2022 01:38:30 -0800 Subject: [PATCH 3/4] demo/native: run `cargo fmt` --- demo/native/src/main.rs | 293 ++++++++++++++++++++++------------------ 1 file changed, 165 insertions(+), 128 deletions(-) diff --git a/demo/native/src/main.rs b/demo/native/src/main.rs index 26acfc0b0..3fba1966b 100644 --- a/demo/native/src/main.rs +++ b/demo/native/src/main.rs @@ -18,34 +18,34 @@ extern crate objc; use euclid::default::Size2D; use nfd::Response; -use pathfinder_demo::window::{Event, Keycode, DataPath, View, Window, WindowSize}; +use pathfinder_demo::window::{DataPath, Event, Keycode, View, Window, WindowSize}; use pathfinder_demo::{DemoApp, Options}; use pathfinder_geometry::rect::RectI; -use pathfinder_geometry::vector::{Vector2I, vec2i}; -use pathfinder_resources::ResourceLoader; +use pathfinder_geometry::vector::{vec2i, Vector2I}; use pathfinder_resources::fs::FilesystemResourceLoader; +use pathfinder_resources::ResourceLoader; use std::cell::Cell; use std::collections::VecDeque; use std::mem; use std::path::PathBuf; use std::sync::Mutex; -use surfman::{SurfaceAccess, SurfaceType, declare_surfman}; +use surfman::{declare_surfman, SurfaceAccess, SurfaceType}; +use winit::dpi::LogicalSize; use winit::{ControlFlow, ElementState, Event as WinitEvent, EventsLoop, EventsLoopProxy}; use winit::{MouseButton, VirtualKeyCode, Window as WinitWindow, WindowBuilder, WindowEvent}; -use winit::dpi::LogicalSize; -#[cfg(any(not(target_os = "macos"), feature = "pf-gl"))] -use gl::types::GLuint; #[cfg(any(not(target_os = "macos"), feature = "pf-gl"))] use gl; #[cfg(any(not(target_os = "macos"), feature = "pf-gl"))] -use surfman::{Connection, Context, ContextAttributeFlags, ContextAttributes}; -#[cfg(any(not(target_os = "macos"), feature = "pf-gl"))] -use surfman::{Device, GLVersion as SurfmanGLVersion}; +use gl::types::GLuint; #[cfg(all(target_os = "macos", not(feature = "pf-gl")))] use io_surface::IOSurfaceRef; #[cfg(all(target_os = "macos", not(feature = "pf-gl")))] use pathfinder_metal::MetalDevice; +#[cfg(any(not(target_os = "macos"), feature = "pf-gl"))] +use surfman::{Connection, Context, ContextAttributeFlags, ContextAttributes}; +#[cfg(any(not(target_os = "macos"), feature = "pf-gl"))] +use surfman::{Device, GLVersion as SurfmanGLVersion}; #[cfg(all(target_os = "macos", not(feature = "pf-gl")))] use surfman::{NativeDevice, SystemConnection, SystemDevice, SystemSurface}; @@ -139,7 +139,10 @@ struct EventQueue { #[derive(Clone)] enum CustomEvent { - User { message_type: u32, message_data: u32 }, + User { + message_type: u32, + message_data: u32, + }, OpenData(PathBuf), } @@ -156,15 +159,17 @@ impl Window for WindowImpl { #[cfg(any(not(target_os = "macos"), feature = "pf-gl"))] fn gl_default_framebuffer(&self) -> GLuint { - self.device.context_surface_info(&self.context).unwrap().unwrap().framebuffer_object + self.device + .context_surface_info(&self.context) + .unwrap() + .unwrap() + .framebuffer_object } #[cfg(all(target_os = "macos", not(feature = "pf-gl")))] fn metal_device(&self) -> metal::Device { // FIXME(pcwalton): Remove once `surfman` upgrades `metal-rs` version. - unsafe { - mem::transmute(self.metal_device.0.clone()) - } + unsafe { mem::transmute(self.metal_device.0.clone()) } } #[cfg(all(target_os = "macos", not(feature = "pf-gl")))] @@ -173,7 +178,10 @@ impl Window for WindowImpl { } fn viewport(&self, view: View) -> RectI { - let WindowSize { logical_size, backing_scale_factor } = self.size(); + let WindowSize { + logical_size, + backing_scale_factor, + } = self.size(); let mut size = (logical_size.to_f32() * backing_scale_factor).to_i32(); let mut x_offset = 0; if let View::Stereo(index) = view { @@ -193,17 +201,24 @@ impl Window for WindowImpl { #[cfg(any(not(target_os = "macos"), feature = "pf-gl"))] fn present(&mut self, _: &mut GLDevice) { - let mut surface = self.device - .unbind_surface_from_context(&mut self.context) - .unwrap() - .unwrap(); - self.device.present_surface(&mut self.context, &mut surface).unwrap(); - self.device.bind_surface_to_context(&mut self.context, surface).unwrap(); + let mut surface = self + .device + .unbind_surface_from_context(&mut self.context) + .unwrap() + .unwrap(); + self.device + .present_surface(&mut self.context, &mut surface) + .unwrap(); + self.device + .bind_surface_to_context(&mut self.context, surface) + .unwrap(); } #[cfg(all(target_os = "macos", not(feature = "pf-gl")))] fn present(&mut self, metal_device: &mut MetalDevice) { - self.device.present_surface(&mut self.surface).expect("Failed to present surface!"); + self.device + .present_surface(&mut self.surface) + .expect("Failed to present surface!"); metal_device.swap_texture(self.device.native_surface(&self.surface).0); } @@ -215,7 +230,9 @@ impl Window for WindowImpl { if let Ok(Response::Okay(path)) = nfd::open_file_dialog(Some("svg,pdf"), None) { let mut event_queue = EVENT_QUEUE.lock().unwrap(); let event_queue = event_queue.as_mut().unwrap(); - event_queue.pending_custom_events.push_back(CustomEvent::OpenData(PathBuf::from(path))); + event_queue + .pending_custom_events + .push_back(CustomEvent::OpenData(PathBuf::from(path))); drop(event_queue.event_loop_proxy.wakeup()); } } @@ -236,10 +253,12 @@ impl Window for WindowImpl { fn push_user_event(message_type: u32, message_data: u32) { let mut event_queue = EVENT_QUEUE.lock().unwrap(); let event_queue = event_queue.as_mut().unwrap(); - event_queue.pending_custom_events.push_back(CustomEvent::User { - message_type, - message_data, - }); + event_queue + .pending_custom_events + .push_back(CustomEvent::User { + message_type, + message_data, + }); drop(event_queue.event_loop_proxy.wakeup()); } } @@ -250,14 +269,17 @@ impl WindowImpl { let event_loop = EventsLoop::new(); let window_size = Size2D::new(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT); let logical_size = LogicalSize::new(window_size.width as f64, window_size.height as f64); - let window = WindowBuilder::new().with_title("Pathfinder Demo") - .with_dimensions(logical_size) - .build(&event_loop) - .unwrap(); + let window = WindowBuilder::new() + .with_title("Pathfinder Demo") + .with_dimensions(logical_size) + .build(&event_loop) + .unwrap(); window.show(); let connection = Connection::from_winit_window(&window).unwrap(); - let native_widget = connection.create_native_widget_from_winit_window(&window).unwrap(); + let native_widget = connection + .create_native_widget_from_winit_window(&window) + .unwrap(); let adapter = if options.high_performance_gpu { connection.create_hardware_adapter().unwrap() @@ -271,13 +293,18 @@ impl WindowImpl { version: SurfmanGLVersion::new(3, 0), flags: ContextAttributeFlags::ALPHA, }; - let context_descriptor = device.create_context_descriptor(&context_attributes).unwrap(); + let context_descriptor = device + .create_context_descriptor(&context_attributes) + .unwrap(); let surface_type = SurfaceType::Widget { native_widget }; let mut context = device.create_context(&context_descriptor).unwrap(); - let surface = device.create_surface(&context, SurfaceAccess::GPUOnly, surface_type) - .unwrap(); - device.bind_surface_to_context(&mut context, surface).unwrap(); + let surface = device + .create_surface(&context, SurfaceAccess::GPUOnly, surface_type) + .unwrap(); + device + .bind_surface_to_context(&mut context, surface) + .unwrap(); device.make_context_current(&context).unwrap(); gl::load_with(|symbol_name| device.get_proc_address(&context, symbol_name)); @@ -308,14 +335,17 @@ impl WindowImpl { let event_loop = EventsLoop::new(); let window_size = Size2D::new(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT); let logical_size = LogicalSize::new(window_size.width as f64, window_size.height as f64); - let window = WindowBuilder::new().with_title("Pathfinder Demo") - .with_dimensions(logical_size) - .build(&event_loop) - .unwrap(); + let window = WindowBuilder::new() + .with_title("Pathfinder Demo") + .with_dimensions(logical_size) + .build(&event_loop) + .unwrap(); window.show(); let connection = SystemConnection::from_winit_window(&window).unwrap(); - let native_widget = connection.create_native_widget_from_winit_window(&window).unwrap(); + let native_widget = connection + .create_native_widget_from_winit_window(&window) + .unwrap(); let adapter = if options.high_performance_gpu { connection.create_hardware_adapter().unwrap() @@ -327,7 +357,9 @@ impl WindowImpl { let native_device = device.native_device(); let surface_type = SurfaceType::Widget { native_widget }; - let surface = device.create_surface(SurfaceAccess::GPUOnly, surface_type).unwrap(); + let surface = device + .create_surface(SurfaceAccess::GPUOnly, surface_type) + .unwrap(); let resource_loader = FilesystemResourceLoader::locate(); @@ -351,11 +383,16 @@ impl WindowImpl { } } - fn window(&self) -> &WinitWindow { &self.window } + fn window(&self) -> &WinitWindow { + &self.window + } fn size(&self) -> WindowSize { let window = self.window(); - let (monitor, size) = (window.get_current_monitor(), window.get_inner_size().unwrap()); + let (monitor, size) = ( + window.get_current_monitor(), + window.get_inner_size().unwrap(), + ); WindowSize { logical_size: vec2i(size.width as i32, size.height as i32), @@ -371,18 +408,13 @@ impl WindowImpl { let pending_events = &mut self.pending_events; self.event_loop.run_forever(|winit_event| { //println!("blocking {:?}", winit_event); - match convert_winit_event(winit_event, - window, - mouse_position, - mouse_down) { + match convert_winit_event(winit_event, window, mouse_position, mouse_down) { Some(event) => { //println!("handled"); pending_events.push_back(event); ControlFlow::Break } - None => { - ControlFlow::Continue - } + None => ControlFlow::Continue, } }); } @@ -398,10 +430,9 @@ impl WindowImpl { let pending_events = &mut self.pending_events; self.event_loop.poll_events(|winit_event| { //println!("nonblocking {:?}", winit_event); - if let Some(event) = convert_winit_event(winit_event, - window, - mouse_position, - mouse_down) { + if let Some(event) = + convert_winit_event(winit_event, window, mouse_position, mouse_down) + { //println!("handled"); pending_events.push_back(event); } @@ -411,87 +442,93 @@ impl WindowImpl { } } -fn convert_winit_event(winit_event: WinitEvent, - window: &WinitWindow, - mouse_position: &mut Vector2I, - mouse_down: &mut bool) - -> Option { +fn convert_winit_event( + winit_event: WinitEvent, + window: &WinitWindow, + mouse_position: &mut Vector2I, + mouse_down: &mut bool, +) -> Option { match winit_event { WinitEvent::Awakened => { let mut event_queue = EVENT_QUEUE.lock().unwrap(); let event_queue = event_queue.as_mut().unwrap(); - match event_queue.pending_custom_events - .pop_front() - .expect("`Awakened` with no pending custom event!") { - CustomEvent::OpenData(data_path) => Some(Event::OpenData(DataPath::Path(data_path))), - CustomEvent::User { message_data, message_type } => { - Some(Event::User { message_data, message_type }) + match event_queue + .pending_custom_events + .pop_front() + .expect("`Awakened` with no pending custom event!") + { + CustomEvent::OpenData(data_path) => { + Some(Event::OpenData(DataPath::Path(data_path))) } + CustomEvent::User { + message_data, + message_type, + } => Some(Event::User { + message_data, + message_type, + }), } } - WinitEvent::WindowEvent { event: window_event, .. } => { - match window_event { - WindowEvent::MouseInput { - state: ElementState::Pressed, - button: MouseButton::Left, - .. - } => { - *mouse_down = true; - Some(Event::MouseDown(*mouse_position)) - } - WindowEvent::MouseInput { - state: ElementState::Released, - button: MouseButton::Left, - .. - } => { - *mouse_down = false; - None - } - WindowEvent::CursorMoved { position, .. } => { - *mouse_position = vec2i(position.x as i32, position.y as i32); - if *mouse_down { - Some(Event::MouseDragged(*mouse_position)) - } else { - Some(Event::MouseMoved(*mouse_position)) - } + WinitEvent::WindowEvent { + event: window_event, + .. + } => match window_event { + WindowEvent::MouseInput { + state: ElementState::Pressed, + button: MouseButton::Left, + .. + } => { + *mouse_down = true; + Some(Event::MouseDown(*mouse_position)) + } + WindowEvent::MouseInput { + state: ElementState::Released, + button: MouseButton::Left, + .. + } => { + *mouse_down = false; + None + } + WindowEvent::CursorMoved { position, .. } => { + *mouse_position = vec2i(position.x as i32, position.y as i32); + if *mouse_down { + Some(Event::MouseDragged(*mouse_position)) + } else { + Some(Event::MouseMoved(*mouse_position)) } - WindowEvent::KeyboardInput { input, .. } => { - input.virtual_keycode.and_then(|virtual_keycode| { - match virtual_keycode { - VirtualKeyCode::Escape => Some(Keycode::Escape), - VirtualKeyCode::Tab => Some(Keycode::Tab), - virtual_keycode => { - let vk = virtual_keycode as u32; - let vk_a = VirtualKeyCode::A as u32; - let vk_z = VirtualKeyCode::Z as u32; - if vk >= vk_a && vk <= vk_z { - let character = ((vk - vk_a) + 'A' as u32) as u8; - Some(Keycode::Alphanumeric(character)) - } else { - None - } - } - } - }).map(|keycode| { - match input.state { - ElementState::Pressed => Event::KeyDown(keycode), - ElementState::Released => Event::KeyUp(keycode), + } + WindowEvent::KeyboardInput { input, .. } => input + .virtual_keycode + .and_then(|virtual_keycode| match virtual_keycode { + VirtualKeyCode::Escape => Some(Keycode::Escape), + VirtualKeyCode::Tab => Some(Keycode::Tab), + virtual_keycode => { + let vk = virtual_keycode as u32; + let vk_a = VirtualKeyCode::A as u32; + let vk_z = VirtualKeyCode::Z as u32; + if vk >= vk_a && vk <= vk_z { + let character = ((vk - vk_a) + 'A' as u32) as u8; + Some(Keycode::Alphanumeric(character)) + } else { + None } - }) - } - WindowEvent::CloseRequested => Some(Event::Quit), - WindowEvent::Resized(new_size) => { - let logical_size = vec2i(new_size.width as i32, new_size.height as i32); - let backing_scale_factor = - window.get_current_monitor().get_hidpi_factor() as f32; - Some(Event::WindowResized(WindowSize { - logical_size, - backing_scale_factor, - })) - } - _ => None, + } + }) + .map(|keycode| match input.state { + ElementState::Pressed => Event::KeyDown(keycode), + ElementState::Released => Event::KeyUp(keycode), + }), + WindowEvent::CloseRequested => Some(Event::Quit), + WindowEvent::Resized(new_size) => { + let logical_size = vec2i(new_size.width as i32, new_size.height as i32); + let backing_scale_factor = window.get_current_monitor().get_hidpi_factor() as f32; + Some(Event::WindowResized(WindowSize { + logical_size, + backing_scale_factor, + })) } - } + _ => None, + }, _ => None, } -} \ No newline at end of file +} From 219dee778b5e744436b48f2505b98ef56c5baff8 Mon Sep 17 00:00:00 2001 From: Travis Finkenauer Date: Fri, 7 Jan 2022 00:10:13 -0800 Subject: [PATCH 4/4] demo/native: update winit to 0.24 to fix crash --- Cargo.lock | 4 +-- demo/native/Cargo.toml | 5 ++- demo/native/src/main.rs | 73 ++++++++++++++++++++++------------------- 3 files changed, 43 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4de16eb0f..485bbc1fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -923,8 +923,8 @@ dependencies = [ "pathfinder_resources", "pathfinder_simd", "pretty_env_logger", - "surfman 0.2.0", - "winit 0.18.1", + "surfman 0.4.3", + "winit 0.24.0", ] [[package]] diff --git a/demo/native/Cargo.toml b/demo/native/Cargo.toml index c319d699f..965dcb502 100644 --- a/demo/native/Cargo.toml +++ b/demo/native/Cargo.toml @@ -38,12 +38,11 @@ path = "../../resources" path = "../../simd" [dependencies.surfman] -git = "https://github.com/servo/surfman" -rev = "f3df871ac8c3926fe9106d86a3e51e20aa50d3cc" +version = "0.4.3" features = ["sm-winit", "sm-x11"] [dependencies.winit] -version = "<0.19.4" # 0.19.4 causes build errors https://github.com/rust-windowing/winit/pull/1105 +version = "0.24" [target.'cfg(target_os = "macos")'.dependencies] foreign-types = "0.3" diff --git a/demo/native/src/main.rs b/demo/native/src/main.rs index 3fba1966b..a040bccb9 100644 --- a/demo/native/src/main.rs +++ b/demo/native/src/main.rs @@ -26,13 +26,18 @@ use pathfinder_resources::fs::FilesystemResourceLoader; use pathfinder_resources::ResourceLoader; use std::cell::Cell; use std::collections::VecDeque; -use std::mem; use std::path::PathBuf; use std::sync::Mutex; use surfman::{declare_surfman, SurfaceAccess, SurfaceType}; -use winit::dpi::LogicalSize; -use winit::{ControlFlow, ElementState, Event as WinitEvent, EventsLoop, EventsLoopProxy}; -use winit::{MouseButton, VirtualKeyCode, Window as WinitWindow, WindowBuilder, WindowEvent}; +use winit::dpi::{LogicalSize, PhysicalSize}; +use winit::platform::run_return::EventLoopExtRunReturn; +use winit::{ + event::{ElementState, Event as WinitEvent, MouseButton, VirtualKeyCode, WindowEvent}, + event_loop::{ControlFlow, EventLoop, EventLoopProxy}, + window::{Window as WinitWindow, WindowBuilder}, +}; +//use winit::{ControlFlow, ElementState, Event as WinitEvent, EventLoop, EventLoopProxy}; +//use winit::{MouseButton, VirtualKeyCode, Window as WinitWindow, WindowBuilder, WindowEvent}; #[cfg(any(not(target_os = "macos"), feature = "pf-gl"))] use gl; @@ -122,7 +127,7 @@ struct WindowImpl { #[cfg(all(target_os = "macos", not(feature = "pf-gl")))] surface: SystemSurface, - event_loop: EventsLoop, + event_loop: EventLoop<()>, pending_events: VecDeque, mouse_position: Vector2I, mouse_down: bool, @@ -133,7 +138,7 @@ struct WindowImpl { } struct EventQueue { - event_loop_proxy: EventsLoopProxy, + event_loop_proxy: EventLoopProxy<()>, pending_custom_events: VecDeque, } @@ -233,7 +238,7 @@ impl Window for WindowImpl { event_queue .pending_custom_events .push_back(CustomEvent::OpenData(PathBuf::from(path))); - drop(event_queue.event_loop_proxy.wakeup()); + drop(event_queue.event_loop_proxy.send_event(())); } } @@ -259,22 +264,34 @@ impl Window for WindowImpl { message_type, message_data, }); - drop(event_queue.event_loop_proxy.wakeup()); + drop(event_queue.event_loop_proxy.send_event(())); + } +} + +fn window_size(window: &WinitWindow, size: PhysicalSize) -> WindowSize { + let backing_scale_factor = window + .current_monitor() + .map(|monitor| monitor.scale_factor() as f32) + .unwrap_or(1.0); + let logical_size = vec2i(size.width as i32, size.height as i32); + WindowSize { + logical_size, + backing_scale_factor, } } impl WindowImpl { #[cfg(any(not(target_os = "macos"), feature = "pf-gl"))] fn new(options: &Options) -> WindowImpl { - let event_loop = EventsLoop::new(); + let event_loop = EventLoop::new(); let window_size = Size2D::new(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT); let logical_size = LogicalSize::new(window_size.width as f64, window_size.height as f64); let window = WindowBuilder::new() .with_title("Pathfinder Demo") - .with_dimensions(logical_size) + .with_min_inner_size(logical_size) .build(&event_loop) .unwrap(); - window.show(); + window.set_visible(true); let connection = Connection::from_winit_window(&window).unwrap(); let native_widget = connection @@ -298,7 +315,7 @@ impl WindowImpl { .unwrap(); let surface_type = SurfaceType::Widget { native_widget }; - let mut context = device.create_context(&context_descriptor).unwrap(); + let mut context = device.create_context(&context_descriptor, None).unwrap(); let surface = device .create_surface(&context, SurfaceAccess::GPUOnly, surface_type) .unwrap(); @@ -332,7 +349,7 @@ impl WindowImpl { #[cfg(all(target_os = "macos", not(feature = "pf-gl")))] fn new(options: &Options) -> WindowImpl { - let event_loop = EventsLoop::new(); + let event_loop = EventLoop::new(); let window_size = Size2D::new(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT); let logical_size = LogicalSize::new(window_size.width as f64, window_size.height as f64); let window = WindowBuilder::new() @@ -389,15 +406,7 @@ impl WindowImpl { fn size(&self) -> WindowSize { let window = self.window(); - let (monitor, size) = ( - window.get_current_monitor(), - window.get_inner_size().unwrap(), - ); - - WindowSize { - logical_size: vec2i(size.width as i32, size.height as i32), - backing_scale_factor: monitor.get_hidpi_factor() as f32, - } + window_size(window, window.inner_size()) } fn get_event(&mut self) -> Event { @@ -406,15 +415,15 @@ impl WindowImpl { let mouse_position = &mut self.mouse_position; let mouse_down = &mut self.mouse_down; let pending_events = &mut self.pending_events; - self.event_loop.run_forever(|winit_event| { + self.event_loop.run_return(|winit_event, _, control_flow| { //println!("blocking {:?}", winit_event); match convert_winit_event(winit_event, window, mouse_position, mouse_down) { Some(event) => { //println!("handled"); pending_events.push_back(event); - ControlFlow::Break + *control_flow = ControlFlow::Exit; } - None => ControlFlow::Continue, + None => (), } }); } @@ -428,7 +437,7 @@ impl WindowImpl { let mouse_position = &mut self.mouse_position; let mouse_down = &mut self.mouse_down; let pending_events = &mut self.pending_events; - self.event_loop.poll_events(|winit_event| { + self.event_loop.run_return(|winit_event, _, control_flow| { //println!("nonblocking {:?}", winit_event); if let Some(event) = convert_winit_event(winit_event, window, mouse_position, mouse_down) @@ -436,6 +445,7 @@ impl WindowImpl { //println!("handled"); pending_events.push_back(event); } + *control_flow = ControlFlow::Exit; }); } self.pending_events.pop_front() @@ -443,13 +453,13 @@ impl WindowImpl { } fn convert_winit_event( - winit_event: WinitEvent, + winit_event: WinitEvent<()>, window: &WinitWindow, mouse_position: &mut Vector2I, mouse_down: &mut bool, ) -> Option { match winit_event { - WinitEvent::Awakened => { + WinitEvent::UserEvent(()) => { let mut event_queue = EVENT_QUEUE.lock().unwrap(); let event_queue = event_queue.as_mut().unwrap(); match event_queue @@ -520,12 +530,7 @@ fn convert_winit_event( }), WindowEvent::CloseRequested => Some(Event::Quit), WindowEvent::Resized(new_size) => { - let logical_size = vec2i(new_size.width as i32, new_size.height as i32); - let backing_scale_factor = window.get_current_monitor().get_hidpi_factor() as f32; - Some(Event::WindowResized(WindowSize { - logical_size, - backing_scale_factor, - })) + Some(Event::WindowResized(window_size(window, new_size))) } _ => None, },