# HG changeset patch # User sheepluva # Date 1390167546 -3600 # Node ID fa9674c94c4f25f079c70f157f4e33a1060552ad # Parent eb981a03de903b668d6c4f097e803fac87e93a59 fix despeckle mutilating blurry land diff -r eb981a03de90 -r fa9674c94c4f hedgewars/uLandGraphics.pas --- a/hedgewars/uLandGraphics.pas Mon Jan 20 00:25:40 2014 +0400 +++ b/hedgewars/uLandGraphics.pas Sun Jan 19 22:39:06 2014 +0100 @@ -679,6 +679,7 @@ function Despeckle(X, Y: LongInt): boolean; var nx, ny, i, j, c, xx, yy: LongInt; pixelsweep: boolean; + begin Despeckle:= true; @@ -709,11 +710,14 @@ begin if ((cReducedQuality and rqBlurryLand) <> 0) then begin - nx:= nx div 2; - ny:= ny div 2 - end; - if LandPixels[ny, nx] <> 0 then - inc(c); + ny:= Y div 2 + i; + nx:= X div 2 + j; + if ((ny and (LAND_HEIGHT_MASK div 2)) = 0) and ((nx and (LAND_WIDTH_MASK div 2)) = 0) then + if LandPixels[ny, nx] <> 0 then + inc(c); + end + else if LandPixels[ny, nx] <> 0 then + inc(c); end else if Land[ny, nx] > 255 then inc(c);