Skip clipped groups that are outside the screen

This commit is contained in:
necropotame 2017-01-05 10:20:19 +01:00 committed by oy
parent 4a7db945c0
commit 29731a111a

View file

@ -248,6 +248,9 @@ void CMapLayers::OnRender()
float y0 = (pGroup->m_ClipY - Points[1]) / (Points[3]-Points[1]); float y0 = (pGroup->m_ClipY - Points[1]) / (Points[3]-Points[1]);
float x1 = ((pGroup->m_ClipX+pGroup->m_ClipW) - Points[0]) / (Points[2]-Points[0]); float x1 = ((pGroup->m_ClipX+pGroup->m_ClipW) - Points[0]) / (Points[2]-Points[0]);
float y1 = ((pGroup->m_ClipY+pGroup->m_ClipH) - Points[1]) / (Points[3]-Points[1]); float y1 = ((pGroup->m_ClipY+pGroup->m_ClipH) - Points[1]) / (Points[3]-Points[1]);
if(x1 < 0.0f || x0 > 1.0f || y1 < 0.0f || y0 > 1.0f)
continue;
Graphics()->ClipEnable((int)(x0*Graphics()->ScreenWidth()), (int)(y0*Graphics()->ScreenHeight()), Graphics()->ClipEnable((int)(x0*Graphics()->ScreenWidth()), (int)(y0*Graphics()->ScreenHeight()),
(int)((x1-x0)*Graphics()->ScreenWidth()), (int)((y1-y0)*Graphics()->ScreenHeight())); (int)((x1-x0)*Graphics()->ScreenWidth()), (int)((y1-y0)*Graphics()->ScreenHeight()));