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

redundant calls to finish() in wasm render method #868

Closed
cmyr opened this issue Apr 23, 2020 · 0 comments · Fixed by #870
Closed

redundant calls to finish() in wasm render method #868

cmyr opened this issue Apr 23, 2020 · 0 comments · Fixed by #870
Labels
shell/web concerns the web backend

Comments

@cmyr
Copy link
Member

cmyr commented Apr 23, 2020

Not sure exactly what's going on here, but it looks a bit suspicious:

I am not sure why we need to finish calls. For reference, I believe the code @jneem is referring to is in the render function

fn render(&self) -> bool {
    self.context
        .clear_rect(0.0, 0.0, self.get_width() as f64, self.get_height() as f64);
    let mut piet_ctx = piet_common::Piet::new(self.context.clone(), self.window.clone());
    let want_anim_frame = self.handler.borrow_mut().paint(&mut piet_ctx);
    if let Err(e) = piet_ctx.finish() {
        log::error!("piet error on render: {:?}", e);
    }
    let res = piet_ctx.finish();
    if let Err(e) = res {
        log::error!("EndDraw error: {:?}", e);
    }
    want_anim_frame
}

This part is over a year old. It does look redundant to me. After trying the examples without the second piet_ctx.finish(), I couldn't find any difference. I think it's safe to remove the second .finish() call.

Originally posted by @elrnv in #817 (comment)

@cmyr cmyr added the shell/web concerns the web backend label Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
shell/web concerns the web backend
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant