Matteo Bruni (@Mystral) commented about dlls/d3dx9_36/surface.c:
+static void d3dx_init_color_key(const struct pixel_format_desc *src_fmt, uint32_t color_key,
struct d3dx_color_key *color_key_out)
+{
- unsigned int i;
- for (i = 0; i < 4; ++i)
- {
const enum component_type src_ctype = !i ? src_fmt->a_type : src_fmt->rgb_type;
const uint8_t channel_bits = (src_ctype == CTYPE_LUMA) ? src_fmt->bits[1] : src_fmt->bits[i];
const uint8_t ck_channel = (color_key >> (24 - (i * 8))) & 0xff;
float slop, channel_conv, unique_values;
if (!channel_bits)
{
color_key_out->color_key_min[i] = color_key_out->color_key_max[i] = 0xff;
This doesn't seem right to me: an 8 bit per component image could legitimately have `ck_min == ck_max == 0xff` and in the color key check in `convert_argb_pixel()` there is no special casing for a missing component.
We probably want to set a full interval instead: ```suggestion:-0+0 color_key_out->color_key_min[i] = 0; color_key_out->color_key_max[i] = 0xff; ```