优化调用

创建空对象,避免构建SKBitmap调用TryAllocPixels 申请无用的内存
This commit is contained in:
jasper 2024-06-25 22:14:26 +08:00
parent a3e606fbe7
commit 71f12b7597

View File

@ -126,8 +126,8 @@ namespace CPF.Skia
BITMAP BITMAP = new BITMAP();
UnmanagedMethods.GetObject(hbitmap, Marshal.SizeOf(typeof(BITMAP)), BITMAP);
var bitmap = new SKBitmap(BITMAP.bmWidth, BITMAP.bmHeight);
bitmap.SetPixels(BITMAP.bmBits);
var bitmap = new SKBitmap();
bitmap.InstallPixels(new SKImageInfo(BITMAP.bmWidth, BITMAP.bmHeight, SKImageInfo.PlatformColorType), BITMAP.bmBits, BITMAP.bmWidthBytes);
this.bitmap = bitmap;
canvas = new SKCanvas(this.bitmap);