hedgewars/uRenderUtils.pas
changeset 12101 2e70ef81e281
parent 12099 c1d83fc8e894
child 12102 51596d30a724
equal deleted inserted replaced
12100:166725555e57 12101:2e70ef81e281
   162     // what's the offset between src and dest coords?
   162     // what's the offset between src and dest coords?
   163     dX:= destX - srcX;
   163     dX:= destX - srcX;
   164     dY:= destY - srcY;
   164     dY:= destY - srcY;
   165 
   165 
   166     // let's figure out where the rectangle we can actually copy ends
   166     // let's figure out where the rectangle we can actually copy ends
   167     lX:= ( min( min(srcX + srcW, src^.w), min(destX + srcW, dest^.w) - dx ) ) - 1;
   167     lX:= min(srcX + srcW, src^.w) - 1;
   168     lY:= ( min( min(srcY + srcH, src^.h), min(destY + srcH, dest^.h) - dY ) ) - 1;
   168     if lX + dx >= dest^.w then lX:= dest^.w - dx - 1;
       
   169     lY:= min(srcY + srcH, src^.h) - 1;
       
   170     if lY + dy >= dest^.h then lY:= dest^.h - dy - 1;
   169 
   171 
   170     for iX:= srcX to lX do
   172     for iX:= srcX to lX do
   171     for iY:= srcY to lY do
   173     for iY:= srcY to lY do
   172         begin
   174         begin
   173         // src pixel index
   175         // src pixel index