hedgewars/uLandGraphics.pas
changeset 10023 fa9674c94c4f
parent 9998 736015b847e3
child 10040 4ac87acbaed9
--- 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);