瀏覽代碼

Fixed crash when opening tab again

flabbet 10 月之前
父節點
當前提交
735359b480
共有 2 個文件被更改,包括 5 次插入42 次删除
  1. 1 1
      src/Drawie
  2. 4 41
      src/PixiEditor/Views/Rendering/Scene.cs

+ 1 - 1
src/Drawie

@@ -1 +1 @@
-Subproject commit ffe1fe7743584bd32cc6b3f6316b13727c21e5fa
+Subproject commit 4dc90b3583da99805af3fd47c9e793f3b6e92a93

+ 4 - 41
src/PixiEditor/Views/Rendering/Scene.cs

@@ -228,6 +228,8 @@ internal class Scene : Zoombox.Zoombox, ICustomHitTest
 
 
     public void Draw(DrawingSurface renderTexture)
     public void Draw(DrawingSurface renderTexture)
     {
     {
+        if (Document == null || SceneRenderer == null) return;
+        
         renderTexture.Canvas.Save();
         renderTexture.Canvas.Save();
         var matrix = CalculateTransformMatrix();
         var matrix = CalculateTransformMatrix();
 
 
@@ -240,47 +242,6 @@ internal class Scene : Zoombox.Zoombox, ICustomHitTest
         renderTexture.Canvas.Restore();
         renderTexture.Canvas.Restore();
     }
     }
 
 
-    public override void Render(DrawingContext context)
-    {
-        if (Document == null || SceneRenderer == null) return;
-
-        int width = (int)Math.Ceiling(Bounds.Width);
-        int height = (int)Math.Ceiling(Bounds.Height);
-        /*if (renderTexture == null || renderTexture.Size.X != width || renderTexture.Size.Y != height)
-        {
-            renderTexture?.Dispose();
-            renderTexture = new Texture(new VecI(width, height));
-        }*/
-
-        float angle = (float)MathUtil.RadiansToDegrees(AngleRadians);
-
-        float resolutionScale = CalculateResolutionScale();
-
-        RectD dirtyBounds = new RectD(0, 0, Document.Width, Document.Height);
-
-
-        /*using var operation = new DrawSceneOperation(SceneRenderer.RenderScene, Document, CanvasPos,
-            Scale * resolutionScale,
-            resolutionScale,
-            sceneOpacity,
-            angle,
-            FlipX, FlipY,
-            Bounds,
-            Bounds,
-            renderTexture);*/
-
-        var matrix = CalculateTransformMatrix();
-        context.PushRenderOptions(new RenderOptions { BitmapInterpolationMode = BitmapInterpolationMode.None });
-        var pushedMatrix = context.PushTransform(matrix);
-
-
-        pushedMatrix.Dispose();
-
-        //RenderFrame(new PixelSize(width, height));
-
-        context.PushTransform(matrix);
-    }
-
     private void RenderScene(RectD bounds)
     private void RenderScene(RectD bounds)
     {
     {
         DrawCheckerboard(bounds);
         DrawCheckerboard(bounds);
@@ -608,6 +569,8 @@ internal class Scene : Zoombox.Zoombox, ICustomHitTest
     protected void FreeGraphicsResources()
     protected void FreeGraphicsResources()
     {
     {
         resources?.DisposeAsync();
         resources?.DisposeAsync();
+        renderSurface?.Dispose();
+        renderSurface = null;
         resources = null;
         resources = null;
     }
     }