From 8ef4420257f8f2cc44a5312bd77785ca12f1fee5 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Mon, 23 Jan 2023 02:58:00 +0900 Subject: [PATCH] examples: d3d11videosink: Update for windows crate v0.44 Part-of: --- examples/Cargo.toml | 2 +- examples/src/bin/d3d11videosink.rs | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 35a69014d..c4b6efb40 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -43,7 +43,7 @@ memfd = { version = "0.6", optional = true } uds = { version = "0.2", optional = true } [target.'cfg(windows)'.dependencies] -windows = { version = "0.43", features=["Win32_Graphics_Direct3D11", +windows = { version = "0.44", features=["Win32_Graphics_Direct3D11", "Win32_Foundation", "Win32_Graphics_Direct3D", "Win32_Graphics_Dxgi", "Win32_Graphics_Dxgi_Common", "Win32_Graphics_Direct2D", "Win32_Graphics_Direct2D_Common", "Win32_Graphics_DirectWrite", diff --git a/examples/src/bin/d3d11videosink.rs b/examples/src/bin/d3d11videosink.rs index c9109d19d..39ff668e3 100644 --- a/examples/src/bin/d3d11videosink.rs +++ b/examples/src/bin/d3d11videosink.rs @@ -134,11 +134,7 @@ fn main() -> Result<()> { // something in wrong way or driver bug or so. unsafe { let rtv = ID3D11RenderTargetView::from_raw_borrowed(&rtv_raw); - let resource = { - let mut resource = None; - rtv.GetResource(&mut resource); - resource.unwrap() - }; + let resource = rtv.GetResource().unwrap(); let texture = resource.cast::().unwrap(); let desc = { @@ -195,7 +191,8 @@ fn main() -> Result<()> { let mut was_decreased = false; loop { - let metrics = layout.GetMetrics().unwrap(); + let mut metrics = DWRITE_TEXT_METRICS::default(); + layout.GetMetrics(&mut metrics).unwrap(); layout .GetFontSize2(0, &mut font_size, Some(&mut range)) .unwrap();