Don't create a bitmap if it is going to be zero
This commit is contained in:
Родитель
5377b4bf36
Коммит
b135ac4efb
|
@ -156,10 +156,11 @@ namespace SkiaSharp.Views.UWP
|
|||
var size = CreateSize();
|
||||
var info = new SKImageInfo(size.Width, size.Height, SKImageInfo.PlatformColorType, SKAlphaType.Premul);
|
||||
|
||||
if (bitmap == null || bitmap.PixelWidth != info.Width || bitmap.PixelHeight != info.Height)
|
||||
{
|
||||
FreeBitmap();
|
||||
if (bitmap?.PixelWidth != info.Width || bitmap?.PixelHeight != info.Height)
|
||||
FreeBitmap();
|
||||
|
||||
if (bitmap == null && info.Width > 0 && info.Height > 0)
|
||||
{
|
||||
bitmap = new WriteableBitmap(info.Width, info.Height);
|
||||
pixels = bitmap.GetPixels();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче