Merge pull request #81574 from BlueCube3310/3x-dds-grayscale-fix

[3.x] Fix grayscale DDS loading
This commit is contained in:
Rémi Verschelde 2023-11-14 11:37:07 +01:00
commit 1ba1d46740
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -61,7 +61,6 @@ enum DDSFormat {
DDS_BGR5A1, DDS_BGR5A1,
DDS_BGR565, DDS_BGR565,
DDS_BGR10A2, DDS_BGR10A2,
DDS_INDEXED,
DDS_LUMINANCE, DDS_LUMINANCE,
DDS_LUMINANCE_ALPHA, DDS_LUMINANCE_ALPHA,
DDS_MAX DDS_MAX
@ -196,9 +195,9 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path,
dds_format = DDS_BGR10A2; dds_format = DDS_BGR10A2;
} else if (format_flags & DDPF_RGB && !(format_flags & DDPF_ALPHAPIXELS) && format_rgb_bits == 16 && format_red_mask == 0x0000f800 && format_green_mask == 0x000007e0 && format_blue_mask == 0x0000001f) { } else if (format_flags & DDPF_RGB && !(format_flags & DDPF_ALPHAPIXELS) && format_rgb_bits == 16 && format_red_mask == 0x0000f800 && format_green_mask == 0x000007e0 && format_blue_mask == 0x0000001f) {
dds_format = DDS_BGR565; dds_format = DDS_BGR565;
} else if (!(format_flags & DDPF_ALPHAPIXELS) && format_rgb_bits == 8 && format_red_mask == 0xff && format_green_mask == 0xff && format_blue_mask == 0xff) { } else if (!(format_flags & DDPF_ALPHAPIXELS) && format_rgb_bits == 8 && format_red_mask == 0xff) {
dds_format = DDS_LUMINANCE; dds_format = DDS_LUMINANCE;
} else if ((format_flags & DDPF_ALPHAPIXELS) && format_rgb_bits == 16 && format_red_mask == 0xff && format_green_mask == 0xff && format_blue_mask == 0xff && format_alpha_mask == 0xff00) { } else if ((format_flags & DDPF_ALPHAPIXELS) && format_rgb_bits == 16 && format_red_mask == 0xff && format_alpha_mask == 0xff00) {
dds_format = DDS_LUMINANCE_ALPHA; dds_format = DDS_LUMINANCE_ALPHA;
} else if (format_flags & DDPF_INDEXED && format_rgb_bits == 8) { } else if (format_flags & DDPF_INDEXED && format_rgb_bits == 8) {
dds_format = DDS_BGR565; dds_format = DDS_BGR565;