fix memory leaks in filters
This commit is contained in:
parent
4ef07ddf23
commit
35fa5f5985
|
@ -582,8 +582,7 @@ namespace BizHawk.MultiClient
|
||||||
//SHOULD THIS BE RUN REPEATEDLY?
|
//SHOULD THIS BE RUN REPEATEDLY?
|
||||||
//some filters may need to run repeatedly (temporal interpolation, ntsc scanline field alternating)
|
//some filters may need to run repeatedly (temporal interpolation, ntsc scanline field alternating)
|
||||||
//but its sort of wasted work.
|
//but its sort of wasted work.
|
||||||
|
CheckFilter();
|
||||||
if (Global.Config.TargetDisplayFilter > 0) CheckFilter();
|
|
||||||
|
|
||||||
int w = currNativeWidth;
|
int w = currNativeWidth;
|
||||||
int h = currNativeHeight;
|
int h = currNativeHeight;
|
||||||
|
@ -596,8 +595,11 @@ namespace BizHawk.MultiClient
|
||||||
//if (luaEmuSurface != null) complexComposite = true;
|
//if (luaEmuSurface != null) complexComposite = true;
|
||||||
//if (luaSurface != null) complexComposite = true;
|
//if (luaSurface != null) complexComposite = true;
|
||||||
|
|
||||||
|
DisplaySurface surfaceToRender = filteredSurface;
|
||||||
|
if (surfaceToRender == null) surfaceToRender = currentSourceSurface;
|
||||||
|
|
||||||
Global.RenderPanel.Clear(Color.FromArgb(videoProvider.BackgroundColor));
|
Global.RenderPanel.Clear(Color.FromArgb(videoProvider.BackgroundColor));
|
||||||
Global.RenderPanel.Render(currentSourceSurface);
|
Global.RenderPanel.Render(surfaceToRender);
|
||||||
if (luaEmuSurface != null)
|
if (luaEmuSurface != null)
|
||||||
Global.RenderPanel.RenderOverlay(luaEmuSurface);
|
Global.RenderPanel.RenderOverlay(luaEmuSurface);
|
||||||
|
|
||||||
|
@ -605,7 +607,9 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
Global.RenderPanel.Present();
|
Global.RenderPanel.Present();
|
||||||
|
|
||||||
|
if (filteredSurface != null)
|
||||||
|
filteredSurface.Dispose();
|
||||||
|
filteredSurface = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Disposed { get; private set; }
|
public bool Disposed { get; private set; }
|
||||||
|
@ -616,7 +620,7 @@ namespace BizHawk.MultiClient
|
||||||
Disposed = true;
|
Disposed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplaySurface currentSourceSurface;
|
DisplaySurface currentSourceSurface, filteredSurface;
|
||||||
|
|
||||||
//the surface to use to render a lua layer at native resolution (under the OSD)
|
//the surface to use to render a lua layer at native resolution (under the OSD)
|
||||||
DisplaySurface luaNativeSurfacePreOSD;
|
DisplaySurface luaNativeSurfacePreOSD;
|
||||||
|
@ -669,10 +673,12 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
void CheckFilter()
|
void CheckFilter()
|
||||||
{
|
{
|
||||||
|
|
||||||
IDisplayFilter filter = null;
|
IDisplayFilter filter = null;
|
||||||
switch (Global.Config.TargetDisplayFilter)
|
switch (Global.Config.TargetDisplayFilter)
|
||||||
{
|
{
|
||||||
|
case 0:
|
||||||
|
//no filter
|
||||||
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
filter = new Hq2xBase_2xSai();
|
filter = new Hq2xBase_2xSai();
|
||||||
break;
|
break;
|
||||||
|
@ -684,9 +690,10 @@ namespace BizHawk.MultiClient
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
var tempSurface = filter.Execute(currentSourceSurface);
|
if (filter == null)
|
||||||
currentSourceSurface.Dispose();
|
filteredSurface = null;
|
||||||
currentSourceSurface = tempSurface;
|
else
|
||||||
|
filteredSurface = filter.Execute(currentSourceSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
SwappableDisplaySurfaceSet nativeDisplaySurfaceSet = new SwappableDisplaySurfaceSet();
|
SwappableDisplaySurfaceSet nativeDisplaySurfaceSet = new SwappableDisplaySurfaceSet();
|
||||||
|
|
|
@ -37,6 +37,7 @@ namespace BizHawk.MultiClient
|
||||||
if(this is Hq2xBase_2xSai) _2xSaI32((byte*)padded.PixelPtr + padded.OffsetOf(1, 1), (uint)(padded.Stride), null, (byte*)ret.PixelPtr, (uint)(ret.Stride), (uint)w, (uint)h);
|
if(this is Hq2xBase_2xSai) _2xSaI32((byte*)padded.PixelPtr + padded.OffsetOf(1, 1), (uint)(padded.Stride), null, (byte*)ret.PixelPtr, (uint)(ret.Stride), (uint)w, (uint)h);
|
||||||
if (this is Hq2xBase_Super2xSai) Super2xSaI32((byte*)padded.PixelPtr + padded.OffsetOf(1, 1), (uint)(padded.Stride), null, (byte*)ret.PixelPtr, (uint)(ret.Stride), (uint)w, (uint)h);
|
if (this is Hq2xBase_Super2xSai) Super2xSaI32((byte*)padded.PixelPtr + padded.OffsetOf(1, 1), (uint)(padded.Stride), null, (byte*)ret.PixelPtr, (uint)(ret.Stride), (uint)w, (uint)h);
|
||||||
if (this is Hq2xBase_SuperEagle) SuperEagle32((byte*)padded.PixelPtr + padded.OffsetOf(1, 1), (uint)(padded.Stride), null, (byte*)ret.PixelPtr, (uint)(ret.Stride), (uint)w, (uint)h);
|
if (this is Hq2xBase_SuperEagle) SuperEagle32((byte*)padded.PixelPtr + padded.OffsetOf(1, 1), (uint)(padded.Stride), null, (byte*)ret.PixelPtr, (uint)(ret.Stride), (uint)w, (uint)h);
|
||||||
|
padded.Dispose();
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue