@@ -861,64 +861,53 @@ end.
861861*)
862862function TRSMinimap.CleanImage(img: TImage; radius: Integer): TImage;
863863
864- function _DotTPA(pt: TPoint): TPointArray;
864+ function _DotTPA(pt: TPoint; bounds: TBox ): TPointArray;
865865 var
866866 q: TPoint;
867867 begin
868- q := pt.Offset(0,-1);
869- if img.InImage(q.X, q.Y) then
870- Result += q;
868+ if bounds.Contains(pt) then
869+ Exit([
870+ pt.Offset(0,-1), pt.Offset(1,-1),
871+ pt.Offset(-1,0), pt, pt.Offset(1,0), pt.Offset(2,0),
872+ pt.Offset(-1,1), pt.Offset(0,1), pt.Offset(1,1), pt.Offset(2,1),
873+ pt.Offset(0,2), pt.Offset(1,2)
874+ ]);
871875
876+ q := pt.Offset(0,-1);
877+ if bounds.Contains(q) then Result += q;
872878 q := pt.Offset(1,-1);
873- if img.InImage(q.X, q.Y) then
874- Result += q;
875-
879+ if bounds.Contains(q) then Result += q;
876880 q := pt.Offset(-1,0);
877- if img.InImage(q.X, q.Y) then
878- Result += q;
881+ if bounds.Contains(q) then Result += q;
879882
880- if img.InImage(pt.X, pt.Y) then
881- Result += pt;
883+ Result += pt;
882884
883885 q := pt.Offset(1,0);
884- if img.InImage(q.X, q.Y) then
885- Result += q;
886-
886+ if bounds.Contains(q) then Result += q;
887887 q := pt.Offset(2,0);
888- if img.InImage(q.X, q.Y) then
889- Result += q;
890-
888+ if bounds.Contains(q) then Result += q;
891889 q := pt.Offset(-1,1);
892- if img.InImage(q.X, q.Y) then
893- Result += q;
894-
890+ if bounds.Contains(q) then Result += q;
895891 q := pt.Offset(0,1);
896- if img.InImage(q.X, q.Y) then
897- Result += q;
898-
892+ if bounds.Contains(q) then Result += q;
899893 q := pt.Offset(1,1);
900- if img.InImage(q.X, q.Y) then
901- Result += q;
902-
894+ if bounds.Contains(q) then Result += q;
903895 q := pt.Offset(2,1);
904- if img.InImage(q.X, q.Y) then
905- Result += q;
906-
896+ if bounds.Contains(q) then Result += q;
907897 q := pt.Offset(0,2);
908- if img.InImage(q.X, q.Y) then
909- Result += q;
910-
898+ if bounds.Contains(q) then Result += q;
911899 q := pt.Offset(1,2);
912- if img.InImage(q.X, q.Y) then
913- Result += q;
914- end;
900+ if bounds.Contains(q) then Result += q;
901+ end;
915902
916903var
917904 tpa: TPointArray;
918905 pt: TPoint;
906+ bounds: TBox;
919907begin
908+ bounds := [1,1,img.Width-2, img.Height-2];
920909 for pt in Self._GetDots(img) do
921- tpa += _DotTPA(pt);
910+ tpa += _DotTPA(pt, bounds );
922911
923912 with img.Center do
924913 begin
0 commit comments