Rent device context to create DPI compensaton effect

このコミットが含まれているのは:
Sergio Pedri committed 2023-02-24 00:56:26 +01:00
1 親 303246fffd
コミット 00d171cdb0
6ファイル変更
+17 -36

検索条件に一致するファイルはありません

+6 -1
ファイルの表示
@@ -299,13 +299,18 @@ unsafe partial class PixelShaderEffect<T>
// Create an ID2D1Effect for the DPI compensation, if there isn't one already
if (!sourceReference.HasDpiCompensationEffect)
{
using ComPtr<ID2D1DeviceContextLease> d2D1DeviceContextLease = default;
using ComPtr<ID2D1DeviceContext> d2D1DeviceContextEffective = default;
// We need to create a DPI compensation effect, so a device context must be available.
// If there is no input device context, just create a new one from the realization device.
if (d2D1DeviceContext is null)
{
this.canvasDevice.Get()->CreateD2DDeviceContext(d2D1DeviceContextEffective.GetAddressOf()).Assert();
// Get the ID2D1DeviceContextLease interface from the input device
this.canvasDevice.Get()->GetD2DDeviceContextLease(d2D1DeviceContextLease.GetAddressOf()).Assert();
// Rent a new device context from the lease (this is much faster than creating a new device context)
d2D1DeviceContextLease.Get()->GetD2DDeviceContext(d2D1DeviceContextEffective.GetAddressOf()).Assert();
}
else
{