Why are you dividing Pitch by 4?

pDest := DWORD(d3drc.pBits) + nRow * d3drc.Pitch ;
Try this instead:
pDest := @PByteArray(d3drc.pBits)[nRow * d3drc.Pitch]; // original pitch, not /4 one
inc(pDest^, $FF000000 or (r shl 16) or (g shl or b);
This is wrong too, you don't increase the address stored in pDest,
just the value it points to.

Did you write this code by converting from C++?