SDL_SetWindowIcon producing messed up icon

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

Does it happen if you load the icon from the BMP that you saved?

Can you please report this on 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.

Thanks!On Mon, Jan 9, 2017 at 2:56 PM, dandago wrote:

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/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

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.

Sam Lantinga wrote:> 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

Okay, thanks!

Offhand I’m guessing that there’s an assumption about the pitch of the
image, but a repro case would be great.On Tue, Jan 10, 2017 at 9:35 AM, dandago wrote:

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.

Sam Lantinga wrote:

Does it happen if you load the icon from the BMP that you saved?

Can you please report this on 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/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

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

dandago wrote:

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