Transcription bug in SetDpiCompensatedEffectInput
rickbrew opened this issue · comments
Rick Brewster commented
The check for inputBitmap != null
should be inputBitmap == null
. Otherwise this method does nothing when given a bitmap, or will AV when given null
when it calls inputBitmap->GetDpi(...)
:
public unsafe static HRESULT SetDpiCompensatedEffectInput(ID2D1DeviceContext* deviceContext, ID2D1Effect* effect, uint inputIndex, ID2D1Bitmap* inputBitmap, D2D1_INTERPOLATION_MODE interpolationMode = D2D1_INTERPOLATION_MODE.D2D1_INTERPOLATION_MODE_LINEAR, D2D1_BORDER_MODE borderMode = D2D1_BORDER_MODE.D2D1_BORDER_MODE_HARD)
{
HRESULT hr = 0;
ID2D1Effect* dpiCompensationEffect = null;
if (inputBitmap != null)
{
effect->SetInput(inputIndex, null, 1);
return hr;
}
...
}
Rick Brewster commented
I think @Sergio0694 has been writing code for ComputeSharp.D2D1 / Win2D that makes use of this.