Remove unused SKBitmap extension.

This commit is contained in:
Jared Goodwin 2022-07-07 06:06:15 -07:00
parent f5686dd069
commit d9a0641e07

View File

@ -14,53 +14,5 @@ namespace Remotely.Desktop.Core.Extensions
{
return new SKRect(0, 0, bitmap.Width, bitmap.Height);
}
// The SKBitmap.Copy method has a memory leak somewhere, so I created this.
public static SKBitmap CopyEx(this SKBitmap bitmap, bool disposeOriginal = false)
{
var width = bitmap.Width;
var height = bitmap.Height;
var newBitmap = new SKBitmap(width, height);
var bytesPerPixel = bitmap.BytesPerPixel;
var totalSize = bitmap.ByteCount;
unsafe
{
byte* scan1 = (byte*)bitmap.GetPixels().ToPointer();
byte* scan2 = (byte*)newBitmap.GetPixels().ToPointer();
for (var row = 0; row < height; row++)
{
for (var column = 0; column < width; column++)
{
var index = (row * width * bytesPerPixel) + (column * bytesPerPixel);
byte* data1 = scan1 + index;
byte* data2 = scan2 + index;
if (data1[0] != data2[0] ||
data1[1] != data2[1] ||
data1[2] != data2[2] ||
data1[3] != data2[3])
{
data2[0] = data2[0];
data2[1] = data2[1];
data2[2] = data2[2];
data2[3] = data2[3];
}
}
}
}
if (disposeOriginal)
{
bitmap.Dispose();
}
return newBitmap;
}
}
}