R8.1: document content keeps the file's colours in a dark app

Pages, cells, slides and PDF pages paint as the file says in any
appearance; only the chrome around them follows dark mode. The
kernel keeps Ely's one light scheme, sent once a view, and MuPDF
no longer inverts. Reviews now run gpt-6.1-sol at xhigh.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude committed 2026-10-18 19:42:13 -04:00
1 parent d4cb274749
commit 6f1eebb4b5
42 files changed
+204 -209

No files matched your search

@@ -31,7 +31,6 @@ unsafe extern "C" {
scale: f32,
rotate: c_int,
tile: *const c_int,
dark: c_int,
bgra: *mut u8,
) -> c_int;
fn ely_text(
@@ -143,7 +142,6 @@ impl Mupdf {
number: usize,
(scale, rotate): (f32, i32),
tile: [i32; 4],
dark: bool,
) -> io::Result<Vec<u8>> {
let (w, h) = (usize::try_from(tile[2]), usize::try_from(tile[3]));
let (Ok(w), Ok(h)) = (w, h) else {
@@ -158,7 +156,6 @@ impl Mupdf {
scale,
rotate,
tile.as_ptr(),
c_int::from(dark),
pixels.as_mut_ptr(),
)
};
@@ -403,8 +403,7 @@ impl Worker {
for value in &mut tile {
*value = i32::try_from(ask.i64()?).map_err(io::Error::other)?;
}
let dark = ask.u64()? != 0;
self.drawn(id, page, (scale, rotate), tile, dark)
self.drawn(id, page, (scale, rotate), tile)
}
tag::TEXT => {
let (id, page) = (ask.u64()?, ask.u64()? as usize);
@@ -101,9 +101,9 @@ impl crate::Worker {
}
/// A tile, and whether drawing it met damage.
pub(crate) fn drawn(&mut self, id: u64, page: usize, view: (f32, i32), tile: [i32; 4], dark: bool) -> io::Result<Vec<u8>> {
pub(crate) fn drawn(&mut self, id: u64, page: usize, view: (f32, i32), tile: [i32; 4]) -> io::Result<Vec<u8>> {
unsafe { ely_watch_begin(self.mupdf.ctx) };
let pixels = self.mupdf.render(self.doc(id)?, page, view, tile, dark);
let pixels = self.mupdf.render(self.doc(id)?, page, view, tile);
let warned = unsafe { ely_watch_end(self.mupdf.ctx) } != 0;
if warned {
self.note_damage(id)?;
+1 -2
View File
@@ -242,7 +242,6 @@ impl Worker {
page: usize,
(scale, rotate): (f32, i32),
tile: [i32; 4],
dark: bool,
) -> io::Result<Tile> {
let mut ask = self.on(&doc)?
.u64(page as u64)
@@ -251,7 +250,7 @@ impl Worker {
for value in tile {
ask = ask.i64(i64::from(value));
}
let reply = self.request(tag::RENDER, &ask.u64(u64::from(dark)).bytes())?;
let reply = self.request(tag::RENDER, &ask.bytes())?;
let mut reply = Unpack::new(&reply);
let (damaged, bgra) = (reply.u64()? != 0, reply.blob()?);
match bgra.len() == tile[2] as usize * tile[3] as usize * 4 {