Repository navigation
Fix text labels packed past TEXTURE_HEIGHT (clipped/stretched rendering) - #1314
jhotadhari wants to merge 1 commit into
Conversation
The new-texture overflow check (y + height > TEXTURE_HEIGHT) only ran inside the row-break branch. A label that fit horizontally into an existing row near the texture bottom was packed with its cell extending past TEXTURE_HEIGHT, so drawText silently clipped its glyphs at the bitmap's bottom edge while the quad still mapped the full cell. The clipped glyphs plus the CLAMP_TO_EDGE smear of the last bitmap row rendered the label vertically distorted on screen. Run the overflow check for every label so oversized cells start a new texture.
|
Thank you, we need to check if this affects the performance on Android. Regarding your first note: |
|
Hi, True, good point, we should ensure that it doesn't effect the performance. I can't use my laptop the next days, maybe for a week, I'm sitting in mud. When I'm back in civilization, I can try to measure the performance. Proposal: we can design it as opt-in. Maybe as a static property. Similar to
I agree. |
Fixes #1313
Problem
Large captions occasionally rendered vertically clipped/stretched (flat cut at the bottom plus a halo smear), because
TextBucket.prepare()only checkedy + height > TEXTURE_HEIGHTinside thex + width > TEXTURE_WIDTHrow-break branch. A label that fit horizontally into an existing bottom row was packed with its cell extending past the 256 px texture height: the glyphs were rasterized clipped at the bitmap's bottom edge, while the quad's texture coordinates still covered the full cell (out-of-bounds rows sample the last row viaCLAMP_TO_EDGE).Only the largest font styles were affected (smaller cells never exceed
TEXTURE_HEIGHT), and the artifact came and went with panning/zooming because it depends on the atlas packing order for the visible label set — see the issue for screenshots and repro details.Fix
Run the new-texture overflow check for every label instead of only on row breaks, so any cell that would exceed
TEXTURE_HEIGHTstarts a new texture:One file changed (
TextBucket.java, 16 insertions / 11 deletions). No API changes.Verification
Notes
TextStyle.fontHeightwhile the width is measured live viapaint.measureText(). We considered (and tested) switching the height to live paint metrics as hardening — it's not required for this bug, but a tested reference implementation is available on my fork if maintainers are interested:jhotadhari/vtmbranchkeep/live-paint-text-metricsProposed CHANGELOG entry
(placed under
## Next versionindocs/Changelog.md)