Skip to content

Commit

Permalink
Attempt workaround for broken scissoring
Browse files Browse the repository at this point in the history
Refs khonsulabs/cushy#93

This appears to work around the issue on the GL backend. I cannot
currently reproduce this behavior in a simpler example. This should have
no effect, as the documentation for set_scissor_rect states that it
should only affect future drawing calls... but clearly there are no
future drawing calls being done at the point of dropping the graphics.
  • Loading branch information
ecton committed Dec 27, 2023
1 parent 8b0f1da commit 9c04302
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,20 @@ impl Clipped for RenderingGraphics<'_, '_> {

impl sealed::Clipped for RenderingGraphics<'_, '_> {}

impl Drop for RenderingGraphics<'_, '_> {
fn drop(&mut self) {
// This shouldn't be necessary, but under the GL backend, Gooey only
// renders the final widget/clipped region. By setting this, it makes
// Gooey work on this backend.
self.pass.set_scissor_rect(
0,
0,
self.kludgine.size.width.get(),
self.kludgine.size.height.get(),
);
}
}

/// A clipped surface.
///
/// When dropped, the clipped type will have its clip rect restored to the
Expand Down

0 comments on commit 9c04302

Please sign in to comment.