Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance rendering framework with new RenderNode architecture #1196

Merged
merged 36 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b390a16
feat: add RenderNode, RenderNodeContext, and RenderNodeOperation clas…
yuto-trd Dec 7, 2024
8bfccdd
feat: add various RenderNode implementations for enhanced rendering c…
yuto-trd Dec 7, 2024
a7ddf50
feat: implement IPopable interface and update PushedState to use it
yuto-trd Dec 7, 2024
75a4d76
feat: Implement GraphicsContext2D class for recording RenderNodes.
yuto-trd Dec 7, 2024
ed6ed55
feat: mark CombinedFilterEffect and MultiTransform as obsolete, sugge…
yuto-trd Dec 7, 2024
d60229b
feat: add OnUntracked callback and improve node disposal in GraphicsC…
yuto-trd Dec 7, 2024
98ffbb1
feat: add RenderNodeCache and RenderNodeProcessor for enhanced render…
yuto-trd Dec 7, 2024
02840bb
feat: add unit tests for GraphicsContext2D to validate rendering beha…
yuto-trd Dec 7, 2024
380f10e
feat: mark multiple rendering classes as obsolete to suggest alternat…
yuto-trd Dec 7, 2024
e3a298f
feat: update rendering methods to use GraphicsContext2D and mark Defe…
yuto-trd Dec 7, 2024
47c17ab
feat: mark DeferradCanvas as obsolete and comment out rendering logic
yuto-trd Dec 7, 2024
47bdf57
feat: refactor rendering cache to use RenderNodeCacheContext and upda…
yuto-trd Dec 7, 2024
fb733b1
feat: update RenderLayer to use DrawableRenderNode and GraphicsContex…
yuto-trd Dec 7, 2024
9007049
feat: update ImmediateCanvas to use RenderNodeCacheContext and commen…
yuto-trd Dec 7, 2024
f908a04
feat: refactor PlayerViewModel to use DrawableRenderNode and Graphics…
yuto-trd Dec 7, 2024
40c340e
fix: build error
yuto-trd Dec 7, 2024
54a2942
fix: Fixed possible memory leak code
yuto-trd Dec 7, 2024
54ef03c
feat: Add TODO for supporting multiple EffectTargets in TransformEffect
yuto-trd Dec 7, 2024
c0c5f48
feat: Implement DrawDrawable method in ImmediateCanvas
yuto-trd Dec 7, 2024
af96e69
refactor: Replace Render calls with DrawDrawable in unit tests
yuto-trd Dec 7, 2024
8e93486
refactor: Remove DeferradCanvasTests and update GraphicsContext2DTest…
yuto-trd Dec 7, 2024
9499210
fix: correct behavior of PushLayer
yuto-trd Dec 7, 2024
ae75457
feat: Add TODO to disable caching when context.IsCacheEnabled is fals…
yuto-trd Dec 7, 2024
c870404
refactor: Remove obsolete rendering nodes and interfaces
yuto-trd Dec 7, 2024
1d308d8
refactor: Remove obsolete Cache references and update rendering logic
yuto-trd Dec 7, 2024
a6d89f7
change: relocate files previously moved temporarily under Rendering.V2
yuto-trd Dec 7, 2024
46c9398
feat: implement logic for creating cache
yuto-trd Dec 7, 2024
ed6503e
change: move cache ownership from RenderNodeCacheContext to RenderNode
yuto-trd Dec 7, 2024
85e4e23
feat: add bounds calculation for RenderLayer
yuto-trd Dec 7, 2024
5c728dc
change: refactor HitTest implementation to use RenderNode
yuto-trd Dec 7, 2024
65696f5
test: reorganize rendering tests and add new test cases for render nodes
yuto-trd Dec 7, 2024
241b454
fix: correct processing in RenderNodeProcessor.Rasterize
yuto-trd Dec 7, 2024
4f8be4e
test: add unit tests for EllipseRenderNode, RectClipRenderNode, Recta…
yuto-trd Dec 8, 2024
35e9ab5
feat: simplify FilterEffectActivator
yuto-trd Dec 9, 2024
1fc4db9
fix: resolve exception occurring in RenderNode caching
yuto-trd Dec 9, 2024
1ccb01e
refactor: streamline FilterEffectActivator by removing unnecessary fi…
yuto-trd Dec 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: mark multiple rendering classes as obsolete to suggest alternat…
…ives
  • Loading branch information
yuto-trd committed Dec 7, 2024
commit 380f10ea80de78a009ee353bae94ec28ddb898fb
3 changes: 2 additions & 1 deletion src/Beutl.Engine/Graphics/ImmediateCanvas.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Beutl.Graphics.Effects;
using Beutl.Graphics.Effects;
using Beutl.Graphics.Rendering;
using Beutl.Graphics.Rendering.Cache;
using Beutl.Media;
Expand Down Expand Up @@ -178,6 +178,7 @@ public void DrawDrawable(Drawable drawable)
drawable.Render(this);
}

