1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-05 17:28:47 +00:00

d3drm: Fix components of palette built when loading texture from file.

Fix the palette-building code used by IDirect3DTexture::InitFromFile
to use color components correctly. Also, fix and expand the tests to
properly check the components of a built palette.
This commit is contained in:
Jeff Smith 2022-07-19 08:51:11 -05:00 committed by Alexandre Julliard
parent 77189a341f
commit 293c6d24e3
2 changed files with 7 additions and 6 deletions

View File

@ -6287,8 +6287,8 @@ static void test_bitmap_data(unsigned int test_idx, const D3DRMIMAGE *img,
for (i = 0; i < img->palette_size; ++i)
{
unsigned int idx = upside_down ? (h - 1) * w - i + (i % w) * 2 : i;
ok(img->palette[i].red == idx % MOD_B
&& img->palette[i].green == idx % MOD_G && img->palette[i].blue == idx % MOD_R,
ok(img->palette[i].red == idx % MOD_R
&& img->palette[i].green == idx % MOD_G && img->palette[i].blue == idx % MOD_B,
"Test %u: Got unexpected palette entry (%u) color 0x%02x%02x%02x.\n",
test_idx, i, img->palette[i].red, img->palette[i].green, img->palette[i].blue);
ok(img->palette[i].flags == D3DRMPALETTE_READONLY,
@ -6367,6 +6367,7 @@ static void test_load_texture(void)
{100, 100, FALSE},
{99, 100, FALSE},
{3, 39, FALSE},
{16, 16, FALSE},
};
hr = Direct3DRMCreate(&d3drm1);

View File

@ -103,9 +103,9 @@ static BOOL d3drm_image_palettise(D3DRMIMAGE *image, unsigned char *src_data,
for (i = 0; i < colour_count; ++i)
{
entry = &palette[i];
if (entry->red == src_ptr[x * 3 + 0]
if (entry->red == src_ptr[x * 3 + 2]
&& entry->green == src_ptr[x * 3 + 1]
&& entry->blue == src_ptr[x * 3 + 2])
&& entry->blue == src_ptr[x * 3 + 0])
break;
}
@ -119,9 +119,9 @@ static BOOL d3drm_image_palettise(D3DRMIMAGE *image, unsigned char *src_data,
}
entry = &palette[colour_count++];
entry->red = src_ptr[x * 3 + 0];
entry->red = src_ptr[x * 3 + 2];
entry->green = src_ptr[x * 3 + 1];
entry->blue = src_ptr[x * 3 + 2];
entry->blue = src_ptr[x * 3 + 0];
entry->flags = D3DRMPALETTE_READONLY;
}