瀏覽代碼

[X11] Fixed references and update to new API

Nikita Tsukanov 7 年之前
父節點
當前提交
97faa23d38

+ 1 - 3
samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj

@@ -6,12 +6,10 @@
   </PropertyGroup>
 
   <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="..\ControlCatalog\ControlCatalog.csproj" />
     <ProjectReference Include="..\..\src\Avalonia.Desktop\Avalonia.Desktop.csproj" />
+    <ProjectReference Include="..\..\src\Avalonia.X11\Avalonia.X11.csproj" />
   </ItemGroup>
 
 

+ 1 - 1
src/Avalonia.Desktop/Avalonia.Desktop.csproj

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

+ 1 - 1
src/Avalonia.X11/Avalonia.X11.csproj

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

+ 8 - 10
src/Avalonia.X11/X11Framebuffer.cs

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

+ 2 - 2
src/Avalonia.X11/X11Window.cs

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