mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
Queue ClearCache
This commit is contained in:
parent
8e671348ae
commit
87a0c958cf
1 changed files with 12 additions and 2 deletions
|
@ -35,7 +35,7 @@ public abstract class BaseEffectShape : BaseShape
|
|||
|
||||
public abstract string OverlayText { get; }
|
||||
|
||||
private bool isEffectCaching, cachePending;
|
||||
private bool isEffectCaching, cachePending, cacheClearingPending;
|
||||
private Image cachedEffect;
|
||||
|
||||
public abstract void ApplyEffect(Bitmap bmp);
|
||||
|
@ -44,6 +44,11 @@ public override void OnUpdate()
|
|||
{
|
||||
base.OnUpdate();
|
||||
|
||||
if (cacheClearingPending)
|
||||
{
|
||||
ClearCache();
|
||||
}
|
||||
|
||||
if (cachePending)
|
||||
{
|
||||
CacheEffect();
|
||||
|
@ -166,10 +171,15 @@ private void CacheEffect()
|
|||
|
||||
private void ClearCache()
|
||||
{
|
||||
if (!isEffectCaching && cachedEffect != null)
|
||||
if (isEffectCaching)
|
||||
{
|
||||
cacheClearingPending = true;
|
||||
}
|
||||
else if (cachedEffect != null)
|
||||
{
|
||||
cachedEffect.Dispose();
|
||||
cachedEffect = null;
|
||||
cacheClearingPending = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue