Commit Graph
118 Commits
Author SHA1 Message Date
jpirnay b96be90a0c Fix log 2026-05-11 22:56:51 +02:00
jpirnay c273e250f2 Implement sparse css cache plus dynamic banding for AA 2026-05-11 22:27:13 +02:00
jpirnay b43ba8059b Height-only upscaling still never takes effect 2026-05-08 23:51:46 +02:00
jpirnay 79ef2eea91 Some fixes for cover generation 2026-05-08 18:04:41 +02:00
jpirnay 4005bf55e5 Add Lyra Carousel home theme 2026-05-07 23:42:35 +02:00
jpirnay 1ca18c4575 Revert to same quantization thresholds as in upstream 2026-05-07 20:25:57 +02:00
jpirnay 42a9c09e4c yaclf 2026-05-04 16:59:21 +02:00
jpirnay 47946def00 Mirror upstream PR#1817 2026-05-04 16:52:54 +02:00
jpirnay aeafe42348 Fix unwanted cache clearing 2026-05-04 15:54:29 +02:00
jpirnay 95eafaecd1 Smarter cache eviction 2026-05-04 15:41:10 +02:00
jpirnay 48aaf821a5 Clear cache on prewarm 2026-05-04 15:33:47 +02:00
jpirnayandCopilot cc9ff5bae9 More review changes
Co-authored-by: Copilot <copilot@github.com>
2026-05-02 18:42:45 +02:00
jpirnayandCopilot 06dfc6c50b Recover parts of the regression fiasco
Co-authored-by: Copilot <copilot@github.com>
2026-05-02 18:19:23 +02:00
jpirnay 0366f8ece8 Dont get glyphs during scanning phase 2026-04-30 09:16:35 +02:00
jpirnay 12f16e9b28 when scanning, route through a metadata-only path 2026-04-29 14:53:45 +02:00
jpirnay 6e26fd7e14 And one more 2026-04-28 16:16:18 +02:00
jpirnay 2c9a6d7d31 One more 2026-04-28 16:09:59 +02:00
jpirnay 4c8517cf67 Improve pre warm caching 2026-04-28 15:12:11 +02:00
jpirnay aa9fae16d9 Integrate upstream #1392 by adriancaruana 2026-04-28 10:00:22 +02:00
jpirnay de314182f7 mitigating fragmented heap 2026-04-17 17:02:50 +02:00
jpirnay e3145439fc Make chunk size variable depending on available heap size 2026-04-17 16:34:33 +02:00
jpirnay ef31e4c1c1 Fix X3 issue 2026-04-14 19:36:55 +02:00
jpirnay f71d7a66e8 Revert quantization to original crosspoint values 2026-04-10 14:41:29 +02:00
jpirnay 667cde91f5 Merge pull request #54 from jpirnay/chore-debug-renderer
refactor: use atomic access to state fields
2026-04-10 12:54:42 +02:00
jpirnay 2e1074cac3 One more 2026-04-10 12:48:22 +02:00
jpirnay bcb0634c87 Review comments 2026-04-10 12:43:55 +02:00
jpirnay c97f16b576 refactor: Deduplicated BMP header writing in Xtc (#1439) by znelson 2026-04-10 11:29:57 +02:00
jpirnay f458228a24 use atomic access to state fields 2026-04-10 10:49:39 +02:00
jpirnay 5e7d4a0e11 Second part of upstream PR 1607 2026-04-09 14:04:59 +02:00
jpirnay 72a2a91550 Add UI support for darkness levels 2026-04-08 19:24:17 +02:00
jpirnay b5ffe9f772 Merge branch 'master' into chore-upstream 2026-04-08 11:39:44 +02:00
jpirnay 4bc987297a Review comments 2026-04-08 11:29:34 +02:00
jpirnay bcf49a943a Proper refresh on exit 2026-04-08 11:22:21 +02:00
jpirnay c5e0e0cb78 Fix merge conflict 2026-04-08 10:58:41 +02:00
Zach Nelson 86d636bf6a fix: Use differential rounding for consistent inter-glyph spacing (#1413)
**What is the goal of this PR?**

A tweak to the fixed-point x-advance and kerning calculations to ensure
that the spacing between any two glyphs is always calculated
consistently.

I noticed that sometimes I'd see common character pairs like "oo" more
than once on a page, and the distance between the two snapped to
different pixels depending on the running accumulated error for the line
of text.

This change uses a differential rounding approach where each glyph's
x-advance plus the kerning relative to the next glyph are combined in
fixed-point precision, then snapped to a pixel to draw the next glyph.
This results in a consistent inter-glyph spacing any time the same two
glyphs show up adjacent to each other, regardless of the accumulated
error across the line.

---

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**_
2026-04-08 10:40:57 +02:00
jpirnay abbf69649e Revert "Merge pull request #25 from jpirnay/fix-pr1582" and refactor koreader 2026-04-07 20:24:51 +02:00
jpirnay 398e973847 Use evenly-spaced dithering thresholds for factory LUT (Patryk Radtke) 2026-04-06 19:19:21 +02:00
jpirnay 1398454ad8 Merge PR #1310 into master 2026-04-04 18:35:11 +02:00
jpirnay 3151ebda56 Remove dead benchmark code 2026-04-04 18:23:32 +02:00
jpirnay 7e2291915f Merge branch 'x3-support'
# Conflicts:
#	lib/GfxRenderer/GfxRenderer.h
#	open-x4-sdk
2026-04-04 10:05:14 +02:00
Justin Mitchell 0db9d93f1c feat: add Xteink X3 hardware support
Adds HAL-level support for the Xteink X3 (SSD1677 controller, 792x528
display). Includes device detection, display initialization, button
mapping, power management, and theme adjustments for the X3 form factor.
2026-04-03 04:04:17 -04:00
jpirnay 1bfc3534aa Merge branch 'refactor-arc' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-30 18:35:57 +02:00
jpirnay 770e2f207c Fix 1 pixel regression 2026-03-30 18:32:00 +02:00
jpirnay 474dfe5490 Merge branch 'refactor-arc' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-30 18:09:55 +02:00
jpirnay ea00584aa5 Optimize GfxRenderer drawArc/fillArc and drawRoundedRect stroke performance 2026-03-30 17:58:36 +02:00
jpirnay 9b70ddc93b Merge branch 'master' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-13 21:24:04 +01:00
Adrian Wilkins-Caruana 1409259721 perf: font-compression improvements (#1056)
## Purpose

This PR includes some preparatory changes that are needed for an
upcoming performant CJK font feature. The changes have no impact on
render time and heap allocation for latin text. **Despite this, I think
these changes stand on their own as a better font
compression/decompression implementation.**

## Summary

- Font decompressor rewrite: Replaced the 4-slot LRU group cache with a
two-tier system — a page buffer (glyphs prewarmed before rendering
begins) and a hot-group fallback (last decompressed group retained for
non-prewarmed
  glyphs). 
- Byte-aligned compressed bitmap format: Glyph bitmaps within compressed
groups are now stored row-padded rather than tightly packed before
DEFLATE compression, improving compression ratios by making identical
pixel rows produce
identical byte patterns. Glyphs are compacted back to packed format on
demand at render time. Reduces flash size by 155 KB.
- Page prewarm system: Added `Page::collectText` and
`Page::getDominantStyle` to extract per-style glyph requirements before
rendering, and `GfxRenderer::prewarmFontCache` to pre-decompress only
the groups needed for the dominant style
   — eliminating mid-render decompression for the common case.
- UTF-8 robustness fixes: `utf8NextCodepoint` now validates continuation
bytes and returns a replacement glyph on malformed input;
`ChapterHtmlSlimParser` correctly preserves incomplete multi-byte
sequences across word-buffer flush
  boundaries rather than splitting them.

---

### 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? _**YES**_ Architecture and
design was done by me, refined a bit by Claude. Code mostly by Claude,
but not entirely.
2026-03-11 21:05:46 +01:00
Zach Nelson f9d32b11d9 fix: Fix inter-word spacing rounding error in text layout (#1311)
## Summary

**What is the goal of this PR?**

### Problem

Inter-word gap widths were computed as two separately-snapped integers:

```cpp
gap = getSpaceWidth(fontId, style);                        // fp4::toPixel(spaceAdvance)
gap += getSpaceKernAdjust(fontId, leftCp, rightCp, style); // fp4::toPixel(kern1 + kern2)
```

Because `fp4::toPixel(a) + fp4::toPixel(b)` can differ from
`fp4::toPixel(a + b)` by +/-1 pixel when the fractional parts straddle a
rounding boundary, each inter-word space could be one pixel wider or
narrower than the correct value. This affected line-break width
decisions and word-position accumulation across the whole paragraph
layout pipeline.

### Fix

Replaces `getSpaceKernAdjust()` with `getSpaceAdvance(fontId, leftCp,
rightCp, style)`, which combines the space glyph advance and both
flanking kern values (`kern(leftCp, ' ')` + `kern(' ', rightCp)`) into a
single fixed-point sum before the snap:

```cpp
return fp4::toPixel(spaceAdvanceFP + kern(leftCp, ' ') + kern(' ', rightCp));
```

This is the same single-snap pattern already used by `getTextAdvanceX`
for word widths.

### Changes

- **`GfxRenderer`**: Replaces `getSpaceKernAdjust()` with
`getSpaceAdvance()`. `getSpaceWidth()` is retained for the
single-space-word case in `measureWordWidth` where no adjacent-word kern
context is available.
- **`ParsedText`**: All four call sites (`computeLineBreaks`,
`computeHyphenatedLineBreaks`, and both loops in `extractLine`) updated
to use `getSpaceAdvance()`. The now-redundant `spaceWidth`
pre-computation and parameter are removed from all three internal layout
functions.

---

### 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? _**YES to analyze for
correctness**_
2026-03-10 22:55:23 -05:00
jpirnay b9eefc5e70 Fix fast path 2026-03-08 10:06:08 +01:00
jpirnay d76581e7ff Merge branch 'perf-uifonts2' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-08 10:01:38 +01:00