From 37e6c198a169dd946921f92c79ff7e3bfe2f85ae Mon Sep 17 00:00:00 2001 From: Frank Skare Date: Sat, 6 Jul 2019 03:46:36 +0200 Subject: [PATCH] - --- Changelog.md | 7 ++++--- mpv.net/mpv/mp.cs | 14 ++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Changelog.md b/Changelog.md index 1a9840f..e85e12e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,10 +1,11 @@ ### - fix for middle mouse button not working -- the config dialog was showing a message about app restart even when no - settings were modified +- fix of logo overlay using a huge amount of memory +- fix config dialog showing a message about app restart without reason - when multiple files are selected in Windows File Explorer and enter is - pressed, the files are opened, the order is random however + pressed, the files are opened as selected, the order is random though + because Explorer starts multiple mpv.net processes concurrently - libmpv was updated to shinchiro 2019-06-30 ### 4.5 diff --git a/mpv.net/mpv/mp.cs b/mpv.net/mpv/mp.cs index 6a5fdcd..028c857 100644 --- a/mpv.net/mpv/mp.cs +++ b/mpv.net/mpv/mp.cs @@ -648,18 +648,20 @@ namespace mpvnet if (MainForm.Instance is null) return; Rectangle cr = MainForm.Instance.ClientRectangle; if (cr.Width == 0 || cr.Height == 0) return; + int len = cr.Height / 5; - using (Bitmap b = new Bitmap(cr.Width, cr.Height)) + using (Bitmap b = new Bitmap(len, len)) { using (Graphics g = Graphics.FromImage(b)) { g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.Clear(Color.Black); - int iconWidth = cr.Height / 7; - Rectangle r = new Rectangle(cr.Width / 2 - iconWidth / 2, cr.Height / 2 - iconWidth / 2, iconWidth, iconWidth); - g.DrawImage(Properties.Resources.mpvnet, r); - BitmapData bd = b.LockBits(cr, ImageLockMode.ReadOnly, PixelFormat.Format32bppPArgb); - commandv("overlay-add", "0", "0", "0", "&" + bd.Scan0.ToInt64().ToString(), "0", "bgra", bd.Width.ToString(), bd.Height.ToString(), bd.Stride.ToString()); + Rectangle rect = new Rectangle(0, 0, len, len); + g.DrawImage(Properties.Resources.mpvnet, rect); + BitmapData bd = b.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppPArgb); + int x = Convert.ToInt32((cr.Width - len) / 2.0); + int y = Convert.ToInt32(((cr.Height - len) / 2.0) * 0.9); + commandv("overlay-add", "0", $"{x}", $"{y}", "&" + bd.Scan0.ToInt64().ToString(), "0", "bgra", bd.Width.ToString(), bd.Height.ToString(), bd.Stride.ToString()); b.UnlockBits(bd); IsLogoVisible = true; }