mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 15:22:55 +08:00
Merge pull request #23575 from Joehuu/fix-inverted-video-only-check
Fix old widescreen videos with black bars not correctly filling screen (again)
This commit is contained in:
commit
ff5dde0ebe
31
osu.Game.Tests/Resources/storyboard_only_video.osu
Normal file
31
osu.Game.Tests/Resources/storyboard_only_video.osu
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
osu file format v14
|
||||||
|
|
||||||
|
[Events]
|
||||||
|
//Background and Video events
|
||||||
|
0,0,"BG.jpg",0,0
|
||||||
|
Video,0,"video.avi"
|
||||||
|
//Break Periods
|
||||||
|
//Storyboard Layer 0 (Background)
|
||||||
|
//Storyboard Layer 1 (Fail)
|
||||||
|
//Storyboard Layer 2 (Pass)
|
||||||
|
//Storyboard Layer 3 (Foreground)
|
||||||
|
//Storyboard Layer 4 (Overlay)
|
||||||
|
//Storyboard Sound Samples
|
||||||
|
|
||||||
|
[TimingPoints]
|
||||||
|
1674,333.333333333333,4,2,1,70,1,0
|
||||||
|
1674,-100,4,2,1,70,0,0
|
||||||
|
3340,-100,4,2,1,70,0,0
|
||||||
|
3507,-100,4,2,1,70,0,0
|
||||||
|
3673,-100,4,2,1,70,0,0
|
||||||
|
|
||||||
|
[Colours]
|
||||||
|
Combo1 : 240,80,80
|
||||||
|
Combo2 : 171,252,203
|
||||||
|
Combo3 : 128,128,255
|
||||||
|
Combo4 : 249,254,186
|
||||||
|
|
||||||
|
[HitObjects]
|
||||||
|
148,303,1674,5,6,3:2:0:0:
|
||||||
|
378,252,1840,1,0,0:0:0:0:
|
||||||
|
389,270,2340,5,2,0:1:0:0:
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -8,6 +9,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
@ -42,6 +44,18 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddStep("Load storyboard with missing video", () => loadStoryboard("storyboard_no_video.osu"));
|
AddStep("Load storyboard with missing video", () => loadStoryboard("storyboard_no_video.osu"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestVideoSize()
|
||||||
|
{
|
||||||
|
AddStep("load storyboard with only video", () =>
|
||||||
|
{
|
||||||
|
// LegacyStoryboardDecoder doesn't parse WidescreenStoryboard, so it is set manually
|
||||||
|
loadStoryboard("storyboard_only_video.osu", s => s.BeatmapInfo.WidescreenStoryboard = false);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("storyboard is correct width", () => Precision.AlmostEquals(storyboard?.Width ?? 0f, 480 * 16 / 9f));
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
@ -102,7 +116,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
decoupledClock.ChangeSource(Beatmap.Value.Track);
|
decoupledClock.ChangeSource(Beatmap.Value.Track);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadStoryboard(string filename)
|
private void loadStoryboard(string filename, Action<Storyboard>? setUpStoryboard = null)
|
||||||
{
|
{
|
||||||
Storyboard loaded;
|
Storyboard loaded;
|
||||||
|
|
||||||
@ -113,6 +127,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
loaded = decoder.Decode(bfr);
|
loaded = decoder.Decode(bfr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setUpStoryboard?.Invoke(loaded);
|
||||||
|
|
||||||
loadStoryboard(loaded);
|
loadStoryboard(loaded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ namespace osu.Game.Storyboards.Drawables
|
|||||||
|
|
||||||
Size = new Vector2(640, 480);
|
Size = new Vector2(640, 480);
|
||||||
|
|
||||||
bool onlyHasVideoElements = Storyboard.Layers.SelectMany(l => l.Elements).Any(e => !(e is StoryboardVideo));
|
bool onlyHasVideoElements = Storyboard.Layers.SelectMany(l => l.Elements).All(e => e is StoryboardVideo);
|
||||||
|
|
||||||
Width = Height * (storyboard.BeatmapInfo.WidescreenStoryboard || onlyHasVideoElements ? 16 / 9f : 4 / 3f);
|
Width = Height * (storyboard.BeatmapInfo.WidescreenStoryboard || onlyHasVideoElements ? 16 / 9f : 4 / 3f);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user