From bb7ce36dbe77b3da6674588352834e9ecf196bb8 Mon Sep 17 00:00:00 2001 From: Uncomfy Date: Wed, 9 Oct 2024 17:25:18 +0300 Subject: [PATCH] Made it possible to replace TextureShader in classes that inherit BufferedContainer --- .../Graphics/Containers/BufferedContainer.cs | 12 ++++++------ .../Containers/BufferedContainer_DrawNode.cs | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Framework/Graphics/Containers/BufferedContainer.cs b/osu.Framework/Graphics/Containers/BufferedContainer.cs index aa9aa210a5..eefc039957 100644 --- a/osu.Framework/Graphics/Containers/BufferedContainer.cs +++ b/osu.Framework/Graphics/Containers/BufferedContainer.cs @@ -234,11 +234,11 @@ public bool RedrawOnScale /// private long updateVersion; - public IShader TextureShader { get; private set; } + public IShader TextureShader { get; protected set; } private IShader blurShader; - private readonly BufferedContainerDrawNodeSharedData sharedData; + protected readonly BufferedContainerDrawNodeSharedData SharedData; /// /// Constructs an empty buffered container. @@ -257,7 +257,7 @@ public BufferedContainer(RenderBufferFormat[] formats = null, bool pixelSnapping { UsingCachedFrameBuffer = cachedFrameBuffer; - sharedData = new BufferedContainerDrawNodeSharedData(formats, pixelSnapping, !cachedFrameBuffer); + SharedData = new BufferedContainerDrawNodeSharedData(formats, pixelSnapping, !cachedFrameBuffer); AddLayout(screenSpaceSizeBacking); } @@ -269,7 +269,7 @@ private void load(ShaderManager shaders) blurShader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.BLUR); } - protected override DrawNode CreateDrawNode() => new BufferedContainerDrawNode(this, sharedData); + protected override DrawNode CreateDrawNode() => new BufferedContainerDrawNode(this, SharedData); public override bool UpdateSubTreeMasking() { @@ -350,7 +350,7 @@ public BlendingParameters DrawEffectBlending /// Creates a view which can be added to a container to display the content of this . /// /// The view. - public BufferedContainerView CreateView() => new BufferedContainerView(this, sharedData); + public BufferedContainerView CreateView() => new BufferedContainerView(this, SharedData); public DrawColourInfo? FrameBufferDrawColour => base.DrawColourInfo; @@ -371,7 +371,7 @@ protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); - sharedData.Dispose(); + SharedData.Dispose(); } } diff --git a/osu.Framework/Graphics/Containers/BufferedContainer_DrawNode.cs b/osu.Framework/Graphics/Containers/BufferedContainer_DrawNode.cs index 1a59434037..c06dc4f105 100644 --- a/osu.Framework/Graphics/Containers/BufferedContainer_DrawNode.cs +++ b/osu.Framework/Graphics/Containers/BufferedContainer_DrawNode.cs @@ -19,7 +19,7 @@ namespace osu.Framework.Graphics.Containers { public partial class BufferedContainer { - private class BufferedContainerDrawNode : BufferedDrawNode, ICompositeDrawNode + protected class BufferedContainerDrawNode : BufferedDrawNode, ICompositeDrawNode { protected new BufferedContainer Source => (BufferedContainer)base.Source; @@ -149,7 +149,7 @@ private record struct BlurParameters } } - private class BufferedContainerDrawNodeSharedData : BufferedDrawNodeSharedData + protected class BufferedContainerDrawNodeSharedData : BufferedDrawNodeSharedData { public BufferedContainerDrawNodeSharedData(RenderBufferFormat[] mainBufferFormats, bool pixelSnapping, bool clipToRootNode) : base(2, mainBufferFormats, pixelSnapping, clipToRootNode)