mirror of
https://github.com/DarthAffe/ScreenCapture.NET.git
synced 2025-12-13 05:48:39 +00:00
Small refactorings
This commit is contained in:
parent
dee0c096a6
commit
19080e6ec7
@ -11,8 +11,8 @@ using Vortice.Mathematics;
|
|||||||
using MapFlags = Vortice.Direct3D11.MapFlags;
|
using MapFlags = Vortice.Direct3D11.MapFlags;
|
||||||
using ResultCode = Vortice.DXGI.ResultCode;
|
using ResultCode = Vortice.DXGI.ResultCode;
|
||||||
|
|
||||||
namespace ScreenCapture.NET
|
namespace ScreenCapture.NET;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a ScreenCapture using DirectX 11 desktop duplicaton.
|
/// Represents a ScreenCapture using DirectX 11 desktop duplicaton.
|
||||||
/// https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/desktop-dup-api
|
/// https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/desktop-dup-api
|
||||||
@ -353,12 +353,12 @@ namespace ScreenCapture.NET
|
|||||||
List<CaptureZone> captureZones = _captureZones.Keys.ToList();
|
List<CaptureZone> captureZones = _captureZones.Keys.ToList();
|
||||||
Dispose();
|
Dispose();
|
||||||
|
|
||||||
using IDXGIAdapter1 adapter = _factory.GetAdapter1(Display.GraphicsCard.Index);
|
using IDXGIAdapter1 adapter = _factory.GetAdapter1(Display.GraphicsCard.Index) ?? throw new ApplicationException("Couldn't create DirectX-Adapter.");
|
||||||
|
|
||||||
D3D11.D3D11CreateDevice(adapter, DriverType.Unknown, DeviceCreationFlags.None, FEATURE_LEVELS, out _device).CheckError();
|
D3D11.D3D11CreateDevice(adapter, DriverType.Unknown, DeviceCreationFlags.None, FEATURE_LEVELS, out _device).CheckError();
|
||||||
_context = _device.ImmediateContext;
|
_context = _device!.ImmediateContext;
|
||||||
|
|
||||||
_output = adapter.GetOutput(Display.Index);
|
_output = adapter.GetOutput(Display.Index) ?? throw new ApplicationException("Couldn't get DirectX-Output.");
|
||||||
using IDXGIOutput5 output = _output.QueryInterface<IDXGIOutput5>();
|
using IDXGIOutput5 output = _output.QueryInterface<IDXGIOutput5>();
|
||||||
|
|
||||||
Texture2DDescription captureTextureDesc = new()
|
Texture2DDescription captureTextureDesc = new()
|
||||||
@ -427,4 +427,3 @@ namespace ScreenCapture.NET
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -2,10 +2,10 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Vortice.DXGI;
|
using Vortice.DXGI;
|
||||||
|
|
||||||
namespace ScreenCapture.NET
|
namespace ScreenCapture.NET;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Represents a <see cref="IScreenCaptureService"/> using the <see cref="DX11ScreenCapture"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DX11ScreenCaptureService : IScreenCaptureService
|
public class DX11ScreenCaptureService : IScreenCaptureService
|
||||||
{
|
{
|
||||||
@ -20,11 +20,11 @@ namespace ScreenCapture.NET
|
|||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Initializes a new instance of the <see cref="DX11ScreenCaptureService"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DX11ScreenCaptureService()
|
public DX11ScreenCaptureService()
|
||||||
{
|
{
|
||||||
DXGI.CreateDXGIFactory1(out _factory).CheckError();
|
DXGI.CreateDXGIFactory1(out _factory!).CheckError();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -81,4 +81,3 @@ namespace ScreenCapture.NET
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace ScreenCapture.NET
|
namespace ScreenCapture.NET;
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents the information supplied with an <see cref="E:ScreenCapture.IDX11ScreenCapture.Updated" />-event.
|
/// Represents the information supplied with an <see cref="E:ScreenCapture.IDX11ScreenCapture.Updated" />-event.
|
||||||
@ -32,4 +32,3 @@ namespace ScreenCapture.NET
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace ScreenCapture.NET
|
namespace ScreenCapture.NET;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper-class for DPI-related WIN-API calls.
|
/// Helper-class for DPI-related WIN-API calls.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -39,4 +39,3 @@ namespace ScreenCapture.NET
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void Initalize() => SetProcessDpiAwarenessContext((int)DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
|
public static void Initalize() => SetProcessDpiAwarenessContext((int)DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace ScreenCapture.NET
|
namespace ScreenCapture.NET;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents the duplication of a single display.
|
/// Represents the duplication of a single display.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -60,4 +60,3 @@ namespace ScreenCapture.NET
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
void Restart();
|
void Restart();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace ScreenCapture.NET
|
namespace ScreenCapture.NET;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -28,4 +28,3 @@ namespace ScreenCapture.NET
|
|||||||
/// <returns>The <see cref="IScreenCapture"/> for the give display.</returns>
|
/// <returns>The <see cref="IScreenCapture"/> for the give display.</returns>
|
||||||
IScreenCapture GetScreenCapture(Display display);
|
IScreenCapture GetScreenCapture(Display display);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace ScreenCapture.NET
|
namespace ScreenCapture.NET;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents the configuration for the detection and removal of black bars around the screen image.
|
/// Represents the configuration for the detection and removal of black bars around the screen image.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -139,4 +139,3 @@ namespace ScreenCapture.NET
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace ScreenCapture.NET
|
namespace ScreenCapture.NET;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a duplicated region on the screen.
|
/// Represents a duplicated region on the screen.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -159,4 +159,3 @@ namespace ScreenCapture.NET
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
// ReSharper disable MemberCanBePrivate.Global
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
|
|
||||||
namespace ScreenCapture.NET
|
namespace ScreenCapture.NET;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a display connected to graphics-card.
|
/// Represents a display connected to graphics-card.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -90,4 +90,3 @@ namespace ScreenCapture.NET
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// ReSharper disable MemberCanBePrivate.Global
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
|
|
||||||
namespace ScreenCapture.NET
|
namespace ScreenCapture.NET;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a graphics-card.
|
/// Represents a graphics-card.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -83,4 +83,3 @@ namespace ScreenCapture.NET
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user