(&mut self, timeout: UINT)
| 329 | } |
| 330 | |
| 331 | fn get_texture(&mut self, timeout: UINT) -> io::Result<*mut c_void> { |
| 332 | unsafe { |
| 333 | if self.duplication.0.is_null() { |
| 334 | return Err(std::io::ErrorKind::AddrNotAvailable.into()); |
| 335 | } |
| 336 | (*self.duplication.0).ReleaseFrame(); |
| 337 | let mut frame = ptr::null_mut(); |
| 338 | #[allow(invalid_value)] |
| 339 | let mut info = mem::MaybeUninit::uninit().assume_init(); |
| 340 | |
| 341 | wrap_hresult((*self.duplication.0).AcquireNextFrame(timeout, &mut info, &mut frame))?; |
| 342 | let frame = ComPtr(frame); |
| 343 | |
| 344 | if info.AccumulatedFrames == 0 || *info.LastPresentTime.QuadPart() == 0 { |
| 345 | return Err(std::io::ErrorKind::WouldBlock.into()); |
| 346 | } |
| 347 | |
| 348 | let mut texture: *mut ID3D11Texture2D = ptr::null_mut(); |
| 349 | (*frame.0).QueryInterface( |
| 350 | &IID_ID3D11Texture2D, |
| 351 | &mut texture as *mut *mut _ as *mut *mut _, |
| 352 | ); |
| 353 | let texture = ComPtr(texture); |
| 354 | self.texture = texture; |
| 355 | Ok(self.texture.0 as *mut c_void) |
| 356 | } |
| 357 | } |
| 358 | |
| 359 | fn unmap(&self) { |
| 360 | unsafe { |
no test coverage detected