Render Panel - some tiny speedups
This commit is contained in:
parent
1fcc6a24a5
commit
379e724d34
|
@ -91,16 +91,16 @@ namespace BizHawk.MultiClient
|
||||||
if (imageWidth == textureWidth)
|
if (imageWidth == textureWidth)
|
||||||
{
|
{
|
||||||
// Widths are the same, just dump the data across (easy!)
|
// Widths are the same, just dump the data across (easy!)
|
||||||
Data.WriteRange(surface.PixelIntPtr, imageWidth * imageHeight * 4);
|
Data.WriteRange(surface.PixelIntPtr, imageWidth * imageHeight << 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Widths are different, need a bit of additional magic here to make them fit:
|
// Widths are different, need a bit of additional magic here to make them fit:
|
||||||
long RowSeekOffset = 4 * (textureWidth - imageWidth);
|
long RowSeekOffset = (textureWidth - imageWidth) << 2;
|
||||||
for (int r = 0, s = 0; r < imageHeight; ++r, s += imageWidth)
|
for (int r = 0, s = 0; r < imageHeight; ++r, s += imageWidth)
|
||||||
{
|
{
|
||||||
IntPtr src = new IntPtr(((byte*)surface.PixelPtr + r*surface.Stride));
|
IntPtr src = new IntPtr(((byte*)surface.PixelPtr + r*surface.Stride));
|
||||||
Data.WriteRange(src,imageWidth * 4);
|
Data.WriteRange(src,imageWidth << 2);
|
||||||
Data.Seek(RowSeekOffset, SeekOrigin.Current);
|
Data.Seek(RowSeekOffset, SeekOrigin.Current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue