Parcourir la source

Various fixes

flabbet il y a 1 an
Parent
commit
f6a600fd5a

+ 1 - 1
src/PixiEditor.Api.CGlueMSBuild/CApiGenerator.cs

@@ -170,7 +170,7 @@ public class CApiGenerator
             }
         }
 
-        sb.AppendLine(")");
+        sb.Append(")");
     }
 
     private string BuildAttachedFunction(MethodDefinition method)

+ 1 - 1
src/PixiEditor.AvaloniaUI/Views/Rendering/Scene.cs

@@ -477,7 +477,7 @@ internal class DrawSceneOperation : SkiaDrawOperation
         Angle = angle;
         FlipX = flipX;
         FlipY = flipY;
-        ViewportBounds = viewportBounds.Deflate(new Thickness(200));
+        ViewportBounds = viewportBounds;
         _paint.Color = _paint.Color.WithAlpha((byte)(opacity * 255));
         SurfaceRectToRender = FindRectToRender((float)scale);
     }

+ 0 - 1
src/PixiEditor.UI.Common/Controls/Window.axaml

@@ -9,7 +9,6 @@
         <Setter Property="FontSize" Value="{DynamicResource FontSizeNormal}" />
         <Setter Property="WindowStartupLocation" Value="CenterScreen" />
         <Setter Property="ExtendClientAreaChromeHints" Value="NoChrome" />
-        <Setter Property="SystemDecorations" Value="None"/>
         <Setter Property="ExtendClientAreaToDecorationsHint" Value="True" />
         <Setter Property="ExtendClientAreaTitleBarHeightHint" Value="36" />
         <Setter Property="Template">

+ 2 - 4
src/PixiEditor.WasmApi.Gen/ApiGenerator.cs

@@ -96,7 +96,6 @@ public class ApiGenerator : IIncrementalGenerator
 
         foreach (var argSymbol in arguments)
         {
-            // For some reason, int, double are passed as is, not as a pointer
             if (!TypeConversionTable.IsValuePassableType(argSymbol.Type, out _))
             {
                 string lowerType = argSymbol.Type.Name;
@@ -137,11 +136,10 @@ public class ApiGenerator : IIncrementalGenerator
                     string statementString =
                         $"return WasmMemoryUtility.Write{returnType}({returnStatementSyntax.Expression.ToFullString()});";
 
-                    statementString = $"return {returnStatementSyntax.Expression.ToFullString()};";
-                    /*if (TypeConversionTable.IsValuePassableType(method.methodSymbol.ReturnType, out _))
+                    if (TypeConversionTable.IsValuePassableReturnType(method.methodSymbol.ReturnType, out _))
                     {
                         statementString = $"return {returnStatementSyntax.Expression.ToFullString()};";
-                    }*/
+                    }
 
                     syntaxes = syntaxes.Add(SyntaxFactory.ParseStatement(statementString));
                 }

+ 30 - 0
src/PixiEditor.WasmApi.Gen/TypeConversionTable.cs

@@ -43,4 +43,34 @@ public static class TypeConversionTable
         typeName = null;
         return false;
     }
+    
+    public static bool IsValuePassableReturnType(ITypeSymbol argSymbol, out string? typeName)
+    {
+        if (argSymbol.Name.Equals("int32", StringComparison.OrdinalIgnoreCase))
+        {
+            typeName = "int";
+            return true;
+        }
+
+        if (argSymbol.Name.Equals("double", StringComparison.OrdinalIgnoreCase))
+        {
+            typeName = "double";
+            return true;
+        }
+        
+        /*if (argSymbol.Name.Equals("float", StringComparison.OrdinalIgnoreCase))
+        {
+            typeName = "float";
+            return true;
+        }
+        
+        if (argSymbol.Name.Equals("string", StringComparison.OrdinalIgnoreCase))
+        {
+            typeName = "string";
+            return true;
+        }*/
+
+        typeName = null;
+        return false;
+    }
 }