diff --git a/BizHawk.MultiClient/DisplayManager/DisplayManager.cs b/BizHawk.MultiClient/DisplayManager/DisplayManager.cs index bb4a7b3859..a09562354e 100644 --- a/BizHawk.MultiClient/DisplayManager/DisplayManager.cs +++ b/BizHawk.MultiClient/DisplayManager/DisplayManager.cs @@ -582,8 +582,7 @@ namespace BizHawk.MultiClient //SHOULD THIS BE RUN REPEATEDLY? //some filters may need to run repeatedly (temporal interpolation, ntsc scanline field alternating) //but its sort of wasted work. - - if (Global.Config.TargetDisplayFilter > 0) CheckFilter(); + CheckFilter(); int w = currNativeWidth; int h = currNativeHeight; @@ -596,8 +595,11 @@ namespace BizHawk.MultiClient //if (luaEmuSurface != 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.Render(currentSourceSurface); + Global.RenderPanel.Render(surfaceToRender); if (luaEmuSurface != null) Global.RenderPanel.RenderOverlay(luaEmuSurface); @@ -605,7 +607,9 @@ namespace BizHawk.MultiClient Global.RenderPanel.Present(); - + if (filteredSurface != null) + filteredSurface.Dispose(); + filteredSurface = null; } public bool Disposed { get; private set; } @@ -616,7 +620,7 @@ namespace BizHawk.MultiClient Disposed = true; } - DisplaySurface currentSourceSurface; + DisplaySurface currentSourceSurface, filteredSurface; //the surface to use to render a lua layer at native resolution (under the OSD) DisplaySurface luaNativeSurfacePreOSD; @@ -669,10 +673,12 @@ namespace BizHawk.MultiClient void CheckFilter() { - IDisplayFilter filter = null; switch (Global.Config.TargetDisplayFilter) { + case 0: + //no filter + break; case 1: filter = new Hq2xBase_2xSai(); break; @@ -684,9 +690,10 @@ namespace BizHawk.MultiClient break; } - var tempSurface = filter.Execute(currentSourceSurface); - currentSourceSurface.Dispose(); - currentSourceSurface = tempSurface; + if (filter == null) + filteredSurface = null; + else + filteredSurface = filter.Execute(currentSourceSurface); } SwappableDisplaySurfaceSet nativeDisplaySurfaceSet = new SwappableDisplaySurfaceSet(); diff --git a/BizHawk.MultiClient/DisplayManager/Filters/Hq2x.cs b/BizHawk.MultiClient/DisplayManager/Filters/Hq2x.cs index 5711f6fa2c..5898e59e99 100644 --- a/BizHawk.MultiClient/DisplayManager/Filters/Hq2x.cs +++ b/BizHawk.MultiClient/DisplayManager/Filters/Hq2x.cs @@ -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_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); + padded.Dispose(); } return ret; }