A fork of https://github.com/crosspoint-reader/crosspoint-reader
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: XTC 1-bit thumb BMP polarity inversion (#373)

## Summary

* **What is the goal of this PR?** (e.g., Implements the new feature for
file uploading.)
* **What changes are included?**

- Fix inverted colors in Continue Reading cover image for 1-bit XTC
files

## Additional Context

* Add any other information that might be helpful for the reviewer
(e.g., performance implications, potential risks,
specific areas to focus on).

- Fix `grayValue = pixelBit ? 0 : 255` → `grayValue = pixelBit ? 255 :
0` in `lib/Xtc/Xtc.cpp`
- The thumb BMP generation had inverted polarity compared to cover BMP
generation
- bit=0 should be black, bit=1 should be white (matching the BMP palette
order)
- Update misleading comment about XTC polarity

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**PARTIALLY**_

authored by

Eunchurn Park and committed by
GitHub
12940cc5 21277e03

+3 -3
+3 -3
lib/Xtc/Xtc.cpp
··· 203 203 coverBmp.write(reinterpret_cast<const uint8_t*>(&colorsImportant), 4); 204 204 205 205 // Color palette (2 colors for 1-bit) 206 - // XTC uses inverted polarity: 0 = black, 1 = white 206 + // XTC 1-bit polarity: 0 = black, 1 = white (standard BMP palette order) 207 207 // Color 0: Black (text/foreground in XTC) 208 208 uint8_t black[4] = {0x00, 0x00, 0x00, 0x00}; 209 209 coverBmp.write(black, 4); ··· 506 506 // Bounds check for buffer access 507 507 if (byteIdx < bitmapSize) { 508 508 const uint8_t pixelBit = (pageBuffer[byteIdx] >> bitIdx) & 1; 509 - // XTC polarity: 1=black, 0=white 510 - grayValue = pixelBit ? 0 : 255; 509 + // XTC 1-bit polarity: 0=black, 1=white (same as BMP palette) 510 + grayValue = pixelBit ? 255 : 0; 511 511 } 512 512 } 513 513