mirror of
https://github.com/DarthAffe/ScreenCapture.NET.git
synced 2025-12-13 05:48:39 +00:00
Changed default duplication to old dxgi1_2 headers to prevent problems with capturing in WPF-threads and remove the need to set the dpiawareness
This commit is contained in:
parent
9be201ce95
commit
aa1069310e
@ -38,6 +38,7 @@ namespace ScreenCapture.NET
|
|||||||
|
|
||||||
private readonly object _captureLock = new();
|
private readonly object _captureLock = new();
|
||||||
|
|
||||||
|
private readonly bool _useNewDuplicationAdapter;
|
||||||
private int _indexCounter = 0;
|
private int _indexCounter = 0;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -74,12 +75,17 @@ namespace ScreenCapture.NET
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="DX11ScreenCapture"/> class.
|
/// Initializes a new instance of the <see cref="DX11ScreenCapture"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Note that setting useNewDuplicationAdapter to true requires to call <c>DPIAwareness.Initalize();</c> and prevents the capture from running in a WPF-thread.
|
||||||
|
/// </remarks>
|
||||||
/// <param name="factory">The <see cref="IDXGIFactory1"/> used to create underlying objects.</param>
|
/// <param name="factory">The <see cref="IDXGIFactory1"/> used to create underlying objects.</param>
|
||||||
/// <param name="display">The <see cref="Display"/> to duplicate.</param>
|
/// <param name="display">The <see cref="Display"/> to duplicate.</param>
|
||||||
public DX11ScreenCapture(IDXGIFactory1 factory, Display display)
|
/// <param name="useNewDuplicationAdapter">Indicates if the DuplicateOutput1 interface should be used instead of the older DuplicateOutput. Currently there's no real use in setting this to true.</param>
|
||||||
|
public DX11ScreenCapture(IDXGIFactory1 factory, Display display, bool useNewDuplicationAdapter = false)
|
||||||
{
|
{
|
||||||
this._factory = factory;
|
this._factory = factory;
|
||||||
this.Display = display;
|
this.Display = display;
|
||||||
|
this._useNewDuplicationAdapter = useNewDuplicationAdapter;
|
||||||
|
|
||||||
Restart();
|
Restart();
|
||||||
}
|
}
|
||||||
@ -326,7 +332,10 @@ namespace ScreenCapture.NET
|
|||||||
InitializeCaptureZone(captureZone);
|
InitializeCaptureZone(captureZone);
|
||||||
}
|
}
|
||||||
|
|
||||||
_duplicatedOutput = output.DuplicateOutput1(_device, Format.B8G8R8A8_UNorm); // DarthAffe 27.02.2021: This prepares for the use of 10bit color depth
|
if (_useNewDuplicationAdapter)
|
||||||
|
_duplicatedOutput = output.DuplicateOutput1(_device, Format.B8G8R8A8_UNorm); // DarthAffe 27.02.2021: This prepares for the use of 10bit color depth
|
||||||
|
else
|
||||||
|
_duplicatedOutput = output.DuplicateOutput(_device);
|
||||||
}
|
}
|
||||||
catch { Dispose(false); }
|
catch { Dispose(false); }
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user