Browse Source

Merge pull request #8575 from i3ym/window-icon-x11-fixes

Fix loading window icons on X11
Nikita Tsukanov 3 years ago
parent
commit
8c61f478e8
1 changed files with 2 additions and 8 deletions
  1. 2 8
      src/Avalonia.X11/X11IconLoader.cs

+ 2 - 8
src/Avalonia.X11/X11IconLoader.cs

@@ -48,12 +48,6 @@ namespace Avalonia.X11
             _width = Math.Min(bitmap.PixelSize.Width, 128);
             _height = Math.Min(bitmap.PixelSize.Height, 128);
             _bdata = new uint[_width * _height];
-            fixed (void* ptr = _bdata)
-            {
-                var iptr = (int*)ptr;
-                iptr[0] = _width;
-                iptr[1] = _height;
-            }
             using(var rt = AvaloniaLocator.Current.GetService<IPlatformRenderInterface>().CreateRenderTarget(new[]{this}))
             using (var ctx = rt.CreateDrawingContext(null))
                 ctx.DrawBitmap(bitmap.PlatformImpl, 1, new Rect(bitmap.Size),
@@ -65,7 +59,7 @@ namespace Avalonia.X11
             {
                 var r = y * _width;
                 for (var x = 0; x < _width; x++)
-                    Data[r + x] = new UIntPtr(_bdata[r + x]);
+                    Data[r + x + 2] = new UIntPtr(_bdata[r + x]);
             }
 
             _bdata = null;
@@ -86,7 +80,7 @@ namespace Avalonia.X11
                         var r = y * _width;
                         var fbr = y * fb.RowBytes / 4;
                         for (var x = 0; x < _width; x++)
-                            fbp[fbr + x] = Data[r + x].ToUInt32();
+                            fbp[fbr + x] = Data[r + x + 2].ToUInt32();
                     }
                 }
                 wr.Save(outputStream);