Matteo Bruni (@Mystral) commented about dlls/d3dx9_36/surface.c:
{ const uint32_t dst_row_idx = bottom_to_top ? (image->size.height - i - 1) : i; uint8_t *dst_row = img_buf + (dst_row_idx * row_pitch);
if (is_rle)
{
hr = d3dx_image_tga_rle_decode_row(&src_pos, src_data_size - (src_pos - (const uint8_t *)src_data),
image->size.width, fmt_desc->bytes_per_pixel, src_row);
if (FAILED(hr))
goto exit;
}
else
{
memcpy(src_row, src_pos, row_pitch);
src_pos += row_pitch;
}
Can we avoid the extra copy here without making the code much of a mess?