J
Johannes Bialek
Hi,
Buffer.BlockCopy() and Array.Copy() seem do be fine for Arrays, but what to
do about copying memory in unsafe code?
The goal is simple, I just want to scroll the content of an Image vertically
for some lines.. (using the CompactFramework, but seems to be of general
interrest). So I moved byte-per-byte which is awfully slow
Code:
System.Drawing.Imaging.BitmapData bd = buffer.LockBits(all,
System.Drawing.Imaging.ImageLockMode.ReadWrite,
System.Drawing.Imaging.PixelFormat.Format16bppRgb555);
int cnt = ((buffer.Height - Math.Abs(lines)) * bd.Stride);
byte* src = (byte*)bd.Scan0.ToInt32() + lines * bd.Stride;
byte* dst = (byte*)bd.Scan0.ToInt32();
for (int i = 0; i < cnt; i++)
{
*dst = *src;
dst++;
src++;
}
I really would like to see this for-loop removed by some "native" code...
any suggestions?!
Thanks,
Johannes
Buffer.BlockCopy() and Array.Copy() seem do be fine for Arrays, but what to
do about copying memory in unsafe code?
The goal is simple, I just want to scroll the content of an Image vertically
for some lines.. (using the CompactFramework, but seems to be of general
interrest). So I moved byte-per-byte which is awfully slow
Code:
System.Drawing.Imaging.BitmapData bd = buffer.LockBits(all,
System.Drawing.Imaging.ImageLockMode.ReadWrite,
System.Drawing.Imaging.PixelFormat.Format16bppRgb555);
int cnt = ((buffer.Height - Math.Abs(lines)) * bd.Stride);
byte* src = (byte*)bd.Scan0.ToInt32() + lines * bd.Stride;
byte* dst = (byte*)bd.Scan0.ToInt32();
for (int i = 0; i < cnt; i++)
{
*dst = *src;
dst++;
src++;
}
I really would like to see this for-loop removed by some "native" code...
any suggestions?!
Thanks,
Johannes