apply to dx9 and dx11 backends as well

This commit is contained in:
Shawn Hoffman
2011-09-05 12:19:11 -07:00
parent 6845a1596c
commit b867c21fea
7 changed files with 20 additions and 88 deletions

View File

@ -444,51 +444,21 @@ bool Renderer::CheckForResize()
return false;
}
bool Renderer::SetScissorRect()
void Renderer::SetScissorRect()
{
TargetRectangle rc;
EFBRectangle rc;
GetScissorRect(rc);
if (rc.left < 0) rc.left = 0;
if (rc.right < 0) rc.right = 0;
if (rc.top < 0) rc.top = 0;
if (rc.bottom < 0) rc.bottom = 0;
if (rc.left > EFB_WIDTH) rc.left = EFB_WIDTH;
if (rc.right > EFB_WIDTH) rc.right = EFB_WIDTH;
if (rc.top > EFB_HEIGHT) rc.top = EFB_HEIGHT;
if (rc.bottom > EFB_HEIGHT) rc.bottom = EFB_HEIGHT;
rc.left = EFBToScaledX(rc.left);
rc.right = EFBToScaledX(rc.right);
rc.top = EFBToScaledY(rc.top);
rc.bottom = EFBToScaledY(rc.bottom);
if (rc.left > rc.right) rc.right = rc.left;
if (rc.top > rc.bottom) rc.bottom = rc.top;
if (rc.left > rc.right)
{
int temp = rc.right;
rc.right = rc.left;
rc.left = temp;
}
if (rc.top > rc.bottom)
{
int temp = rc.bottom;
rc.bottom = rc.top;
rc.top = temp;
}
if (rc.right >= rc.left && rc.bottom >= rc.top)
{
D3D::context->RSSetScissorRects(1, rc.AsRECT());
return true;
}
else
{
//WARN_LOG(VIDEO, "Bad scissor rectangle: %i %i %i %i", rc.left, rc.top, rc.right, rc.bottom);
*rc.AsRECT() = CD3D11_RECT(0.f, 0.f, s_target_width, s_target_height);
D3D::context->RSSetScissorRects(1, rc.AsRECT());
return false;
}
TargetRectangle trc = ConvertEFBRectangle(rc);
D3D::context->RSSetScissorRects(1, trc.AsRECT());
}
void Renderer::SetColorMask()