The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL_SetWindowIcon producing messed up icon
dandago


Joined: 30 Aug 2013
Posts: 34
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?
SDL_SetWindowIcon producing messed up icon
Sam Lantinga


Joined: 10 Sep 2009
Posts: 1765
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:
Quote:
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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Re: SDL_SetWindowIcon producing messed up icon
dandago


Joined: 30 Aug 2013
Posts: 34
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.
SDL_SetWindowIcon producing messed up icon
Sam Lantinga


Joined: 10 Sep 2009
Posts: 1765
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:
Quote:
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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

dandago


Joined: 30 Aug 2013
Posts: 34
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.
dandago


Joined: 30 Aug 2013
Posts: 34
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