On 8 May 2018 at 14:09, Stanislav Zhukov koncord@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.