danwalmsley
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
6 additions and
3 deletions
-
src/Avalonia.Visuals/Platform/LockedFramebuffer.cs
-
src/Skia/Avalonia.Skia/FramebufferRenderTarget.cs
|
|
|
@ -11,7 +11,7 @@ namespace Avalonia.Platform |
|
|
|
{ |
|
|
|
_onDispose = onDispose; |
|
|
|
Address = address; |
|
|
|
Size = Size; |
|
|
|
Size = size; |
|
|
|
RowBytes = rowBytes; |
|
|
|
Dpi = dpi; |
|
|
|
Format = format; |
|
|
|
|
|
|
|
@ -143,23 +143,26 @@ namespace Avalonia.Skia |
|
|
|
|
|
|
|
// Create bitmap using default platform settings
|
|
|
|
_bitmap = new SKBitmap(destinationInfo.Width, destinationInfo.Height); |
|
|
|
SKColorType bitmapColorType; |
|
|
|
|
|
|
|
if (!_bitmap.CanCopyTo(destinationInfo.ColorType)) |
|
|
|
{ |
|
|
|
bitmapColorType = _bitmap.ColorType; |
|
|
|
_bitmap.Dispose(); |
|
|
|
|
|
|
|
throw new Exception( |
|
|
|
$"Unable to create pixel format shim for conversion from {_bitmap.ColorType} to {destinationInfo.ColorType}"); |
|
|
|
$"Unable to create pixel format shim for conversion from {bitmapColorType} to {destinationInfo.ColorType}"); |
|
|
|
} |
|
|
|
|
|
|
|
Surface = SKSurface.Create(_bitmap.Info, _bitmap.GetPixels(), _bitmap.RowBytes); |
|
|
|
|
|
|
|
if (Surface == null) |
|
|
|
{ |
|
|
|
bitmapColorType = _bitmap.ColorType; |
|
|
|
_bitmap.Dispose(); |
|
|
|
|
|
|
|
throw new Exception( |
|
|
|
$"Unable to create pixel format shim surface for conversion from {_bitmap.ColorType} to {destinationInfo.ColorType}"); |
|
|
|
$"Unable to create pixel format shim surface for conversion from {bitmapColorType} to {destinationInfo.ColorType}"); |
|
|
|
} |
|
|
|
|
|
|
|
SurfaceCopyHandler = Disposable.Create(CopySurface); |
|
|
|
|