mirror of
https://github.com/love2d/love.git
synced 2026-08-13 17:10:54 +02:00
You can no longer access out-of-range pixels in ImageData
This commit is contained in:
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user