Remove rusttype support from vesad
It is never enabled and would add a fair amount of complexity to a system service which has effective root access despite sandboxing due to being able to read and write display contents and input device events.
This commit is contained in:
Generated
+1
-52
@@ -120,15 +120,6 @@ name = "arg_parser"
|
||||
version = "0.1.0"
|
||||
source = "git+https://gitlab.redox-os.org/redox-os/arg-parser.git#1c434b55f3e1a0375ebcca85b3e88db7378e82fa"
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.4.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9"
|
||||
dependencies = [
|
||||
"nodrop",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.5.2"
|
||||
@@ -684,12 +675,6 @@ version = "0.2.147"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
|
||||
|
||||
[[package]]
|
||||
name = "linked-hash-map"
|
||||
version = "0.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
|
||||
|
||||
[[package]]
|
||||
name = "lived"
|
||||
version = "0.1.0"
|
||||
@@ -762,12 +747,6 @@ dependencies = [
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nodrop"
|
||||
version = "0.1.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
|
||||
|
||||
[[package]]
|
||||
name = "ntpclient"
|
||||
version = "0.0.1"
|
||||
@@ -807,7 +786,7 @@ checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef"
|
||||
name = "nvmed"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"arrayvec 0.5.2",
|
||||
"arrayvec",
|
||||
"bitflags 1.3.2",
|
||||
"block-io-wrapper",
|
||||
"common",
|
||||
@@ -1210,17 +1189,6 @@ version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
||||
|
||||
[[package]]
|
||||
name = "rusttype"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8d729e72445ad579171b01a9231657736b3793a2cf423078e687e20ecb8695a"
|
||||
dependencies = [
|
||||
"arrayvec 0.4.12",
|
||||
"linked-hash-map",
|
||||
"stb_truetype 0.2.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.15"
|
||||
@@ -1387,24 +1355,6 @@ version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "stb_truetype"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9d1bec4382294c5a680fcebd29f8451e8d8c04479a026f6909004e2ab1cb425d"
|
||||
dependencies = [
|
||||
"stb_truetype 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stb_truetype"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f77b6b07e862c66a9f3e62a07588fee67cd90a9135a2b942409f195507b4fb51"
|
||||
dependencies = [
|
||||
"byteorder 1.4.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.8.0"
|
||||
@@ -1711,7 +1661,6 @@ dependencies = [
|
||||
"ransid",
|
||||
"redox-daemon",
|
||||
"redox_syscall 0.4.1",
|
||||
"rusttype",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -6,7 +6,6 @@ edition = "2018"
|
||||
[dependencies]
|
||||
orbclient = "0.3.27"
|
||||
ransid = "0.4"
|
||||
rusttype = { version = "0.2", optional = true }
|
||||
redox_syscall = "0.4"
|
||||
redox-daemon = "0.1"
|
||||
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
|
||||
Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
|
||||
|
||||
Bitstream Vera Fonts Copyright
|
||||
------------------------------
|
||||
|
||||
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
|
||||
a trademark of Bitstream, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of the fonts accompanying this license ("Fonts") and associated
|
||||
documentation files (the "Font Software"), to reproduce and distribute the
|
||||
Font Software, including without limitation the rights to use, copy, merge,
|
||||
publish, distribute, and/or sell copies of the Font Software, and to permit
|
||||
persons to whom the Font Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright and trademark notices and this permission notice shall
|
||||
be included in all copies of one or more of the Font Software typefaces.
|
||||
|
||||
The Font Software may be modified, altered, or added to, and in particular
|
||||
the designs of glyphs or characters in the Fonts may be modified and
|
||||
additional glyphs or characters may be added to the Fonts, only if the fonts
|
||||
are renamed to names not containing either the words "Bitstream" or the word
|
||||
"Vera".
|
||||
|
||||
This License becomes null and void to the extent applicable to Fonts or Font
|
||||
Software that has been modified and is distributed under the "Bitstream
|
||||
Vera" names.
|
||||
|
||||
The Font Software may be sold as part of a larger software package but no
|
||||
copy of one or more of the Font Software typefaces may be sold by itself.
|
||||
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
|
||||
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
|
||||
FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
|
||||
ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
|
||||
FONT SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the names of Gnome, the Gnome
|
||||
Foundation, and Bitstream Inc., shall not be used in advertising or
|
||||
otherwise to promote the sale, use or other dealings in this Font Software
|
||||
without prior written authorization from the Gnome Foundation or Bitstream
|
||||
Inc., respectively. For further information, contact: fonts at gnome dot
|
||||
org.
|
||||
|
||||
Arev Fonts Copyright
|
||||
------------------------------
|
||||
|
||||
Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the fonts accompanying this license ("Fonts") and
|
||||
associated documentation files (the "Font Software"), to reproduce
|
||||
and distribute the modifications to the Bitstream Vera Font Software,
|
||||
including without limitation the rights to use, copy, merge, publish,
|
||||
distribute, and/or sell copies of the Font Software, and to permit
|
||||
persons to whom the Font Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright and trademark notices and this permission notice
|
||||
shall be included in all copies of one or more of the Font Software
|
||||
typefaces.
|
||||
|
||||
The Font Software may be modified, altered, or added to, and in
|
||||
particular the designs of glyphs or characters in the Fonts may be
|
||||
modified and additional glyphs or characters may be added to the
|
||||
Fonts, only if the fonts are renamed to names not containing either
|
||||
the words "Tavmjong Bah" or the word "Arev".
|
||||
|
||||
This License becomes null and void to the extent applicable to Fonts
|
||||
or Font Software that has been modified and is distributed under the
|
||||
"Tavmjong Bah Arev" names.
|
||||
|
||||
The Font Software may be sold as part of a larger software package but
|
||||
no copy of one or more of the Font Software typefaces may be sold by
|
||||
itself.
|
||||
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
|
||||
TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of Tavmjong Bah shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other
|
||||
dealings in this Font Software without prior written authorization
|
||||
from Tavmjong Bah. For further information, contact: tavmjong @ free
|
||||
. fr.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,25 +1,9 @@
|
||||
#[cfg(feature="rusttype")]
|
||||
extern crate rusttype;
|
||||
|
||||
use std::alloc::{self, Layout};
|
||||
use std::{cmp, ptr};
|
||||
use std::ptr::NonNull;
|
||||
|
||||
#[cfg(feature="rusttype")]
|
||||
use self::rusttype::{Font, FontCollection, Scale, point};
|
||||
|
||||
#[cfg(not(feature="rusttype"))]
|
||||
use orbclient::FONT;
|
||||
|
||||
#[cfg(feature="rusttype")]
|
||||
static FONT: &'static [u8] = include_bytes!("../res/DejaVuSansMono.ttf");
|
||||
#[cfg(feature="rusttype")]
|
||||
static FONT_BOLD: &'static [u8] = include_bytes!("../res/DejaVuSansMono-Bold.ttf");
|
||||
#[cfg(feature="rusttype")]
|
||||
static FONT_BOLD_ITALIC: &'static [u8] = include_bytes!("../res/DejaVuSansMono-BoldOblique.ttf");
|
||||
#[cfg(feature="rusttype")]
|
||||
static FONT_ITALIC: &'static [u8] = include_bytes!("../res/DejaVuSansMono-Oblique.ttf");
|
||||
|
||||
pub struct OffscreenBuffer {
|
||||
ptr: NonNull<[u32]>,
|
||||
}
|
||||
@@ -63,18 +47,9 @@ pub struct Display {
|
||||
pub width: usize,
|
||||
pub height: usize,
|
||||
pub offscreen: OffscreenBuffer,
|
||||
#[cfg(feature="rusttype")]
|
||||
pub font: Font<'static>,
|
||||
#[cfg(feature="rusttype")]
|
||||
pub font_bold: Font<'static>,
|
||||
#[cfg(feature="rusttype")]
|
||||
pub font_bold_italic: Font<'static>,
|
||||
#[cfg(feature="rusttype")]
|
||||
pub font_italic: Font<'static>
|
||||
}
|
||||
|
||||
impl Display {
|
||||
#[cfg(not(feature="rusttype"))]
|
||||
pub fn new(width: usize, height: usize) -> Display {
|
||||
let size = width * height;
|
||||
let offscreen = OffscreenBuffer::new(size);
|
||||
@@ -85,21 +60,6 @@ impl Display {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature="rusttype")]
|
||||
pub fn new(width: usize, height: usize) -> Display {
|
||||
let size = width * height;
|
||||
let offscreen = OffscreenBuffer::new(size);
|
||||
Display {
|
||||
width,
|
||||
height,
|
||||
offscreen,
|
||||
font: FontCollection::from_bytes(FONT).into_font().unwrap(),
|
||||
font_bold: FontCollection::from_bytes(FONT_BOLD).into_font().unwrap(),
|
||||
font_bold_italic: FontCollection::from_bytes(FONT_BOLD_ITALIC).into_font().unwrap(),
|
||||
font_italic: FontCollection::from_bytes(FONT_ITALIC).into_font().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn resize(&mut self, width: usize, height: usize) {
|
||||
if width != self.width || height != self.height {
|
||||
println!("Resize display to {}, {}", width, height);
|
||||
@@ -209,7 +169,6 @@ impl Display {
|
||||
}
|
||||
|
||||
/// Draw a character
|
||||
#[cfg(not(feature="rusttype"))]
|
||||
pub fn char(&mut self, x: usize, y: usize, character: char, color: u32, _bold: bool, _italic: bool) {
|
||||
if x + 8 <= self.width && y + 16 <= self.height {
|
||||
let mut dst = self.offscreen.as_mut_ptr() as usize + (y * self.width + x) * 4;
|
||||
@@ -229,59 +188,6 @@ impl Display {
|
||||
}
|
||||
}
|
||||
|
||||
/// Draw a character
|
||||
#[cfg(feature="rusttype")]
|
||||
pub fn char(&mut self, x: usize, y: usize, character: char, color: u32, bold: bool, italic: bool) {
|
||||
let width = self.width;
|
||||
let height = self.height;
|
||||
let offscreen = self.offscreen.as_mut_ptr() as usize;
|
||||
|
||||
let font = if bold && italic {
|
||||
&self.font_bold_italic
|
||||
} else if bold {
|
||||
&self.font_bold
|
||||
} else if italic {
|
||||
&self.font_italic
|
||||
} else {
|
||||
&self.font
|
||||
};
|
||||
|
||||
if let Some(glyph) = font.glyph(character){
|
||||
let scale = Scale::uniform(16.0);
|
||||
let v_metrics = font.v_metrics(scale);
|
||||
let point = point(0.0, v_metrics.ascent);
|
||||
let glyph = glyph.scaled(scale).positioned(point);
|
||||
if let Some(bb) = glyph.pixel_bounding_box() {
|
||||
glyph.draw(|off_x, off_y, v| {
|
||||
let off_x = x + (off_x as i32 + bb.min.x) as usize;
|
||||
let off_y = y + (off_y as i32 + bb.min.y) as usize;
|
||||
// There's still a possibility that the glyph clips the boundaries of the bitmap
|
||||
if off_x < width && off_y < height {
|
||||
if v > 0.0 {
|
||||
let f_a = (v * 255.0) as u32;
|
||||
let f_r = (((color >> 16) & 0xFF) * f_a)/255;
|
||||
let f_g = (((color >> 8) & 0xFF) * f_a)/255;
|
||||
let f_b = ((color & 0xFF) * f_a)/255;
|
||||
|
||||
let offscreen_ptr = (offscreen + (off_y * width + off_x) * 4) as *mut u32;
|
||||
|
||||
let bg = unsafe { *offscreen_ptr };
|
||||
|
||||
let b_a = 255 - f_a;
|
||||
let b_r = (((bg >> 16) & 0xFF) * b_a)/255;
|
||||
let b_g = (((bg >> 8) & 0xFF) * b_a)/255;
|
||||
let b_b = ((bg & 0xFF) * b_a)/255;
|
||||
|
||||
let c = ((f_r + b_r) << 16) | ((f_g + b_g) << 8) | (f_b + b_b);
|
||||
|
||||
unsafe { *offscreen_ptr = c; }
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Copy from offscreen to onscreen
|
||||
pub fn sync(&mut self, x: usize, y: usize, w: usize, h: usize, onscreen: &mut [u32], stride: usize) {
|
||||
let start_y = cmp::min(self.height, y);
|
||||
|
||||
Reference in New Issue
Block a user