MAPALGO_Scale: Fix scaling coordinates for common case of blitting scaled surfaces from one surface to another.

liquid_container
Sven Eberhardt 2016-02-06 16:10:14 -05:00
parent 4b4b8781a0
commit 44121a00eb
2 changed files with 4 additions and 4 deletions

View File

@ -260,11 +260,11 @@ Blit({Algo=MAPALGO_Scale, OffX=Wdt/2, X=-100, Op=copy_layer});
</row><row>
<col>OffX</col>
<col>0</col>
<col>X position of fixed point that remains in position.</col>
<col>X position of fixed point that remains in position. Actual fixed point is translated left by -0.5 pixels to achieve proper pixel mapping.</col>
</row><row>
<col>OffY</col>
<col>0</col>
<col>Y position of fixed point that remains in position.</col>
<col>Y position of fixed point that remains in position. Actual fixed point is translated up by -0.5 pixels to achieve proper pixel mapping.</col>
</row>
</table></text></part>
<h>MAPALGO_Rotate</h><part>

View File

@ -343,8 +343,8 @@ bool C4MapScriptAlgoScale::operator () (int32_t x, int32_t y, uint8_t& fg, uint8
{
// Evaluate MAPALGO_Scale at x,y:
assert(operands.size()==1);
// Return base layer scaled by sx,sy percent from fixed point cx,cy
return (*operands[0])((x-cx)*100/sx+cx,(y-cy)*100/sy+cy, fg, bg);
// Return base layer scaled by sx,sy percent from fixed point cx-.5,cy-.5
return (*operands[0])((((x-cx)*2+1)*50-sx/2)/sx+cx,(((y-cy)*2+1)*50-sy/2)/sy+cy, fg, bg);
}
C4MapScriptAlgoRotate::C4MapScriptAlgoRotate(const C4PropList *props) : C4MapScriptAlgoModifier(props,1,1)