Commit Graph
195 Commits
Author SHA1 Message Date
jpirnay bddefa58f5 Fix image margin leak 2026-04-02 13:39:24 +02:00
jpirnay e1fd631ced Review implied changes 2026-04-01 11:14:53 +02:00
jpirnay 3f6d31b966 Merge branch 'feat-ordered-list' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-31 21:26:05 +02:00
jpirnay 913831749e Slight adjustments 2026-03-31 21:17:32 +02:00
jpirnay 0ad2ac71c7 Introduce ordered list support 2026-03-31 21:10:22 +02:00
martin brook aa085425af perf: Eliminate per-pixel overheads in image rendering (#1293)
## Summary

Replace per-pixel getRenderMode() + rotateCoordinates() + bounds checks
with a DirectPixelWriter struct that pre-computes orientation and render
mode state once per row. Use bitwise ops instead of division/modulo for
cache pixel packing. Skip PNG cache allocation when buffer exceeds 48KB
(framebuffer size) since PNG decode is fast enough that caching provides
minimal benefit, and the large buffer competes with the 44KB PNG decoder
for heap.

## Additional Context
Measured improvements on ESP32-C3 @ 160MHz:
- JPEG decode: 5-7% faster (1:1 scale)
- PNG decode: 15-20% faster (1:1 scale)
- Cache renders: 3-6% faster across both formats
- Eliminates "Failed to allocate cache buffer" errors for large PNGs

---

### 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 >**_
2026-03-30 11:03:49 -05:00
jpirnay 7b12b0f27e Merge branch 'fix-css-pre' into mybuild
# Conflicts:
#	lib/Epub/Epub/parsers/ChapterHtmlSlimParser.cpp
2026-03-30 15:15:46 +02:00
jpirnay 55de10124c Add missing flush on block changes 2026-03-30 14:38:09 +02:00
jpirnay 2111bc2fdb Fix unwanted nbsp payload of empty paragraphs 2026-03-30 14:25:04 +02:00
jpirnay ba07a6666d Fix br alignment reset behaviour 2026-03-30 13:38:46 +02:00
jpirnay b1c3b9d768 Fix unwanted br alignment reset 2026-03-30 13:35:11 +02:00
jpirnay 53f93b2857 Fix br count carry over regression 2026-03-30 13:26:41 +02:00
jpirnay 360e04f61c Merge branch 'perf-htmlslim-parser' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-29 09:42:40 +02:00
jpirnay 9d0316d7f1 Review comment 2026-03-29 09:23:56 +02:00
jpirnay 834c7b7712 Merge branch 'perf-htmlslim-parser' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-28 20:54:14 +01:00
jpirnay 6daf3fd1bb Add css cache 2026-03-28 20:49:03 +01:00
jpirnay 1b0c5fec28 Integration hell 2026-03-28 18:21:53 +01:00
jpirnay a2aee4f4ae Merge branch 'fix-css-pre' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-28 18:16:11 +01:00
jpirnay be430c781e Fix <pre> treatment 2026-03-28 17:44:10 +01:00
jpirnay 7f6933ab22 Recognize css pre elements 2026-03-28 16:47:55 +01:00
jpirnay ab03fe3ab7 Merge branch 'feat-koysnc-xpath' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-28 16:23:11 +01:00
jpirnay f0c8760a37 Merge branch 'feat-invalid-toc-fallback' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-28 10:41:24 +01:00
jpirnay 348d00278d Merge branch 'fix-text-align' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-28 10:40:26 +01:00
jpirnay 69dbfa4b8a Fix discarded CSS text-align 2026-03-28 10:39:30 +01:00
jpirnay 7f63ebbcf7 Use translated section string 2026-03-27 21:30:30 +01:00
jpirnay c71fb8c6af Merge branch 'feat-invalid-toc-fallback' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-27 17:29:45 +01:00
jpirnay 20d5cf96f7 Proper return code 2026-03-27 17:28:06 +01:00
jpirnay a51fd3953d Refactor to a more generic unobstrusive approach 2026-03-27 17:06:30 +01:00
jpirnay 3f8a87e907 Deal with invalid/incomplete toc.ncx files 2026-03-27 16:40:34 +01:00
jpirnay 1d3405318c Integrate PT 1455 2026-03-26 11:16:53 +01:00
jpirnay 1af3f81336 PR 1507 2026-03-26 11:05:13 +01:00
jpirnay a5fa684d2b Merge branch 'perf-lut-cache' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-25 18:09:53 +01:00
jpirnayandClaude Opus 4.6 7496bf95ce Merge branch 'master' of origin into perf-lut-cache
Resolved conflicts in Section.h and Section.cpp:
- Combined includes (vector for LUT cache + optional/string from master)
- Added imageRendering parameter to loadSectionFile declaration
- Kept non-const clearCache (needs to close file handle for LUT cache)
- Kept in-memory LUT cache in loadPageFromSectionFile (replaces master's
  per-page LUT seek)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-25 17:17:51 +01:00
jpirnay eadcead501 fix: Fix img layout issue / support CSS display:none for elements and images (#1443)
## Summary
- Add CSS `display: none` support to the EPUB rendering pipeline (fixes
#1431)
- Parse `display` property in stylesheets and inline styles, with full
cascade resolution (element, class, element.class, inline)
- Skip hidden elements and all their descendants in
`ChapterHtmlSlimParser`
- Separate display:none check for `<img>` tags (image code path is
independent of the general element handler)
- Flush pending text blocks before placing images to fix layout ordering
(text preceding an image now correctly renders above it)
- Bump CSS cache version to 4 to invalidate stale caches
- Add test EPUB (`test_display_none.epub`) covering class selectors,
element selectors, combined selectors, inline styles, nested hidden
content, hidden images, style priority/override, and realistic use cases
2026-03-23 13:51:02 -05:00
jpirnay 9d5d468d86 Merge branch 'feat-indexing-feedback' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-23 12:03:00 +01:00
jpirnay 2d1f635f10 Provide visual progress feedback during indexing 2026-03-23 11:29:33 +01:00
jpirnayandClaude Opus 4.6 fd70b3a231 Add paragraph index LUT for accurate KOReader position sync
Store per-page paragraph indices in section cache to enable precise
XPath-to-page and page-to-XPath mapping without reparsing XHTML.

Forward path (upload): generates XPath directly from paragraph LUT
instead of byte-offset estimation, eliminating drift in chapters
with non-uniform content density.

Reverse path (download): resolves incoming KOReader XPath p[N] to
the exact page via paragraph LUT lookup.

Paragraph counter counts all <p> elements including display:none
to match ChapterXPathIndexer and crengine's standard XPath counting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 12:29:30 +01:00
jpirnayandClaude Opus 4.6 b625b8bd26 Add paragraph index LUT for accurate KOReader position sync
Store per-page paragraph indices in section cache to enable precise
XPath-to-page and page-to-XPath mapping without reparsing XHTML.

Forward path (upload): generates XPath directly from paragraph LUT
instead of byte-offset estimation, eliminating drift in chapters
with non-uniform content density.

Reverse path (download): resolves incoming KOReader XPath p[N] to
the exact page via paragraph LUT lookup.

Paragraph counter counts all <p> elements including display:none
to match ChapterXPathIndexer and crengine's standard XPath counting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 12:29:26 +01:00
jpirnay 484b998366 Merge branch 'fix-displaynone' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-20 18:37:04 +01:00
jpirnay fa836f3c60 Review fixes 2026-03-20 18:26:18 +01:00
jpirnay 06839c11a8 Merge branch 'fix-displaynone' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-20 17:57:43 +01:00
jpirnay f8a5400a04 Fix crash 2026-03-20 17:24:57 +01:00
jpirnay a068f76074 Fix img layout bug 2026-03-20 17:15:08 +01:00
jpirnay 9c8e64402d Recognize css display:none, fixes #1431 2026-03-20 14:48:41 +01:00
jpirnay 0a8a644773 Merge branch 'feat-charger' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-18 12:26:24 +01:00
Zach Nelson 415965c21b fix: Prevent line breaks on common English contractions (#1405) 2026-03-16 20:04:06 -04:00
jpirnay e4b0abec03 Fix english hyphenation 2026-03-16 11:51:28 +01:00
jpirnay 9b70ddc93b Merge branch 'master' of https://github.com/jpirnay/crosspoint-reader into mybuild 2026-03-13 21:24:04 +01:00
jpirnay 906dd202b9 fix: Add special handling for apostrophe hyphenation (#1318)
## Summary

* **What is the goal of this PR?** Fixing / extending the hyphenation
logic to deal with words containing an apostophe as raised in #1186
* **What changes are included?**

## Additional Context

---

### 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**_ (as the
user provided a thorough analysis that I followed)
2026-03-11 18:35:23 -05: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