Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to provide more info to @NatsuShio #1429

Merged
merged 1 commit into from
Dec 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 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,17 @@ 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();
match paint::create_render_target_dxgi(d2d, swap_chain, scale) {
Ok(rt) => {
self.render_target =
Some(rt.as_device_context().expect("TODO remove this expect"));
Ok(())
}
Err(e) => Err(e),
}
}
}

Expand Down Expand Up @@ -834,7 +839,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