Browse Source

[X11] Fixed references and update to new API

pull/2011/head
Nikita Tsukanov 7 years ago
parent
commit
97faa23d38
  1. 4
      samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj
  2. 2
      src/Avalonia.Desktop/Avalonia.Desktop.csproj
  3. 2
      src/Avalonia.X11/Avalonia.X11.csproj
  4. 18
      src/Avalonia.X11/X11Framebuffer.cs
  5. 4
      src/Avalonia.X11/X11Window.cs

4
samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj

@ -6,12 +6,10 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\src\Avalonia.DesignerSupport\Avalonia.DesignerSupport.csproj" />
<ProjectReference Include="..\..\src\Avalonia.DotNetCoreRuntime\Avalonia.DotNetCoreRuntime.csproj" />
<ProjectReference Include="..\..\src\Avalonia.X11\Avalonia.X11.csproj" />
<ProjectReference Include="..\..\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj" /> <ProjectReference Include="..\..\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj" />
<ProjectReference Include="..\ControlCatalog\ControlCatalog.csproj" /> <ProjectReference Include="..\ControlCatalog\ControlCatalog.csproj" />
<ProjectReference Include="..\..\src\Avalonia.Desktop\Avalonia.Desktop.csproj" /> <ProjectReference Include="..\..\src\Avalonia.Desktop\Avalonia.Desktop.csproj" />
<ProjectReference Include="..\..\src\Avalonia.X11\Avalonia.X11.csproj" />
</ItemGroup> </ItemGroup>

2
src/Avalonia.Desktop/Avalonia.Desktop.csproj

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks> <TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

2
src/Avalonia.X11/Avalonia.X11.csproj

@ -6,7 +6,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\packages\Avalonia\Avalonia.csproj" /> <ProjectReference Include="..\..\packages\Avalonia\Avalonia.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

18
src/Avalonia.X11/X11Framebuffer.cs

@ -13,12 +13,11 @@ namespace Avalonia.X11
{ {
_display = display; _display = display;
_xid = xid; _xid = xid;
Width = width*factor; Size = new PixelSize(width * factor, height * factor);
Height = height*factor; RowBytes = width * 4;
RowBytes = Width * 4;
Dpi = new Vector(96, 96) * factor; Dpi = new Vector(96, 96) * factor;
Format = PixelFormat.Bgra8888; Format = PixelFormat.Bgra8888;
_blob = AvaloniaLocator.Current.GetService<IRuntimePlatform>().AllocBlob(RowBytes * Height); _blob = AvaloniaLocator.Current.GetService<IRuntimePlatform>().AllocBlob(RowBytes * height);
Address = _blob.Address; Address = _blob.Address;
} }
@ -26,8 +25,8 @@ namespace Avalonia.X11
{ {
var image = new XImage(); var image = new XImage();
int bitsPerPixel = 32; int bitsPerPixel = 32;
image.width = Width; image.width = Size.Width;
image.height = Height; image.height = Size.Height;
image.format = 2; //ZPixmap; image.format = 2; //ZPixmap;
image.data = Address; image.data = Address;
image.byte_order = 0;// LSBFirst; image.byte_order = 0;// LSBFirst;
@ -35,12 +34,12 @@ namespace Avalonia.X11
image.bitmap_bit_order = 0;// LSBFirst; image.bitmap_bit_order = 0;// LSBFirst;
image.bitmap_pad = bitsPerPixel; image.bitmap_pad = bitsPerPixel;
image.depth = 24; image.depth = 24;
image.bytes_per_line = RowBytes - Width * 4; image.bytes_per_line = RowBytes - Size.Width * 4;
image.bits_per_pixel = bitsPerPixel; image.bits_per_pixel = bitsPerPixel;
XLockDisplay(_display); XLockDisplay(_display);
XInitImage(ref image); XInitImage(ref image);
var gc = XCreateGC(_display, _xid, 0, IntPtr.Zero); var gc = XCreateGC(_display, _xid, 0, IntPtr.Zero);
XPutImage(_display, _xid, gc, ref image, 0, 0, 0, 0, (uint) Width, (uint) Height); XPutImage(_display, _xid, gc, ref image, 0, 0, 0, 0, (uint) Size.Width, (uint) Size.Height);
XFreeGC(_display, gc); XFreeGC(_display, gc);
XSync(_display, true); XSync(_display, true);
XUnlockDisplay(_display); XUnlockDisplay(_display);
@ -48,8 +47,7 @@ namespace Avalonia.X11
} }
public IntPtr Address { get; } public IntPtr Address { get; }
public int Width { get; } public PixelSize Size { get; }
public int Height { get; }
public int RowBytes { get; } public int RowBytes { get; }
public Vector Dpi { get; } public Vector Dpi { get; }
public PixelFormat Format { get; } public PixelFormat Format { get; }

4
src/Avalonia.X11/X11Window.cs

@ -116,7 +116,7 @@ namespace Avalonia.X11
} }
public IntPtr Handle { get; } public IntPtr Handle { get; }
public System.Drawing.Size PixelSize public PixelSize Size
{ {
get get
{ {
@ -126,7 +126,7 @@ namespace Avalonia.X11
XFlush(_display); XFlush(_display);
XSync(_display, true); XSync(_display, true);
XUnlockDisplay(_display); XUnlockDisplay(_display);
return new System.Drawing.Size(geo.width, geo.height); return new PixelSize(geo.width, geo.height);
} }
} }

Loading…
Cancel
Save