Browse Source

Workaround for invalid SKImageInfo.PlatformColorType on Linux

pull/873/head
Nikita Tsukanov 9 years ago
parent
commit
8014026a6c
  1. 6
      src/Skia/Avalonia.Skia/BitmapImpl.cs

6
src/Skia/Avalonia.Skia/BitmapImpl.cs

@ -24,7 +24,11 @@ namespace Avalonia.Skia
{ {
PixelHeight = height; PixelHeight = height;
PixelWidth = width; PixelWidth = width;
Bitmap = new SKBitmap(width, height, SKImageInfo.PlatformColorType, SKAlphaType.Premul); var colorType = SKImageInfo.PlatformColorType;
var runtime = AvaloniaLocator.Current?.GetService<IRuntimePlatform>()?.GetRuntimeInfo();
if (runtime?.IsDesktop == true && runtime?.OperatingSystem == OperatingSystemType.Linux)
colorType = SKColorType.Bgra8888;
Bitmap = new SKBitmap(width, height, colorType, SKAlphaType.Premul);
} }
public void Dispose() public void Dispose()

Loading…
Cancel
Save