Store ID2D1EffectContext in the ID2D1Effect object

このコミットが含まれているのは:
Sergio Pedri committed 2022-08-15 15:01:16 +02:00
1 親 47cafd0145
コミット b2b445d3a8
2ファイル変更
+29 -1

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

@@ -128,11 +128,27 @@ internal unsafe partial struct PixelShaderEffect
}
}
// If loading the bytecode succeeded, set the transform node
if (Windows.SUCCEEDED(hresult))
{
hresult = transformGraph->SetSingleTransformNode((ID2D1TransformNode*)&@this->lpVtblForID2D1DrawTransform);
}
// If the transform node was set, also store the effect context
if (Windows.SUCCEEDED(hresult))
{
// Free the previous ID2D1EffectContext object, if present
if (@this->d2D1EffectContext is not null)
{
_ = @this->d2D1EffectContext->Release();
}
// Store the new ID2D1EffectContext object
_ = effectContext->AddRef();
@this->d2D1EffectContext = effectContext;
}
return hresult;
}
+13 -1
ファイルの表示
@@ -191,6 +191,11 @@ internal unsafe partial struct PixelShaderEffect
/// </summary>
private ID2D1DrawInfo* d2D1DrawInfo;
/// <summary>
/// The <see cref="ID2D1EffectContext"/> instance currently in use.
/// </summary>
private ID2D1EffectContext* d2D1EffectContext;
/// <summary>
/// The factory method for <see cref="ID2D1Factory1.RegisterEffectFromString"/>.
/// </summary>
@@ -250,8 +255,10 @@ internal unsafe partial struct PixelShaderEffect
@this->bufferPrecision = bufferPrecision;
@this->channelDepth = channelDepth;
@this->d2D1TransformMapperHandle = GCHandle.Alloc(d2D1TransformMapper);
@this->d2D1DrawInfo = null;
@this->d2D1EffectContext = null;
*effectImpl = (IUnknown*)@this;
* effectImpl = (IUnknown*)@this;
return S.S_OK;
}
@@ -317,6 +324,11 @@ internal unsafe partial struct PixelShaderEffect
_ = this.d2D1DrawInfo->Release();
}
if (this.d2D1EffectContext is not null)
{
_ = this.d2D1EffectContext->Release();
}
NativeMemory.Free(Unsafe.AsPointer(ref this));
}