瀏覽代碼

Fixed array out of bounds exception in getColor().

Daniel Kauth 11 年之前
父節點
當前提交
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);
         }
     }