adding missing check to an optimization so it can be re-enabled

This commit is contained in:
nitsuja 2009-09-25 15:48:17 +00:00
parent ce279995de
commit ecbdbf21df
1 changed files with 23 additions and 26 deletions

View File

@ -1103,32 +1103,29 @@ FORCEINLINE void rot_scale_op(GPU * gpu, s32 X, s32 Y, s16 PA, s16 PB, s16 PC, s
const s32 dx = (s32)PA;
const s32 dy = (s32)PC;
//not safe for 128 wide nonwrapping BG
//and probably not safe for other size nonwrapping BG which are scrolled near their edge
//// as an optimization, specially handle the fairly common case of
//// "unrotated + unscaled + no boundary checking required"
//if(dx==0x100 && dy==0)
//{
// s32 auxX = x.bits.Integer;
// if(WRAP || auxX + LG < wh)
// {
// s32 auxY = y.bits.Integer;
// if(WRAP)
// {
// auxY = auxY & (ht-1);
// auxX = auxX & (wh-1);
// }
// for(int i = 0; i < LG; ++i)
// {
// fun(gpu, auxX, auxY, wh, map, tile, pal, i);
// auxX++;
// if(WRAP)
// auxX = auxX & (wh-1);
// }
// return;
// }
//}
// as an optimization, specially handle the fairly common case of
// "unrotated + unscaled + no boundary checking required"
if(dx==0x100 && dy==0)
{
s32 auxX = x.bits.Integer;
s32 auxY = y.bits.Integer;
if(WRAP || (auxX + LG < wh && auxX >= 0 && auxY < ht && auxY >= 0))
{
if(WRAP)
{
auxY = auxY & (ht-1);
auxX = auxX & (wh-1);
}
for(int i = 0; i < LG; ++i)
{
fun(gpu, auxX, auxY, wh, map, tile, pal, i);
auxX++;
if(WRAP)
auxX = auxX & (wh-1);
}
return;
}
}
for(int i = 0; i < LG; ++i)
{