Родитель
db8723935a
Коммит
59ee16f809
|
@ -786,6 +786,9 @@ namespace SkiaSharp
|
|||
|
||||
public SKBitmap Resize (SKImageInfo info, SKFilterQuality quality)
|
||||
{
|
||||
if (info.IsEmpty)
|
||||
return null;
|
||||
|
||||
var dst = new SKBitmap (info);
|
||||
if (ScalePixels (dst, quality)) {
|
||||
return dst;
|
||||
|
|
|
@ -428,6 +428,26 @@ namespace SkiaSharp.Tests
|
|||
Assert.Equal(SKColors.Blue, dstBmp.GetPixel(75, 75));
|
||||
}
|
||||
|
||||
[SkippableTheory]
|
||||
[InlineData(-1, -1)]
|
||||
[InlineData(0, 0)]
|
||||
[InlineData(-1, 10)]
|
||||
[InlineData(10, -1)]
|
||||
[InlineData(0, 10)]
|
||||
[InlineData(10, 0)]
|
||||
public void BitmapDoesNotCrashOnInvalidResizes(int width, int hight)
|
||||
{
|
||||
using var bitmap = CreateTestBitmap();
|
||||
|
||||
var newInfo = bitmap.Info;
|
||||
newInfo.Width = width;
|
||||
newInfo.Height = hight;
|
||||
|
||||
using var newBitmap = bitmap.Resize(newInfo, SKFilterQuality.High);
|
||||
|
||||
Assert.Null(newBitmap);
|
||||
}
|
||||
|
||||
[SkippableFact]
|
||||
public void CanScalePixels()
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче