-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Fix Image pixel access error propagation for compressed formats #22908
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
base: main
Are you sure you want to change the base?
Conversation
|
i can also add |
|
It looks like your PR is a breaking change, but you didn't provide a migration guide. Please review the instructions for writing migration guides, then expand or revise the content in the migration guides directory to reflect your changes. |
alice-i-cecile
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally like this, and I think the regression test is fine. A few comments:
- Needs a simple migration guide.
- Can we flatten out the
Result<Optionreturn types? Is returningOk(None)actually useful here, or should that just be a new kind of error? If we'd like to keep them, we should be very clear in the docs whatOk(None)means.
|
i think ive documented all functions with:
adding a new kind of error is what im proposing here
so it can replace the |
|
I prefer |
|
should be good now :) |
… types - Add TextureAccessError::Uninitialized variant for when image data is not initialized - Change pixel_bytes from Result<Option<&[u8]>, _> to Result<&[u8], _> - Change pixel_bytes_mut from Result<Option<&mut [u8]>, _> to Result<&mut [u8], _> - Change pixel_data_offset from Result<Option<usize>, _> to Result<usize, _> - Remove redundant return type commentary from rustdoc - Update cpu_draw example for new API - Update migration guide
13f444c to
cfd7222
Compare
follow up to #22414
in my comment #22414 (comment) i realized the warn added in #22414 would never actually trigger because
pixel_bytesandpixel_bytes_mutwere returningOptioninstead ofResult, which caused theUnsupportedTextureFormaterror to be lost and converted toOutOfBounds.this changes:
pixel_data_offsetnow returnsResultinstead ofOptionpixel_bytesandpixel_bytes_mutnow returnResultinstead ofOptioncompressed_texture_format_is_reported_correctlyexamples/2d/cpu_draw.rsfor the new signatureshould i remove the regression test if it's useless ?
thanks