Skip to content

Conversation

LaurenzV
Copy link
Contributor

@LaurenzV LaurenzV commented Sep 5, 2025

Fixes #1191.

let width = pixmap.width();
let height = pixmap.height();

if width != self.width || height != self.height {
Copy link
Contributor

Choose a reason for hiding this comment

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

Elsewhere, when invariants like this aren't obeyed, we typically panic:

https://github.com/linebender/vello/blob/main/sparse_strips%2Fvello_common%2Fsrc%2Fpixmap.rs#L43-L47

I'm wondering whether we should either return an Error or similarly panic (to at least be consistent).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question, I’m not sure.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the best option is allowing the consumer to decide what to do when they break an invariant (i.e. return an Error). Vello hybrid can return an Error type IIRC when spatiotemporal allocation suffers slot exhaustion.

Otherwise, I think it's fine to defer that to a larger review of this question and simply panic here (to be consistent with the rest of the system).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Creating a RenderContext and Pixmap with differing dimensions can result in a crash

2 participants