Просмотр исходного кода

Fixed array out of bounds exception in getColor().

Daniel Kauth 11 лет назад
Родитель
Сommit
b313a7decf
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      bbiwarg/DataSource/ImageData.cs

+ 2 - 2
bbiwarg/DataSource/ImageData.cs

@@ -53,8 +53,8 @@ namespace bbiwarg.DataSource
             if (u < 0 || v < 0)
                 return Color.Black;
 
-            int xInColorImage = (int) (u * colorImage.getWidth());
-            int yInColorImage = (int) (v * colorImage.getHeight());
+            int xInColorImage = (int) (u * colorImage.getWidth()) % colorImage.getWidth();
+            int yInColorImage = (int) (v * colorImage.getHeight()) % colorImage.getHeight();
             return colorImage.getColor(xInColorImage, yInColorImage);
         }
     }