Remove scale_factor from iced_wgpu::Viewport
This commit is contained in:
parent
8edb04fddd
commit
8f0b59a4b2
6 changed files with 12 additions and 15 deletions
|
|
@ -1,31 +1,28 @@
|
|||
use crate::Transformation;
|
||||
|
||||
/// A viewing region for displaying computer graphics.
|
||||
#[derive(Debug)]
|
||||
pub struct Viewport {
|
||||
width: u32,
|
||||
height: u32,
|
||||
scale_factor: f32,
|
||||
transformation: Transformation,
|
||||
}
|
||||
|
||||
impl Viewport {
|
||||
pub fn new(width: u32, height: u32, scale_factor: f64) -> Viewport {
|
||||
/// Creates a new [`Viewport`] with the given dimensions.
|
||||
pub fn new(width: u32, height: u32) -> Viewport {
|
||||
Viewport {
|
||||
width,
|
||||
height,
|
||||
scale_factor: scale_factor as f32,
|
||||
transformation: Transformation::orthographic(width, height),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the dimensions of the [`Viewport`].
|
||||
pub fn dimensions(&self) -> (u32, u32) {
|
||||
(self.width, self.height)
|
||||
}
|
||||
|
||||
pub fn scale_factor(&self) -> f32 {
|
||||
self.scale_factor
|
||||
}
|
||||
|
||||
pub(crate) fn transformation(&self) -> Transformation {
|
||||
self.transformation
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue