mirror of
https://github.com/reactos/wine.git
synced 2025-02-02 02:04:34 +00:00
wined3d: Introduce a separate function for WINED3D_CT_CK_B8G8R8.
This commit is contained in:
parent
31d7f61cc3
commit
548978dec4
@ -3238,6 +3238,27 @@ static void convert_b5g5r5x1_unorm_b5g5r5a1_unorm_color_key(const BYTE *src, uns
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_b8g8r8_unorm_b8g8r8a8_unorm_color_key(const BYTE *src, unsigned int src_pitch,
|
||||
BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height,
|
||||
const struct wined3d_color_key *color_key)
|
||||
{
|
||||
const BYTE *src_row;
|
||||
unsigned int x, y;
|
||||
DWORD *dst_row;
|
||||
|
||||
for (y = 0; y < height; ++y)
|
||||
{
|
||||
src_row = &src[src_pitch * y];
|
||||
dst_row = (DWORD *)&dst[dst_pitch * y];
|
||||
for (x = 0; x < width; ++x)
|
||||
{
|
||||
DWORD src_color = (src_row[x * 3 + 2] << 16) | (src_row[x * 3 + 1] << 8) | src_row[x * 3];
|
||||
if (!color_in_range(color_key, src_color))
|
||||
dst_row[x] = src_color | 0xff000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UINT width, UINT height,
|
||||
UINT outpitch, enum wined3d_conversion_type conversion_type, struct wined3d_surface *surface)
|
||||
{
|
||||
@ -3271,20 +3292,8 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
|
||||
break;
|
||||
|
||||
case WINED3D_CT_CK_B8G8R8:
|
||||
for (y = 0; y < height; ++y)
|
||||
{
|
||||
source = src + pitch * y;
|
||||
dest = dst + outpitch * y;
|
||||
for (x = 0; x < width; ++x)
|
||||
{
|
||||
DWORD color = ((DWORD)source[2] << 16) | ((DWORD)source[1] << 8) | (DWORD)source[0];
|
||||
if (!color_in_range(&texture->src_blt_color_key, color))
|
||||
color |= 0xff000000;
|
||||
*(DWORD *)dest = color;
|
||||
source += 3;
|
||||
dest += 4;
|
||||
}
|
||||
}
|
||||
convert_b8g8r8_unorm_b8g8r8a8_unorm_color_key(src, pitch, dst, outpitch,
|
||||
width, height, &texture->src_blt_color_key);
|
||||
break;
|
||||
|
||||
case WINED3D_CT_CK_B8G8R8X8:
|
||||
|
Loading…
x
Reference in New Issue
Block a user