mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2024-12-23 19:31:30 +11:00
Remove the 'cast' dependency. (#208)
This commit is contained in:
parent
e504f1a3e2
commit
8efa8064c7
|
@ -26,7 +26,6 @@ png = "0.16"
|
||||||
cc = "1.0"
|
cc = "1.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cast = "0.2"
|
|
||||||
raw-window-handle = "0.3.3"
|
raw-window-handle = "0.3.3"
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies.winapi]
|
[target.'cfg(windows)'.dependencies.winapi]
|
||||||
|
|
|
@ -11,6 +11,7 @@ use crate::error::Error;
|
||||||
use crate::Result;
|
use crate::Result;
|
||||||
use crate::{CursorStyle, MenuHandle, UnixMenu};
|
use crate::{CursorStyle, MenuHandle, UnixMenu};
|
||||||
|
|
||||||
|
use std::convert::TryFrom;
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::os::raw;
|
use std::os::raw;
|
||||||
|
@ -148,9 +149,9 @@ impl DisplayInfo {
|
||||||
|
|
||||||
let gc = (lib.XDefaultGC)(display, screen);
|
let gc = (lib.XDefaultGC)(display, screen);
|
||||||
|
|
||||||
let screen_width = cast::usize((lib.XDisplayWidth)(display, screen))
|
let screen_width = usize::try_from((lib.XDisplayWidth)(display, screen))
|
||||||
.map_err(|e| Error::WindowCreate(format!("illegal width: {}", e)))?;
|
.map_err(|e| Error::WindowCreate(format!("illegal width: {}", e)))?;
|
||||||
let screen_height = cast::usize((lib.XDisplayHeight)(display, screen))
|
let screen_height = usize::try_from((lib.XDisplayHeight)(display, screen))
|
||||||
.map_err(|e| Error::WindowCreate(format!("illegal height: {}", e)))?;
|
.map_err(|e| Error::WindowCreate(format!("illegal height: {}", e)))?;
|
||||||
|
|
||||||
// andrewj: using this instead of XUniqueContext(), as the latter
|
// andrewj: using this instead of XUniqueContext(), as the latter
|
||||||
|
@ -947,8 +948,8 @@ impl Window {
|
||||||
self.free_image();
|
self.free_image();
|
||||||
self.ximage = Self::alloc_image(
|
self.ximage = Self::alloc_image(
|
||||||
&self.d,
|
&self.d,
|
||||||
cast::usize(self.width),
|
self.width as usize,
|
||||||
cast::usize(self.height),
|
self.height as usize,
|
||||||
&mut self.draw_buffer,
|
&mut self.draw_buffer,
|
||||||
)
|
)
|
||||||
.expect("todo");
|
.expect("todo");
|
||||||
|
|
Loading…
Reference in a new issue