Fix FrameDelay being too fast

This commit is contained in:
Infi
2024-05-11 09:09:36 +02:00
parent e7e4c0e221
commit 32ccf72112
+5
View File
@@ -255,6 +255,11 @@ public static class EmoteCache
foreach (var frame in img.Frames)
{
var delay = frame.Metadata.GetGifMetadata().FrameDelay / 100f;
// Follows the same pattern as browsers, anything under 0.02s delay will be rounded up to 0.1s
if (delay < 0.02f)
delay = 0.1f;
var buffer = new byte[4 * frame.Width * frame.Height];
frame.CopyPixelDataTo(buffer);
var tex = await Plugin.Interface.UiBuilder.LoadImageRawAsync(buffer, frame.Width, frame.Height, 4);