From dfdcc287892c2b3bdbbb79755870672841b31210 Mon Sep 17 00:00:00 2001 From: Kurt Date: Tue, 28 Aug 2018 16:40:27 -0700 Subject: [PATCH] reduce animation fragility #2072 no idea if this works since I can't repro on my end --- .../Controls/SAV Editor/BitmapAnimator.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/PKHeX.WinForms/Controls/SAV Editor/BitmapAnimator.cs b/PKHeX.WinForms/Controls/SAV Editor/BitmapAnimator.cs index d1ec4842f..8448a4a63 100644 --- a/PKHeX.WinForms/Controls/SAV Editor/BitmapAnimator.cs +++ b/PKHeX.WinForms/Controls/SAV Editor/BitmapAnimator.cs @@ -14,7 +14,8 @@ public BitmapAnimator(Image extraLayer = null) Elapsed += TimerElapsed; } - private Image GlowBase; + private int imgWidth; + private int imgHeight; private byte[] GlowData; private readonly Image ExtraLayer; private Image[] GlowCache; @@ -50,9 +51,12 @@ public new void Stop() public void Start(PictureBox pbox, Image baseImage, byte[] glowData, Image original) { - GlowBase = baseImage; + Enabled = false; + imgWidth = baseImage.Width; + imgHeight = baseImage.Height; GlowData = glowData; pb = pbox; + GlowCounter = 0; OriginalBackground = original; GlowCache = new Image[GlowFps]; GlowInterval = 1000 / GlowFps; @@ -85,10 +89,10 @@ private Image GetFrame(int frameIndex) var frameData = (byte[])GlowData.Clone(); ImageUtil.ChangeAllColorTo(frameData, frameColor); - frame = ImageUtil.GetBitmap(frameData, GlowBase.Width, GlowBase.Height); + frame = (Image)ImageUtil.GetBitmap(frameData, imgWidth, imgHeight).Clone(); if (ExtraLayer != null) - frame = ImageUtil.LayerImage(frame, ExtraLayer, 0, 0, 1); - frame = ImageUtil.LayerImage(OriginalBackground, frame, 0, 0, 1); + frame = ImageUtil.LayerImage(frame, ExtraLayer, 0, 0); + frame = ImageUtil.LayerImage(OriginalBackground, frame, 0, 0); return GlowCache[frameIndex] = frame; }