-
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?
Conversation
@@ -205,6 +205,28 @@ pub struct Buffer<'a, D, W> { | |||
} | |||
|
|||
impl<D: HasDisplayHandle, W: HasWindowHandle> Buffer<'_, D, W> { | |||
/// 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 comment
The reason will be displayed to describe this comment to others. Learn more.
I went with usize
here, since it was just much more usable in examples.
I'd like to change resize
to follow this direction as well, see:
#238
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 would prefer NonZeroU32
to accurately reflect the type information.
@@ -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 comment
The 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?
6789eff
to
344f8b7
Compare
344f8b7
to
3f255f4
Compare
Part of #237.
I've decided to return these in pixels corresponding to the surface/buffer itself, as that's what Softbuffer concerns itself with. If the user wants to render at the current screen DPI, they either need to multiply by a scaling factor themselves, or size the buffer using logical sizes and rely on the compositor to upscale it (which we don't yet expose knobs to control, but which we could in the future).