Commit 1190dab9 authored by Matt Keeler's avatar Matt Keeler Committed by Peter van der meulen

Clippy Fixes and Glutin 0.18/Winit 0.17

parent 836a6d03
This diff is collapsed.
......@@ -20,7 +20,7 @@ notify = "4"
bitflags = "1"
font = { path = "./font" }
errno = "0.2"
parking_lot = "0.6.2"
parking_lot = "0.6"
serde = "1"
serde_derive = "1"
serde_json = "1"
......@@ -35,7 +35,7 @@ clap = "2"
fnv = "1"
unicode-width = "0.1"
arraydeque = "0.4"
glutin = "0.17"
glutin = "0.18"
env_logger = "0.5"
base64 = "0.9.0"
static_assertions = "0.2.5"
......
......@@ -15,6 +15,7 @@
//! The display subsystem including window management, font rasterization, and
//! GPU drawing.
use std::sync::mpsc;
use std::f64;
use parking_lot::{MutexGuard};
......@@ -162,8 +163,8 @@ impl Display {
let height = cell_height as u32 * dimensions.lines_u32();
let new_viewport_size = PhysicalSize::new(
(width + 2 * (config.padding().x as f64 * dpr) as u32) as f64,
(height + 2 * (config.padding().y as f64 * dpr) as u32) as f64);
f64::from(width + 2 * (f64::from(config.padding().x) * dpr) as u32),
f64::from(height + 2 * (f64::from(config.padding().y) * dpr) as u32) as f64);
window.set_inner_size(new_viewport_size.to_logical(dpr));
renderer.resize(new_viewport_size, dpr);
......@@ -178,8 +179,8 @@ impl Display {
height: viewport_size.height as f32,
cell_width: cell_width as f32,
cell_height: cell_height as f32,
padding_x: (config.padding().x as f64 * dpr).floor() as f32,
padding_y: (config.padding().y as f64 * dpr).floor() as f32,
padding_x: (f64::from(config.padding().x) * dpr).floor() as f32,
padding_y: (f64::from(config.padding().y) * dpr).floor() as f32,
};
// Channel for resize events
......@@ -293,17 +294,17 @@ impl Display {
let dpr = self.window.hidpi_factor();
// Font size/DPI factor modification detected
if terminal.font_size != self.font_size || dpr != self.size_info.dpr {
if terminal.font_size != self.font_size || (dpr - self.size_info.dpr).abs() > f64::EPSILON {
self.font_size = terminal.font_size;
self.size_info.dpr = dpr;
self.size_info.padding_x = (config.padding().x as f64 * dpr).floor() as f32;
self.size_info.padding_y = (config.padding().y as f64 * dpr).floor() as f32;
self.size_info.padding_x = (f64::from(config.padding().x) * dpr).floor() as f32;
self.size_info.padding_y = (f64::from(config.padding().y) * dpr).floor() as f32;
self.update_glyph_cache(config);
if new_size == None {
// Force a resize to refresh things
new_size = Some(PhysicalSize::new(self.size_info.width as f64,
self.size_info.height as f64));
new_size = Some(PhysicalSize::new(f64::from(self.size_info.width),
f64::from(self.size_info.height)));
}
}
......
......@@ -639,7 +639,7 @@ impl QuadRenderer {
while let Ok(msg) = self.rx.try_recv() {
match msg {
Msg::ShaderReload => {
self.reload_shaders(config, PhysicalSize::new(props.width as f64, props.height as f64), props.dpr);
self.reload_shaders(config, PhysicalSize::new(f64::from(props.width), f64::from(props.height)), props.dpr);
}
}
}
......@@ -721,8 +721,8 @@ impl QuadRenderer {
pub fn resize(&mut self, size: PhysicalSize, dpr: f64) {
let (width, height) : (u32, u32) = size.into();
let padding_x = (self.program.padding_x as f64 * dpr) as i32;
let padding_y = (self.program.padding_y as f64 * dpr) as i32;
let padding_x = (f64::from(self.program.padding_x) * dpr) as i32;
let padding_y = (f64::from(self.program.padding_y) * dpr) as i32;
// viewport
unsafe {
......@@ -1026,8 +1026,8 @@ impl ShaderProgram {
u_cell_dim: cell_dim,
u_visual_bell: visual_bell,
u_background: background,
padding_x: u8::from(config.padding().x),
padding_y: u8::from(config.padding().y),
padding_x: config.padding().x,
padding_y: config.padding().y,
};
shader.update_projection(size.width as f32, size.height as f32, dpr as f32);
......@@ -1038,8 +1038,8 @@ impl ShaderProgram {
}
fn update_projection(&self, width: f32, height: f32, dpr: f32) {
let padding_x = (self.padding_x as f32 * dpr).floor();
let padding_y = (self.padding_y as f32 * dpr).floor();
let padding_x = (f32::from(self.padding_x) * dpr).floor();
let padding_y = (f32::from(self.padding_y) * dpr).floor();
// Bounds check
if (width as u32) < (2 * padding_x as u32) ||
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment