[PATCH] wined3d: Implement WINED3DFMT_B8G8R8X8_UNORM to WINED3DFMT_L8_UNORM conversion

Henri Verbeet hverbeet at gmail.com
Mon May 14 06:30:55 CDT 2018


On 8 May 2018 at 14:09, Stanislav Zhukov <koncord at tes3mp.com> wrote:
> +static void convert_x8r8g8b8_l8(const BYTE *src, BYTE *dst,
> +        DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
> +{
> +    unsigned int x, y;
> +
> +    TRACE("Converting %ux%u pixels, pitches %u %u.\n", w, h, pitch_in, pitch_out);
> +
> +    for (y = 0; y < h; ++y)
> +    {
> +        const DWORD *src_line = (const DWORD *)(src + y * pitch_in);
> +        BYTE *dst_line = (BYTE *)(dst + y * pitch_out);
> +
> +        for (x = 0; x < w; ++x)
> +        {
> +            dst_line[x] = src_line[x] & 0x000000ff;
> +        }
> +    }
> +}
> +
This looks reasonable enough on first sight (although I wouldn't have
been surprised if we had to calculate actual luminance), but could you
please write a small test to go along with this? Both to show the
implementation is correct and to prevent future regressions.



More information about the wine-devel mailing list