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

Deceptive pixel format logic in _image_sdl2.pyx load_from_surface() #5269

Closed
ghost opened this issue Jul 9, 2017 · 3 comments
Closed

Deceptive pixel format logic in _image_sdl2.pyx load_from_surface() #5269

ghost opened this issue Jul 9, 2017 · 3 comments
Labels
Status: Has PR There's a PR available for the issue Status: Needs-analysis Issue needs to be analyzed if it's real

Comments

@ghost
Copy link

ghost commented Jul 9, 2017

Description

The intended happy path of converting to BGR888/ABGR8888 if image.format.BytesPerPixel is 3 or 4 is not reached. Instead, this is the default execution path. It seems like BPP=3 will not do any conversion, or incorrectly as ABGR if Rshift>Bshift.

Code and Logs

fmt = 'rgb'
if fmt not in ('rgb', 'rgba'): # <------- suspect "not"
    if fmt == 'rgb':

https://github.com/kivy/kivy/blob/1.10.0/kivy/core/image/_img_sdl2.pyx#L63-L64

@tito
Copy link
Member

tito commented Jul 13, 2017

I was drunk? O_o

@tito tito added the Status: Needs-analysis Issue needs to be analyzed if it's real label Jul 13, 2017
@ghost
Copy link
Author

ghost commented Jul 13, 2017

@tito do you remember the purpose of the Rshift>Bshift test? Handle bgr, or some endian-issue, or something else?

I've rewritten this function, will finalize & submit a pr, maybe easier to discuss that

@tito
Copy link
Member

tito commented Jul 13, 2017

I think it was an endian issue on iOS/android.

@dessant dessant added the Status: Has PR There's a PR available for the issue label Oct 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Has PR There's a PR available for the issue Status: Needs-analysis Issue needs to be analyzed if it's real
Projects
None yet
Development

No branches or pull requests

2 participants