Discussion:
[SDL] SDL_SetWindowIcon producing messed up icon
dandago
2017-01-09 22:56:38 UTC
Permalink
Hi,

I've come across a weird issue with SDL_SetWindowIcon(). I am creating a surface from pixel data that I already have available, using SDL_CreateRGBSurfaceWithFormatFrom(). I know that the pixel data is correct because I'm rendering it in my game, and I know the surface I'm creating from it for the icon is valid because I tried saving it to a BMP and the image was created perfectly.

But when I pass the same surface to SDL_SetWindowIcon(), I get a garbled mess.

I can upload some images showing what it looks like if there's some way to do that in this forum.

Has anyone had a similar issue before?

------------------------
Daniel D'Agostino
http://gigi.nullneuron.net/gigilabs/
dandago
2017-01-10 17:35:07 UTC
Permalink
It works fine when loaded from a BMP.

I'm using Windows 10.

The image data I'm using is proprietary, but ultimately I'm converting it to ARGB8888 format. I'll see if I can make a repro project with some handmade image, but it will take a bit of time.
Does it happen if you load the icon from the BMP that you saved?
Can you please report this on bugzilla.libsdl.org (http://bugzilla.libsdl.org), and attach whatever we need to be able to reproduce the problem? Also, please include what operating system and version you're running.
------------------------
Daniel D'Agostino
http://gigi.nullneuron.net/gigilabs/
dandago
2017-01-15 21:36:15 UTC
Permalink
I've submitted a bug and uploaded a repro project to one of my repositories.
https://bugzilla.libsdl.org/show_bug.cgi?id=3559

Repro is here.
https://bitbucket.org/dandago/experimental/src/35ab7d960e5461cfaf9fdee3bf37d9179f8de4cd/Sdl2WindowIcon/Sdl2WindowIcon/main.cpp?at=master&fileviewer=file-view-default

I had to improvise the icon pixels, but hopefully it makes sense.

------------------------
Daniel D'Agostino
http://gigi.nullneuron.net/gigilabs/
dandago
2017-01-15 21:41:44 UTC
Permalink
Post by dandago
I've submitted a bug and uploaded a repro project to one of my repositories.
https://bugzilla.libsdl.org/show_bug.cgi?id=3559
Repro is here.
https://bitbucket.org/dandago/experimental/src/35ab7d960e5461cfaf9fdee3bf37d9179f8de4cd/Sdl2WindowIcon/Sdl2WindowIcon/main.cpp?at=master&fileviewer=file-view-default
I had to improvise the icon pixels, but hopefully it makes sense.
Sorry, had a small mistake in the code. See updated version instead:
https://bitbucket.org/dandago/experimental/src/792b14862ea211d3dda46e0a3bb3bb335ba3a12a/Sdl2WindowIcon/Sdl2WindowIcon/main.cpp?at=master&fileviewer=file-view-default

------------------------
Daniel D'Agostino
http://gigi.nullneuron.net/gigilabs/

Loading...