Browse Source

Merge pull request #2044 from spixy/master

General fixes
release/0.7.0
danwalmsley 7 years ago
committed by GitHub
parent
commit
4dde2b0033
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/Avalonia.Visuals/Platform/LockedFramebuffer.cs
  2. 7
      src/Skia/Avalonia.Skia/FramebufferRenderTarget.cs

2
src/Avalonia.Visuals/Platform/LockedFramebuffer.cs

@ -11,7 +11,7 @@ namespace Avalonia.Platform
{
_onDispose = onDispose;
Address = address;
Size = Size;
Size = size;
RowBytes = rowBytes;
Dpi = dpi;
Format = format;

7
src/Skia/Avalonia.Skia/FramebufferRenderTarget.cs

@ -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);

Loading…
Cancel
Save