Skip to content

fix ALFA alpha channel row padding for odd-width JPEG bitmaps#78

Merged
igorlira merged 1 commit intomainfrom
matthewdean/fix-alfa-row-padding
Mar 20, 2026
Merged

fix ALFA alpha channel row padding for odd-width JPEG bitmaps#78
igorlira merged 1 commit intomainfrom
matthewdean/fix-alfa-row-padding

Conversation

@matthewdean
Copy link
Collaborator

@matthewdean matthewdean commented Mar 14, 2026

Summary

  • Director stores ALFA chunk rows padded to 2-byte boundaries. The RLE decompressor was treating the data as flat pixels, causing a cumulative 1-byte-per-row diagonal shear on odd-width bitmaps (e.g. 505px wide as seen in LEGO World Builder 2).
  • Extract shared decompress_alpha_rle() helper used by both decode_jpeg_bitmap (ALFA chunk) and decode_jpeg_bitd (inline alpha), replacing two duplicate inline RLE loops.

Test plan

  • Verified World Builder 2 junglemap (cast member #169, 505x280x32) renders correctly
  • Test other games with JPEG+ALFA bitmaps for regression

🤖 Generated with Claude Code

Director stores ALFA chunk rows padded to 2-byte boundaries. The RLE
decompressor was treating the data as flat pixels, causing a cumulative
1-byte-per-row diagonal shear on odd-width bitmaps (e.g. 505px wide).

Extract shared decompress_alpha_rle() helper used by both
decode_jpeg_bitmap (ALFA chunk) and decode_jpeg_bitd (inline alpha),
replacing two duplicate inline RLE loops.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@matthewdean matthewdean changed the title Fix ALFA alpha channel row padding for odd-width JPEG bitmaps fix ALFA alpha channel row padding for odd-width JPEG bitmaps Mar 14, 2026
@matthewdean matthewdean marked this pull request as ready for review March 14, 2026 01:49
@matthewdean matthewdean requested a review from igorlira March 14, 2026 01:49
@igorlira igorlira merged commit 0104d02 into main Mar 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants