Browse Source

Fixed getColor() in ImageData.

Daniel Kauth 11 years ago
parent
commit
4241a55ae4
1 changed files with 6 additions and 2 deletions
  1. 6 2
      bbiwarg/DataSource/ImageData.cs

+ 6 - 2
bbiwarg/DataSource/ImageData.cs

@@ -49,8 +49,12 @@ namespace bbiwarg.DataSource
         {
             float u = uvImage.getU(x, y);
             float v = uvImage.getV(x, y);
-            int xInColorImage = (int) u * colorImage.getWidth();
-            int yInColorImage = (int) v * colorImage.getHeight();
+
+            if (u < 0 || v < 0)
+                return Color.Black;
+
+            int xInColorImage = (int) (u * colorImage.getWidth());
+            int yInColorImage = (int) (v * colorImage.getHeight());
             return colorImage.getColor(xInColorImage, yInColorImage);
         }
     }