1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-07 03:13:49 +00:00

Correct VI image cut calculations, see VI fixes #1981

This commit is contained in:
Sergey Lipskiy 2019-01-20 19:32:39 +07:00
parent 864e635ca4
commit 132b06fd2f

View File

@ -1424,11 +1424,11 @@ void FrameBufferList::renderBuffer()
const f32 srcScaleY = pFilteredBuffer->m_scale; const f32 srcScaleY = pFilteredBuffer->m_scale;
CachedTexture * pBufferTexture = pFilteredBuffer->m_pTexture; CachedTexture * pBufferTexture = pFilteredBuffer->m_pTexture;
const s32 cutleft = static_cast<s32>(rdpRes.vi_minhpass * viScaleX); const s32 cutleft = static_cast<s32>(rdpRes.vi_minhpass * viScaleX * srcScaleX);
const s32 cutright = static_cast<s32>(rdpRes.vi_maxhpass * viScaleX); const s32 cutright = static_cast<s32>(rdpRes.vi_maxhpass * viScaleX * srcScaleX);
s32 srcCoord[4] = { (s32)((XoffsetLeft + cutleft) * srcScaleX), s32 srcCoord[4] = { (s32)((XoffsetLeft) * srcScaleX) + cutleft,
(s32)(srcY0*srcScaleY), (s32)(srcY0*srcScaleY),
(s32)((srcWidth + XoffsetLeft - XoffsetRight - cutright) * srcScaleX), (s32)((srcWidth + XoffsetLeft - XoffsetRight) * srcScaleX) - cutright,
min((s32)(srcY1*srcScaleY), (s32)pBufferTexture->realHeight) }; min((s32)(srcY1*srcScaleY), (s32)pBufferTexture->realHeight) };
if (srcCoord[2] > pBufferTexture->realWidth || srcCoord[3] > pBufferTexture->realHeight) { if (srcCoord[2] > pBufferTexture->realWidth || srcCoord[3] > pBufferTexture->realHeight) {
removeBuffer(pBuffer->m_startAddress); removeBuffer(pBuffer->m_startAddress);