Kivy: Deceptive pixel format logic in _image_sdl2.pyx load_from_surface()

Created on 9 Jul 2017  路  3Comments  路  Source: kivy/kivy

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

Has PR Needs-analysis

Most helpful comment

I was drunk? O_o

All 3 comments

I was drunk? O_o

@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

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

Was this page helpful?
0 / 5 - 0 ratings