[Obsolete("Obsolete")]
public void DrawNode(IGraphicNode node)
{
if (GetCacheContext() is { } context)
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/BrushDrawNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Beutl.Graphics.Rendering;

[Obsolete]
public abstract class BrushDrawNode : DrawNode
{
protected BrushDrawNode(IBrush? fill, IPen? pen, Rect bounds)
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/ClearNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Beutl.Graphics.Rendering;

[Obsolete]
public sealed class ClearNode(Color color) : DrawNode(Rect.Empty)
{
public Color Color { get; } = color;
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/ContainerNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Beutl.Graphics.Rendering;

[Obsolete]
public class ContainerNode : IGraphicNode
{
private readonly List<IGraphicNode> _children = [];
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/DrawBackdropNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Beutl.Graphics.Rendering;

[Obsolete]
public class DrawBackdropNode(IBackdrop backdrop, Rect bounds) : DrawNode(bounds), ISupportRenderCache
{
public IBackdrop Backdrop { get; } = backdrop;
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/DrawNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Beutl.Graphics.Rendering;

[Obsolete]
public abstract class DrawNode : IGraphicNode
{
public DrawNode(Rect bounds)
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/DrawableNode.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace Beutl.Graphics.Rendering;

[Obsolete]
public class DrawableNode(Drawable drawable) : ContainerNode
{
public Drawable Drawable { get; private set; } = drawable;
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/EllipseNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Beutl.Graphics.Rendering;

[Obsolete]
public sealed class EllipseNode(Rect rect, IBrush? fill, IPen? pen)
: BrushDrawNode(fill, pen, PenHelper.GetBounds(rect, pen))
{
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/FilterEffectNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace Beutl.Graphics.Rendering;

[Obsolete]
public sealed class FilterEffectNode : ContainerNode, ISupportRenderCache
{
private FilterEffectNodeComparer _comparer;
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/GeometryClipNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Beutl.Graphics.Rendering;

[Obsolete]
public sealed class GeometryClipNode(Geometry clip, ClipOperation operation) : ContainerNode
{
private readonly int _version = clip.Version;
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/GeometryNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Beutl.Graphics.Rendering;

[Obsolete]
public sealed class GeometryNode(Geometry geometry, IBrush? fill, IPen? pen)
: BrushDrawNode(fill, pen, PenHelper.CalculateBoundsWithStrokeCap(geometry.GetRenderBounds(pen), pen))
{
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/IGraphicNode.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace Beutl.Graphics.Rendering;

[Obsolete]
public interface IGraphicNode : INode
{
Rect Bounds { get; }
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/ImageSourceNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Beutl.Graphics.Rendering;

[Obsolete]
public sealed class ImageSourceNode(IImageSource source, IBrush? fill, IPen? pen)
: BrushDrawNode(fill, pen, PenHelper.GetBounds(new Rect(default, source.FrameSize.ToSize(1)), pen))
{
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/LayerNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace Beutl.Graphics.Rendering;

[Obsolete]
public class LayerNode(Rect limit) : ContainerNode
{
public Rect Limit { get; } = limit;
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/OpacityMaskNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Beutl.Graphics.Rendering;

[Obsolete]
public sealed class OpacityMaskNode(IBrush mask, Rect maskBounds, bool invert) : ContainerNode
{
public IBrush Mask { get; private set; } = (mask as IMutableBrush)?.ToImmutable() ?? mask;
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/OpacityNode.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace Beutl.Graphics.Rendering;

[Obsolete]
public sealed class OpacityNode(float opacity) : ContainerNode
{
public float Opacity { get; } = opacity;
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/PushNode.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace Beutl.Graphics.Rendering;

[Obsolete]
public sealed class PushNode : ContainerNode
{
public PushNode()
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/RectClipNode.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace Beutl.Graphics.Rendering;

[Obsolete]
public sealed class RectClipNode(Rect clip, ClipOperation operation) : ContainerNode
{
public Rect Clip { get; } = clip;
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/RectangleNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Beutl.Graphics.Rendering;

[Obsolete]
public sealed class RectangleNode(Rect rect, IBrush? fill, IPen? pen)
: BrushDrawNode(fill, pen, PenHelper.GetBounds(rect, pen))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Beutl.Graphics.Rendering;

[Obsolete]
public class SnapshotBackdropNode() : DrawNode(default), IBackdrop, ISupportRenderCache
{
private Bitmap<Bgra8888>? _bitmap;
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/TextNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace Beutl.Graphics.Rendering;

[Obsolete]
public sealed class TextNode(FormattedText text, IBrush? fill, IPen? pen)
: BrushDrawNode(fill, pen, text.ActualBounds)
{
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/TransformNode.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace Beutl.Graphics.Rendering;

[Obsolete]
public sealed class TransformNode(Matrix transform, TransformOperator transformOperator) : ContainerNode
{
public Matrix Transform { get; } = transform;
Expand Down
1 change: 1 addition & 0 deletions src/Beutl.Engine/Graphics/Rendering/VideoSourceNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Beutl.Graphics.Rendering;

[Obsolete]
public sealed class VideoSourceNode(
IVideoSource source, int frame, IBrush? fill, IPen? pen)
: BrushDrawNode(fill, pen, PenHelper.GetBounds(new Rect(default, source.FrameSize.ToSize(1)), pen))
Expand Down