void Combine(BinaryMap source, RectangleC area, Point at, CombineFunction function) { int shift = (int)((uint)area.X & WordMask) - (int)((uint)at.X & WordMask); int vectorSize = (area.Width >> WordShift) + 2; Parallel.For(0, area.Height, () => new CombineLocals { Vector = new uint[vectorSize], SrcVector = new uint[vectorSize] }, delegate(int y, ParallelLoopState state, CombineLocals locals) { LoadLine(locals.Vector, new Point(at.X, at.Y + y), area.Width); source.LoadLine(locals.SrcVector, new Point(area.X, area.Y + y), area.Width); if (shift >= 0) { ShiftLeft(locals.SrcVector, shift); } else { ShiftRight(locals.SrcVector, -shift); } function(locals.Vector, locals.SrcVector); SaveLine(locals.Vector, new Point(at.X, at.Y + y), area.Width); return(locals); }, locals => { }); }
public void Copy(BinaryMap source, RectangleC area, Point at) { int shift = (int)((uint)area.X & WordMask) - (int)((uint)at.X & WordMask); Parallel.For(0, area.Height, () => new uint[(area.Width >> WordShift) + 2], delegate(int y, ParallelLoopState state, uint[] vector) { source.LoadLine(vector, new Point(area.X, area.Y + y), area.Width); if (shift >= 0) { ShiftLeft(vector, shift); } else { ShiftRight(vector, -shift); } SaveLine(vector, new Point(at.X, at.Y + y), area.Width); return(vector); }, vector => { }); }