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

+1 -3
View File
@@ -224,7 +224,7 @@ static fz_matrix placed(fz_rect box, float scale, int rotate)
/* Paints device pixels x, y, w, h as BGRA. */
int ely_render(fz_context *ctx, fz_document *doc, int number, float scale, int rotate,
const int tile[4], int dark, unsigned char *bgra)
const int tile[4], unsigned char *bgra)
{
fz_page *page = NULL;
fz_pixmap *pix = NULL;
@@ -242,8 +242,6 @@ int ely_render(fz_context *ctx, fz_document *doc, int number, float scale, int r
dev = fz_new_draw_device(ctx, fz_identity, pix);
fz_run_page(ctx, page, dev, ctm, NULL);
fz_close_device(ctx, dev);
if (dark)
fz_invert_pixmap_luminance(ctx, pix);
int stride = (int)fz_pixmap_stride(ctx, pix);
unsigned char *rows = fz_pixmap_samples(ctx, pix);
for (int y = 0; y < tile[3]; y++)
+1 -1
View File
@@ -7,7 +7,7 @@
int ely_fail(fz_context *ctx);
const char *ely_error(void);
int ely_render(fz_context *ctx, fz_document *doc, int number, float scale, int rotate, const int tile[4], int dark,
int ely_render(fz_context *ctx, fz_document *doc, int number, float scale, int rotate, const int tile[4],
unsigned char *bgra);
void ely_fail_also(fz_context *ctx, const char *what);
pdf_document *ely_pdf_of(fz_context *ctx, fz_document *doc);
+1 -1
View File
@@ -244,7 +244,7 @@ static void preview(fz_context *ctx, pdf_document *pdf, int number, int block, c
tile[0] = (int)floorf(region.x0 * scale), tile[1] = (int)floorf(region.y0 * scale);
tile[2] = (int)ceilf(region.x1 * scale) - tile[0], tile[3] = (int)ceilf(region.y1 * scale) - tile[1];
*pixels = fz_malloc(ctx, (size_t)tile[2] * tile[3] * 4);
if (ely_render(ctx, copy, number, scale, 0, tile, 0, *pixels) < 0)
if (ely_render(ctx, copy, number, scale, 0, tile, *pixels) < 0)
fz_throw(ctx, FZ_ERROR_GENERIC, "%s", ely_error());
*w = tile[2], *h = tile[3];
}