-
Notifications
You must be signed in to change notification settings - Fork 61
Add Buffer::width
and Buffer::height
#269
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: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,6 +205,28 @@ pub struct Buffer<'a, D, W> { | |
} | ||
|
||
impl<D: HasDisplayHandle, W: HasWindowHandle> Buffer<'_, D, W> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit unsure whether these should go on the buffer or the surface? Or does it make sense both places? |
||
/// The amount of pixels wide the buffer is. | ||
pub fn width(&self) -> usize { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I went with I'd like to change |
||
let width = self.buffer_impl.width(); | ||
debug_assert_eq!( | ||
width * self.buffer_impl.height(), | ||
self.len(), | ||
"buffer must be sized correctly" | ||
); | ||
width | ||
} | ||
|
||
/// The amount of pixels tall the buffer is. | ||
pub fn height(&self) -> usize { | ||
let height = self.buffer_impl.height(); | ||
debug_assert_eq!( | ||
height * self.buffer_impl.width(), | ||
self.len(), | ||
"buffer must be sized correctly" | ||
); | ||
height | ||
} | ||
|
||
/// `age` is the number of frames ago this buffer was last presented. So if the value is | ||
/// `1`, it is the same as the last frame, and if it is `2`, it is the same as the frame | ||
/// before that (for backends using double buffering). If the value is `0`, it is a new | ||
|
Uh oh!
There was an error while loading. Please reload this page.