From 4cb915897c0712813c72caf564c79a3f4f9c87aa Mon Sep 17 00:00:00 2001 From: Eunchurn Park Date: Thu, 15 Jan 2026 00:52:17 +0900 Subject: [PATCH] Fix XTC 1-bit thumb BMP polarity inversion The thumb BMP generation for 1-bit XTC files had inverted polarity, causing the Continue Reading cover image to appear with inverted colors. - Fix: Change `grayValue = pixelBit ? 0 : 255` to `grayValue = pixelBit ? 255 : 0` to match the cover BMP generation logic where bit=0 is black and bit=1 is white - Update misleading comment about XTC polarity --- lib/Xtc/Xtc.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Xtc/Xtc.cpp b/lib/Xtc/Xtc.cpp index 7205ffb..c79421d 100644 --- a/lib/Xtc/Xtc.cpp +++ b/lib/Xtc/Xtc.cpp @@ -203,7 +203,7 @@ bool Xtc::generateCoverBmp() const { coverBmp.write(reinterpret_cast(&colorsImportant), 4); // Color palette (2 colors for 1-bit) - // XTC uses inverted polarity: 0 = black, 1 = white + // XTC 1-bit polarity: 0 = black, 1 = white (standard BMP palette order) // Color 0: Black (text/foreground in XTC) uint8_t black[4] = {0x00, 0x00, 0x00, 0x00}; coverBmp.write(black, 4); @@ -506,8 +506,8 @@ bool Xtc::generateThumbBmp() const { // Bounds check for buffer access if (byteIdx < bitmapSize) { const uint8_t pixelBit = (pageBuffer[byteIdx] >> bitIdx) & 1; - // XTC polarity: 1=black, 0=white - grayValue = pixelBit ? 0 : 255; + // XTC 1-bit polarity: 0=black, 1=white (same as BMP palette) + grayValue = pixelBit ? 255 : 0; } }