Skip to content

Commit

Permalink
Attempt to provide more info to @NatsuShio
Browse files Browse the repository at this point in the history
  • Loading branch information
derekdreery committed Nov 24, 2020
1 parent e677854 commit 23c9005
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions druid-shell/src/platform/windows/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,13 @@ fn set_style(hwnd: HWND, resizable: bool, titlebar: bool) {
}

impl WndState {
fn rebuild_render_target(&mut self, d2d: &D2DFactory, scale: Scale) {
fn rebuild_render_target(&mut self, d2d: &D2DFactory, scale: Scale) -> Result<(), Error> {
unsafe {
let swap_chain = self.dxgi_state.as_ref().unwrap().swap_chain;
let rt = paint::create_render_target_dxgi(d2d, swap_chain, scale)
.map(|rt| rt.as_device_context().expect("TODO remove this expect"));
self.render_target = rt.ok();
paint::create_render_target_dxgi(d2d, swap_chain, scale).map(|rt| {
self.render_target = rt.as_device_context().expect("TODO remove this expect");
// returns ()
})
}
}

Expand Down Expand Up @@ -834,7 +835,9 @@ impl WndProc for MyWndProc {
);
}
if SUCCEEDED(res) {
s.rebuild_render_target(&self.d2d_factory, scale);
if let Err(e) = s.rebuild_render_target(&self.d2d_factory, scale) {
log::error!("error building render target: {}", e);
}
s.render(
&self.d2d_factory,
&self.dwrite_factory,
Expand Down

0 comments on commit 23c9005

Please sign in to comment.