-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add an iterator over XFB rows #25
Conversation
acbc539
to
2ba40c5
Compare
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.
Besides one small issue it all looks awesome!
Now that the `exposed_provenance` and `strict_provenance` features have been stabilized, we can migrate to its definitive functions. This change is undefined behaviour though, but `as *mut u32` was similarly UB, so we just trade one UB for another… `core::ptr`’s documentation says: > Situations where a valid pointer must be created from just an address, > such as baremetal code accessing a memory-mapped interface at a fixed > address, are an open question on how to support. These situations will > still be allowed, but we might require some kind of “I know what I’m > doing” annotation to explain the situation to the compiler. It’s also > possible they need no special attention at all, because they’re > generally accessing memory outside the scope of “the abstract machine”, > or already using “I know what I’m doing” annotations like “volatile”.
luma_core/src/vi.rs
Outdated
impl<'a> Iterator for XfbIterMut<'a> { | ||
type Item = &'a mut [u16]; | ||
|
||
fn next(&mut self) -> Option<&'a mut [u16]> { |
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.
would self.xfb.data.chunks_mut(self.xfb.stride_in_u16()).next()
work here?
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.
I’ve ended up replacing the whole XfbIterMut
struct with ChunksMut
, which already does the exact same and more.
I think there is a better way to implement |
This emits slices of u16, and allows users to not use unsafe for drawing.
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.
Looks good :)
This emits slices of
u16
, and allows users to not use unsafe for drawing.This is based on #21, since it wouldn’t build on current nightly otherwise.