1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

Fill the black screen borders during scaled presentation

Necessary for cleaning up NVIDIA overlay.
This commit is contained in:
narzoul 2022-05-28 00:51:37 +02:00
parent c3f0f9491a
commit 0b1980bf20
2 changed files with 35 additions and 0 deletions

View File

@ -417,6 +417,37 @@ namespace D3dDdi
return result;
}
void Resource::clearRectExterior(UINT subResourceIndex, const RECT& rect)
{
const LONG width = m_fixedData.pSurfList[subResourceIndex].Width;
const LONG height = m_fixedData.pSurfList[subResourceIndex].Height;
if (rect.left > 0)
{
clearRectInterior(subResourceIndex, { 0, 0, rect.left, height });
}
if (rect.right < width)
{
clearRectInterior(subResourceIndex, { rect.right, 0, width, height });
}
if (rect.top > 0)
{
clearRectInterior(subResourceIndex, { rect.left, 0, rect.right, rect.top });
}
if (rect.bottom < height)
{
clearRectInterior(subResourceIndex, { rect.left, rect.bottom, rect.right, height });
}
}
void Resource::clearRectInterior(UINT subResourceIndex, const RECT& rect)
{
D3DDDIARG_COLORFILL data = {};
data.hResource = m_handle;
data.SubResourceIndex = subResourceIndex;
data.DstRect = rect;
m_device.getOrigVtable().pfnColorFill(m_device, &data);
}
void Resource::clearUpToDateFlags(UINT subResourceIndex)
{
m_lockData[subResourceIndex].isMsaaUpToDate = false;
@ -1110,6 +1141,8 @@ namespace D3dDdi
{
m_device.getShaderBlitter().gammaBlt(*this, data.DstSubResourceIndex, data.DstRect, rtNext, rtNextRect);
}
clearRectExterior(data.DstSubResourceIndex, data.DstRect);
return S_OK;
}

View File

@ -81,6 +81,8 @@ namespace D3dDdi
HRESULT bltLock(D3DDDIARG_LOCK& data);
HRESULT bltViaCpu(D3DDDIARG_BLT data, Resource& srcResource);
HRESULT bltViaGpu(D3DDDIARG_BLT data, Resource& srcResource);
void clearRectExterior(UINT subResourceIndex, const RECT& rect);
void clearRectInterior(UINT subResourceIndex, const RECT& rect);
void clearUpToDateFlags(UINT subResourceIndex);
void clipRect(UINT subResourceIndex, RECT& rect);
HRESULT copySubResource(Resource& dstResource, Resource& srcResource, UINT subResourceIndex);