From ef7acee5315a497e7b9528a6ca2583720fdb0943 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sun, 1 May 2022 01:00:27 +0800 Subject: [PATCH] Now it's able to calculate the draw quad by the shader. --- osu.Framework.Font/Graphics/Sprites/LyricSpriteText.cs | 2 +- .../Graphics/Sprites/LyricSpriteText_DrawNode.cs | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/osu.Framework.Font/Graphics/Sprites/LyricSpriteText.cs b/osu.Framework.Font/Graphics/Sprites/LyricSpriteText.cs index 9026712..a0b5ac0 100644 --- a/osu.Framework.Font/Graphics/Sprites/LyricSpriteText.cs +++ b/osu.Framework.Font/Graphics/Sprites/LyricSpriteText.cs @@ -113,7 +113,7 @@ public IReadOnlyList Shaders if (value != null) shaders.AddRange(value); - Invalidate(Invalidation.DrawNode); + Invalidate(); } } diff --git a/osu.Framework.Font/Graphics/Sprites/LyricSpriteText_DrawNode.cs b/osu.Framework.Font/Graphics/Sprites/LyricSpriteText_DrawNode.cs index 1d69013..d57a8d9 100644 --- a/osu.Framework.Font/Graphics/Sprites/LyricSpriteText_DrawNode.cs +++ b/osu.Framework.Font/Graphics/Sprites/LyricSpriteText_DrawNode.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using osu.Framework.Graphics.Extensions; +using System.Linq; using osu.Framework.Graphics.OpenGL.Vertices; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Shaders; @@ -17,8 +17,12 @@ public partial class LyricSpriteText protected override Quad ComputeScreenSpaceDrawQuad() { // make draw size become bigger (for not masking the shader). - var newRectangle = DrawRectangle.Scale(2); - return ToScreenSpace(newRectangle); + var quad = ToScreenSpace(DrawRectangle); + var drawRectangele = Shaders.OfType() + .Select(x => x.ComputeScreenSpaceDrawQuad(quad).AABBFloat) + .Aggregate(quad.AABBFloat, RectangleF.Union); + + return Quad.FromRectangle(drawRectangele); } protected override DrawNode CreateDrawNode()