Commit 0cf79d39 authored by Jeremy Soller's avatar Jeremy Soller

Remove dependency on system crate

parent 399b4d02
......@@ -2,7 +2,7 @@
name = "orbclient"
description = "The Orbital Client Library"
repository = "https://github.com/redox-os/orbclient"
version = "0.1.13"
version = "0.1.14"
license-file = "LICENSE"
readme = "README.md"
keywords = ["orbital", "redox", "ui"]
......
extern crate system;
pub use self::display::*;
pub use self::window::*;
......
......@@ -5,7 +5,29 @@ use std::mem;
use std::slice;
use std::thread;
use super::system::graphics::fast_set;
#[cfg(target_arch = "x86")]
#[inline(always)]
#[cold]
pub unsafe fn fast_set32(dst: *mut u32, src: u32, len: usize) {
asm!("cld
rep stosd"
:
: "{edi}"(dst as usize), "{eax}"(src), "{ecx}"(len)
: "cc", "memory", "edi", "ecx"
: "intel", "volatile");
}
#[cfg(target_arch = "x86_64")]
#[inline(always)]
#[cold]
pub unsafe fn fast_set32(dst: *mut u32, src: u32, len: usize) {
asm!("cld
rep stosd"
:
: "{rdi}"(dst as usize), "{eax}"(src), "{rcx}"(len)
: "cc", "memory", "rdi", "rcx"
: "intel", "volatile");
}
use super::super::FONT;
use super::super::Event;
......@@ -209,7 +231,7 @@ impl Window {
#[allow(unused_variables)]
pub fn set(&mut self, color: Color) {
unsafe {
fast_set(self.data.as_mut_ptr() as *mut u32, color.data, self.data.len());
fast_set32(self.data.as_mut_ptr() as *mut u32, color.data, self.data.len());
}
}
......@@ -231,7 +253,7 @@ impl Window {
for y in start_y..end_y {
unsafe {
fast_set(self.data.as_mut_ptr().offset((y * self.w as i32 + start_x) as isize) as *mut u32, data, len as usize);
fast_set32(self.data.as_mut_ptr().offset((y * self.w as i32 + start_x) as isize) as *mut u32, data, len as usize);
}
}
}
......
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