Hi,
for (x = 0; x < pitch / 2; x++ ) {
for (x = 0; x < width / 2; x++ ) {
This is not quite correct. pitch / 2 was used because in D3DFMT_R5G6B5 pitch = 2* width(Used to be, before my alignment patches). So this line should be for (x = 0; x < width; x++ ) {