Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ source = []
bitflags = "2.4"
byteorder = "1.2"
float-ord = "0.3"
lazy_static = "1.1"
libc = "0.2"
log = "0.4.4"
pathfinder_geometry = "0.5"
Expand Down
32 changes: 18 additions & 14 deletions src/canvas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,33 @@

//! An in-memory bitmap surface for glyph rasterization.

use lazy_static::lazy_static;
use pathfinder_geometry::rect::RectI;
use pathfinder_geometry::vector::Vector2I;
use std::cmp;
use std::fmt;

use crate::utils;

lazy_static! {
static ref BITMAP_1BPP_TO_8BPP_LUT: [[u8; 8]; 256] = {
let mut lut = [[0; 8]; 256];
for byte in 0..0x100 {
let mut value = [0; 8];
for bit in 0..8 {
if (byte & (0x80 >> bit)) != 0 {
value[bit] = 0xff;
}
static BITMAP_1BPP_TO_8BPP_LUT: [[u8; 8]; 256] = {
let mut lut = [[0; 8]; 256];

let mut byte = 0;
while byte < 0x100 {
let mut value = [0; 8];

let mut bit = 0;
while bit < 8 {
if (byte & (0x80 >> bit)) != 0 {
value[bit] = 0xff;
}
lut[byte] = value
bit += 1;
}
lut
};
}

lut[byte] = value;
byte += 1;
}
lut
};

/// An in-memory bitmap surface for glyph rasterization.
pub struct Canvas {
Expand Down