Skip to content

Commit

Permalink
Issue #213: fix crash in ResizePngImage(), due to small scaling factor
Browse files Browse the repository at this point in the history
  • Loading branch information
ansgarbecker committed Nov 5, 2018
1 parent 1e92d36 commit 953cce3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/apphelpers.pas
Expand Up @@ -3064,8 +3064,8 @@ procedure ResizePngImage(aPng: TPNGImage; NewWidth, NewHeight: Integer);
else
new_colortype := COLOR_RGB;
bTmp := TPNGImage.CreateBlank(new_colortype, 8, NewWidth, NewHeight);
xscale := bTmp.Width / (aPng.Width-0.35); // Modified: (was -1) substract minimal value before AlphaScanline crashes
yscale := bTmp.Height / (aPng.Height-0.35);
xscale := bTmp.Width / (aPng.Width-1);
yscale := bTmp.Height / (aPng.Height-1);
for to_y:=0 to bTmp.Height-1 do begin
sfrom_y := to_y / yscale;
ifrom_y := Trunc(sfrom_y);
Expand Down

0 comments on commit 953cce3

Please sign in to comment.