Skip to content

Conversation

@timhoffm
Copy link
Member

@timhoffm timhoffm commented Jan 15, 2026

This is a step towards #30503.

To have standard logical framework for blitting of widgets, we pull some logic up into AxesWidget:

  • Most widgets held a _useblit variable. This is now part of AxesWidget, and better explained there 😄
  • The new AxesWidget._should_use_blit() returns whether blitting should currently be done - i.e. the user/widget requested it and the canvas supports it. This is used to guard all blitting-related code.

Note: This is a well-defined and limited step towards standardization. Not all widgets are already using it. Some still have special logic. I anticipate that migrating them will be easier when this infrastructure and logical concept is present. Changes here are limited to obvious cases. The rest will be handled in a follow-up PR.

To have standard logical framework for blitting of widgets, we pull some
logic up into AxesWidget:
- Most widgets held a _useblit variable. This is now part of AxesWidget.
- AxesWidget._should_use_blit() returns whether blitting should
*currently* be done - i.e. the user/widget requested it and the canvas
supports it. This is used to guard all blitting-related code.

Note: This is a well-defined and limited step towards standardization.
Not all widgets are already using it. Some still have special logic. I
anticipate that migrating them will be easier when this infrastructure
and logical concept is present. Changes here are limited to obvious
cases. The rest will be handled in a follow-up PR.
@timhoffm timhoffm force-pushed the mnt-widget-blitting branch from 0dea978 to 4f153cf Compare January 15, 2026 22:09
if self.ignore(event) or self.canvas.is_saving():
return
if self.useblit:
if self._should_use_blit():
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This is a slight change from the static evaluation at init-time to runtime evaluation, but that is the correct thing to do because this is the standard guard for blitting code. Originally there was no difference between a static and a runtime check and we just hadn't decided so far which it should be here.

# If you add a call to `ignore` here, you'll want to check edge case:
# `release` can call a draw event even when `ignore` is True.
if not self.useblit:
if not self._should_use_blit():
Copy link
Member Author

@timhoffm timhoffm Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Same code as in the propertey useblit. This is a standard blitting-code guard. Therefore, I use our new method for that. the property will likely be removed in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant