mirror of
https://github.com/itsjunetime/tdf.git
synced 2026-06-02 08:01:47 -04:00
Don't tint if colors are default
This commit is contained in:
@@ -24,7 +24,7 @@ const FILES: [&str; 3] = [
|
||||
];
|
||||
|
||||
const BLACK: i32 = 0;
|
||||
const WHITE: i32 = 1000;
|
||||
const WHITE: i32 = i32::from_be_bytes([0, 0xff, 0xff, 0xff]);
|
||||
|
||||
fn render_full(c: &mut Criterion) {
|
||||
for file in FILES {
|
||||
|
||||
@@ -309,6 +309,7 @@ fn on_notify_ev(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_color_to_i32(cs: &str) -> Result<i32, csscolorparser::ParseColorError> {
|
||||
let color = csscolorparser::parse(cs)?;
|
||||
let [r, g, b, _] = color.to_rgba8();
|
||||
|
||||
+4
-1
@@ -52,6 +52,9 @@ struct PrevRender {
|
||||
num_search_found: Option<usize>
|
||||
}
|
||||
|
||||
const MUPDF_BLACK: i32 = 0;
|
||||
const MUPDF_WHITE: i32 = i32::from_be_bytes([0, 0xff, 0xff, 0xff]);
|
||||
|
||||
#[inline]
|
||||
pub fn fill_default<T: Default>(vec: &mut Vec<T>, size: usize) {
|
||||
vec.clear();
|
||||
@@ -468,7 +471,7 @@ fn render_single_page_to_ctx(
|
||||
let mut pixmap = page.to_pixmap(&matrix, &colorspace, false, false)?;
|
||||
if invert {
|
||||
pixmap.tint(white, black)?;
|
||||
} else {
|
||||
} else if black != MUPDF_BLACK || white != MUPDF_WHITE {
|
||||
pixmap.tint(black, white)?;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user