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

bitmap.blit type checking and raise error #6035

Merged
merged 1 commit into from
Feb 15, 2022

Conversation

FoamyGuy
Copy link
Collaborator

resolves #5916 I confirmed the hard crash as described in the issue.

Tested on Feather TFT ESP32-S2 using this example code (mostly the same as posted in the issue):

import time
import displayio

print("waiting 8...7...6..5...4...3...2...1...")
time.sleep(8)

with open("/allblue.bmp", "rb") as bits:
    source = displayio.OnDiskBitmap(bits)
    dest = displayio.Bitmap(source.width, source.height, 64)
    dest.blit(0, 0, source)

output after this change:

code.py output:
waiting 8...7...6..5...4...3...2...1...
Traceback (most recent call last):
  File "code.py", line 12, in <module>
TypeError: source_bitmap must be of type Bitmap

Copy link
Member

@jepler jepler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this is just what I expected to see.

@kmatch98
Copy link
Collaborator

kmatch98 commented Feb 15, 2022

I tested on the PyPortal.

Interestingly, before the change it didn't crash, but I don't think it actually "blitted" anything.

After the change, I get this exception:

code.py output:
Traceback (most recent call last):
  File "code.py", line 10, in <module>
TypeError: source_bitmap must be of type Bitmap

Code done running.

Looks good to me.

@dhalbert dhalbert merged commit 5a063c1 into adafruit:main Feb 15, 2022
jepler pushed a commit to jepler/circuitpython that referenced this pull request Feb 15, 2022
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.

Bitmap.blit from OnDiskBitmap => hard crash
4 participants