Improve error message for invalid surface size (#20591)
This commit is contained in:
committed by
GitHub
parent
7d9c8eeb7b
commit
92190e6ee1
@@ -125,6 +125,14 @@ namespace Avalonia.Skia
|
|||||||
|
|
||||||
_currentFramebufferAddress = framebuffer.Address;
|
_currentFramebufferAddress = framebuffer.Address;
|
||||||
|
|
||||||
|
// A surface with a width/height of 0 is invalid and can't be created
|
||||||
|
if (desiredImageInfo.Width <= 0 || desiredImageInfo.Height <= 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentException(
|
||||||
|
$"Unable to create a surface with size {desiredImageInfo.Width}x{desiredImageInfo.Height}",
|
||||||
|
nameof(desiredImageInfo));
|
||||||
|
}
|
||||||
|
|
||||||
var surface = SKSurface.Create(desiredImageInfo, _currentFramebufferAddress,
|
var surface = SKSurface.Create(desiredImageInfo, _currentFramebufferAddress,
|
||||||
framebuffer.RowBytes, new SKSurfaceProperties(SKPixelGeometry.RgbHorizontal));
|
framebuffer.RowBytes, new SKSurfaceProperties(SKPixelGeometry.RgbHorizontal));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user