Skip to content

Instantly share code, notes, and snippets.

Joe C mooman219

Block or report user

Report or block mooman219

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View garbo.rs
#![allow(non_camel_case_types)]
use core::ops::{Add, AddAssign, Mul, MulAssign, Sub, SubAssign};
#[cfg(target_arch = "x86")]
use core::arch::x86::*;
#[cfg(target_arch = "x86_64")]
use core::arch::x86_64::*;
#[derive(Copy, Clone)]
View raster.rs
pub fn get_bitmap(&self) -> Vec<u8> {
let length = self.w * self.h;
let aligned_length = (length + 3) & !3;
assert!(aligned_length <= self.a.len());
let mut output = vec![0; aligned_length];
unsafe {
// offset = Zeroed out lanes
let mut offset = _mm_setzero_ps();
// lookup = The 4 bytes (12, 8, 4, 0) in all lanes
let lookup = _mm_set1_epi32(0x0c_08_04_00);
View raster.rs
pub fn get_bitmap(&self) -> Vec<u8> {
let length = self.w * self.h;
let aligned_length = (length + 3) & !3;
assert!(aligned_length - 1 <= self.a.len());
let mut output = vec![0; aligned_length];
unsafe {
// offset = Zeroed out lanes
let mut offset = _mm_setzero_ps();
// lookup = The 4 bytes (12, 8, 4, 0) in all lanes
let lookup = _mm_set1_epi32(0x0c_08_04_00);
View accumulation.rs
#[cfg(all(target_feature = "sse", any(target_arch = "x86", target_arch = "x86_64")))]
pub fn get_bitmap(&self) -> Vec<u8> {
let length = self.w * self.h;
let aligned_length = (length + 3) & !3;
let mut output = Vec::with_capacity(aligned_length);
unsafe {
output.set_len(aligned_length);
// offset = Zeroed out lanes
let mut offset = _mm_setzero_ps();
// lookup = The 4 bytes (12, 8, 4, 0) in all lanes
View raster.rs
use crate::math::Polygons;
use alloc::vec;
use alloc::vec::*;
pub struct Raster {
w: usize,
h: usize,
a: Vec<f32>,
}
View raster.rs
// MIT
#[inline(always)]
pub fn line(
&mut self,
x0: f32,
y0: f32,
x1: f32,
y1: f32,
) {
let dy = y1 - y0;
View Base 1.3
0eNrdvU1vnLmSNfhXL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StfH4a3e/bQuvt0bz9c1dzm/OVkWMmsN0eWMFcdb6Pet86kX1XTsDFh1r2bb1by8S1hxnnrrblTpsFl74ZjbbrwwLx+qHtfedu6wDy1vZ0uw9sCJs1WKmGXcKFWahyTJ4z4xzRVb7rUD11nPADa/IIEzJFIThHHrKGv8iyjJwZIUBTCGiLkOMJm2aGgEECHDY5QLDtoCgF04BkOkS9LcE5BwBYCh1ARC0lBwBbIYK4jFoqCgC2Q0ZQRi4KCgC2Q4RQRC01BgBYCmU6+bCE4BQFb4NKZRSQkgQA74LIZ+xCKQIAdcMmMREIUBALsgMtl5OcQmkAAHSQulZFtQnICAXbAZTKyYUpJIMAOuExGjg6pCATYAZfJyBkqCwIBdsBlMtIlpCYQgkOojVO9LB/aaBJKWW1CA2W7++Kz6fppbSEzroWWuc7n7plBkHTqvDNpG2rey3buvwmrDt6ezf4PsvCW8QcIBrVJ
View fontdue.todo
Current todo for 1.0:
- Raster rewrite
- Metrics is incomplete
- Layout utility is incomplete
- Kerning is missing
View current line.rs
pub fn draw_line(&mut self, p0: &Point, p1: &Point) {
if p0.y == p1.y {
return;
}
let (dir, p0, p1) = if p0.y < p1.y {
(1.0, p0, p1)
} else {
(-1.0, p1, p0)
};
let dxdy = (p1.x - p0.x) / (p1.y - p0.y);
You can’t perform that action at this time.