If you are using offsets such as p[((y)*stride)+((x)*4)]
, you probably shouldn't be increasing p at all? Surely you've already handled that (x
and y
) with the multiplication? Also, bmpData.Stride - b.Width*4
is not (as far as I can see) a meaningful number... the stride is the rows size including padding.
Either remove the "p += ...
" code, or change the offset algorithm. At the moment you are skipping data (bad) and accessing data outside of the object (very bad).
Marc Gravell
2009-02-17 13:04:14