We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1b4e11a commit 384bcccCopy full SHA for 384bccc
src/drawing/backend_impl/canvas.rs
@@ -74,10 +74,11 @@ impl DrawingBackend for CanvasBackend {
74
75
fn get_size(&self) -> (u32, u32) {
76
// Getting just canvas.width gives poor results on HighDPI screens.
77
- let window = window()?;
+ let window = window().unwrap();
78
let mut dpr = window.device_pixel_ratio();
79
- dpr = if dpr == 0 { 1 } else { dpr };
80
- ((canvas.width() as f64 / dpr) as u32, (canvas.height() as f64 / dpr) as u32)
+ dpr = if dpr == 0.0 { 1.0 } else { dpr };
+ ((self.canvas.width() as f64 / dpr) as u32,
81
+ (self.canvas.height() as f64 / dpr) as u32)
82
}
83
84
fn ensure_prepared(&mut self) -> Result<(), DrawingErrorKind<CanvasError>> {
0 commit comments