Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move prev,line swap to after putting data into bitmap #92

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

FoamyGuy
Copy link
Contributor

@ladyada

Resolves: #91

This swap of prev and line was prior to data from line being inserted into the Bitmap. That resulted in the first row being blank because prev was empty on the first iteration. And led to the last row being "pushed off the bottom" and not rendered.

Fix tested on Feather S3 TFT 9.2.1 with this slightly modified reproducer from the issue:

import displayio
import adafruit_imageload

import board
display = board.DISPLAY

display.root_group = displayio.Group(scale=4)

image, palette = adafruit_imageload.load(f"test_pattern.png")
display.root_group.append(displayio.TileGrid(image, pixel_shader=palette, x=2, y=2))

bmp_image, bmp_palette = adafruit_imageload.load(f"test_pattern.bmp")
display.root_group.append(displayio.TileGrid(bmp_image, pixel_shader=bmp_palette, x=20, y=2))

while True:
    pass

@FoamyGuy FoamyGuy requested a review from a team January 14, 2025 22:34
@jepler
Copy link
Member

jepler commented Jan 15, 2025

This is kinda subtle. would you be able to add a test that probes for correct pixel values? We have some tests already, at e.g., https://github.com/adafruit/Adafruit_CircuitPython_ImageLoad/blob/main/tests/test_pbm_load.py that you might be able to model it after. (though I didn't see any of them actually checking pixel values)

@FoamyGuy
Copy link
Contributor Author

@jepler yes, I've added that to my list. I'll create a separate PR for it and merge this so we can have the fix more immediately.

I hadn't looked into these tests much if at all before. I wonder if it'd be possible to use Blinka Displayio implementations of Bitmap and Palette instead of the mocked ones from tests.displayio_shared_bindings.py

@FoamyGuy FoamyGuy merged commit c36419b into adafruit:main Jan 15, 2025
1 check passed
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jan 16, 2025
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.

PNG image offset by 1 line
3 participants