You can no longer access out-of-range pixels in ImageData

This commit is contained in:
Bill Meltsner
2010-10-19 17:15:27 -04:00
parent a34640bcfd
commit 9a76ac7bea
+2
View File
@@ -156,6 +156,7 @@ namespace devil
{
//int tx = x > width-1 ? width-1 : x;
//int ty = y > height-1 ? height-1 : y; // not using these seems to not break anything
if (x > width-1 || y > height-1 || x < 0 || y < 0) throw love::Exception("Attempt to set out-of-range pixel!");
pixel * pixels = (pixel *)getData();
pixels[y*width+x] = c;
}
@@ -164,6 +165,7 @@ namespace devil
{
//int tx = x > width-1 ? width-1 : x;
//int ty = y > height-1 ? height-1 : y; // not using these seems to not break anything
if (x > width-1 || y > height-1 || x < 0 || y < 0) throw love::Exception("Attempt to get out-of-range pixel!");
pixel * pixels = (pixel *)getData();
return pixels[y*width+x];
}