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

Fix saving RGBA images #10245

Merged
merged 2 commits into from Nov 27, 2021
Merged

Fix saving RGBA images #10245

merged 2 commits into from Nov 27, 2021

Conversation

Pokechu22
Copy link
Contributor

@Pokechu22 Pokechu22 commented Nov 24, 2021

Fixes broken texture dumping.

PNG_FORMAT_RGB and PNG_COLOR_TYPE_RGB both evaluate to 2, but PNG_FORMAT_RGBA evaluates to 3 while PNG_COLOR_TYPE_RGBA evaluates to 6; the bit indicating a palette is 1 while the bit indicating alpha is 4.

This generates an error, but because the default libpng error handler logs to stderr, it wasn't seen. I've also added custom error handlers that put it into Dolphin's logging system. With that, the following message now showed up (prior to fixing the above issue):

30:33:346 Common\Image.cpp:140 E[FRAMEDUMP]: Failed to save 852 by 480 image to C:/Users/Pokechu22/Documents/Dolphin Emulator/Dump/Textures/OHBCHB/tex1_852x480_502591290a4f95cd_6.png at level 6: 0 warnings, 1 errors
30:33:346 Common\Image.cpp:142 E[FRAMEDUMP]: libpng error: Valid palette required for paletted images

PNG_FORMAT_RGB and PNG_COLOR_TYPE_RGB both evaluate to 2, but PNG_FORMAT_RGBA evaluates to 3 while PNG_COLOR_TYPE_RGBA evaluates to 6; the bit indicating a palette is 1 while the bit indicating alpha is 4.
Copy link
Contributor

@iwubcode iwubcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM. Confirmed that it fixes the problem

@JosJuice JosJuice merged commit 1e212d6 into dolphin-emu:master Nov 27, 2021
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants