Commit 27f5567
authored
fix(sdl2): pixel-perfect rendering across DPI levels (#2222)
* fix(sdl2): pixel-perfect rendering across DPI levels
Fixes several SDL2 rendering artefacts and adds a headless test suite:
- Baseline drift: anchor glyphs via cached font ascent/descent
(glyph_y = bottom_y - ascent - |descent|) instead of surface height.
- AA tail erosion at attribute boundaries: lift the two-pass bg/glyph
rendering to span the whole physical line in redraw-physical-line.
- Oversized icon/folder/emoji glyphs: plain-text-object-p routes only
base text-objects through the per-character path, leaving subclasses
their scale-to-fit draw-object methods.
- Stepped highlight rectangles: pin text-object height to the stable
display-char-height rather than per-string SDL_ttf surface height.
- DPI transitions (Retina <-> standard): handle :size-changed /
:display-changed by re-deriving scale, re-opening the font, and
refreshing per-view textures via *post-display-change-hooks*.
Adds lem-sdl2/tests (font + drawing) wired into make test.
* fix(sdl2): address contract review feedback
- Move *post-display-change-hooks* defvar into the declarations section
at the top of display.lisp (file_structure_rule), and reword its
docstring to note it is a hook registry analogous to Lem's other
*...-hooks* variables.
- Export make-letter-object from lem-core/display and reference it
unqualified in drawing.lisp instead of reaching through
lem-core:: internal access (internal_symbol_rule).1 parent 9aa9a78 commit 27f5567
10 files changed
Lines changed: 505 additions & 42 deletions
File tree
- frontends/sdl2
- tests
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
| |||
47 | 52 | | |
48 | 53 | | |
49 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
50 | 66 | | |
51 | 67 | | |
52 | 68 | | |
| |||
137 | 153 | | |
138 | 154 | | |
139 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
140 | 166 | | |
141 | 167 | | |
142 | 168 | | |
| |||
243 | 269 | | |
244 | 270 | | |
245 | 271 | | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
246 | 281 | | |
247 | 282 | | |
248 | 283 | | |
| |||
254 | 289 | | |
255 | 290 | | |
256 | 291 | | |
| 292 | + | |
257 | 293 | | |
258 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
259 | 319 | | |
260 | 320 | | |
261 | 321 | | |
| |||
0 commit comments