File tree Expand file tree Collapse file tree 1 file changed +17
-11
lines changed Expand file tree Collapse file tree 1 file changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -3464,18 +3464,24 @@ Image::UsedChannels Image::detect_used_channels(CompressSource p_source) const {
34643464
34653465 UsedChannels used_channels;
34663466
3467- if (!c && !a) {
3468- used_channels = USED_CHANNELS_L;
3469- } else if (!c && a) {
3470- used_channels = USED_CHANNELS_LA;
3471- } else if (r && !g && !b && !a) {
3472- used_channels = USED_CHANNELS_R;
3473- } else if (r && g && !b && !a) {
3474- used_channels = USED_CHANNELS_RG;
3475- } else if (r && g && b && !a) {
3476- used_channels = USED_CHANNELS_RGB;
3467+ if (!c) {
3468+ // Uniform RGB (grayscale).
3469+ if (a) {
3470+ used_channels = USED_CHANNELS_LA;
3471+ } else {
3472+ used_channels = USED_CHANNELS_L;
3473+ }
34773474 } else {
3478- used_channels = USED_CHANNELS_RGBA;
3475+ // Colored image.
3476+ if (a) {
3477+ used_channels = USED_CHANNELS_RGBA;
3478+ } else if (b) {
3479+ used_channels = USED_CHANNELS_RGB;
3480+ } else if (g) {
3481+ used_channels = USED_CHANNELS_RG;
3482+ } else {
3483+ used_channels = USED_CHANNELS_R;
3484+ }
34793485 }
34803486
34813487 if (p_source == COMPRESS_SOURCE_SRGB && (used_channels == USED_CHANNELS_R || used_channels == USED_CHANNELS_RG)) {
You can’t perform that action at this time.
0 commit comments