From ee73bd4568494c26df000b80a0f94ccf91e62383 Mon Sep 17 00:00:00 2001 From: TocoToucan Date: Mon, 19 Mar 2018 22:39:00 +0300 Subject: [PATCH] Update ScreenshotManager inline with framework changes --- osu.Game/Graphics/ScreenshotManager.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index ae1aebfbc1..8028b744c9 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -36,7 +36,7 @@ namespace osu.Game.Graphics switch (action) { case GlobalAction.TakeScreenshot: - TakeScreenshot(); + TakeScreenshotAsync(); return true; } @@ -45,9 +45,9 @@ namespace osu.Game.Graphics public bool OnReleased(GlobalAction action) => false; - public void TakeScreenshot() + public async void TakeScreenshotAsync() { - host.TakeScreenshot(screenshotBitmap => + using (var bitmap = await host.TakeScreenshotAsync()) { var fileName = getFileName(); var stream = storage.GetStream(fileName, FileAccess.Write); @@ -55,17 +55,17 @@ namespace osu.Game.Graphics switch (screenshotFormat.Value) { case ScreenshotFormat.Png: - screenshotBitmap.Save(stream, ImageFormat.Png); + bitmap.Save(stream, ImageFormat.Png); break; case ScreenshotFormat.Jpg: - screenshotBitmap.Save(stream, ImageFormat.Jpeg); + bitmap.Save(stream, ImageFormat.Jpeg); break; default: throw new ArgumentOutOfRangeException(nameof(screenshotFormat)); } notificationOverlay.Post(new SimpleNotification { Text = $"{fileName} saved" }); - }); + } } private string getFileName()