1 | diff --git a/engines/ags/lib/allegro/gfx.cpp b/engines/ags/lib/allegro/gfx.cpp
|
---|
2 | index 3a4aa08e59e..9ea88d6ec2a 100644
|
---|
3 | --- a/engines/ags/lib/allegro/gfx.cpp
|
---|
4 | +++ b/engines/ags/lib/allegro/gfx.cpp
|
---|
5 | @@ -234,7 +234,7 @@ void memory_putpixel(BITMAP *bmp, int x, int y, int color) {
|
---|
6 |
|
---|
7 | void putpixel(BITMAP *bmp, int x, int y, int color) {
|
---|
8 | Graphics::ManagedSurface &surf = **bmp;
|
---|
9 | - if (x >= surf.w || y >= surf.h)
|
---|
10 | + if (x < 0 || x >= surf.w || y < 0 || y >= surf.h)
|
---|
11 | return;
|
---|
12 | void *p = surf.getBasePtr(x, y);
|
---|
13 |
|
---|
14 | @@ -255,6 +255,8 @@ void putpixel(BITMAP *bmp, int x, int y, int color) {
|
---|
15 |
|
---|
16 | void _putpixel(BITMAP *bmp, int x, int y, int color) {
|
---|
17 | Graphics::ManagedSurface &surf = **bmp;
|
---|
18 | + if (x < 0 || x >= surf.w || y < 0 || y >= surf.h)
|
---|
19 | + return;
|
---|
20 | void *p = surf.getBasePtr(x, y);
|
---|
21 | *((uint8 *)p) = color;
|
---|
22 | }
|
---|
23 | @@ -265,6 +267,8 @@ void _putpixel15(BITMAP *bmp, int x, int y, int color) {
|
---|
24 |
|
---|
25 | void _putpixel16(BITMAP *bmp, int x, int y, int color) {
|
---|
26 | Graphics::ManagedSurface &surf = **bmp;
|
---|
27 | + if (x < 0 || x >= surf.w || y < 0 || y >= surf.h)
|
---|
28 | + return;
|
---|
29 | void *p = surf.getBasePtr(x, y);
|
---|
30 | *((uint16 *)p) = color;
|
---|
31 | }
|
---|
32 | @@ -275,6 +279,8 @@ void _putpixel24(BITMAP *bmp, int x, int y, int color) {
|
---|
33 |
|
---|
34 | void _putpixel32(BITMAP *bmp, int x, int y, int color) {
|
---|
35 | Graphics::ManagedSurface &surf = **bmp;
|
---|
36 | + if (x < 0 || x >= surf.w || y < 0 || y >= surf.h)
|
---|
37 | + return;
|
---|
38 | void *p = surf.getBasePtr(x, y);
|
---|
39 | *((uint32 *)p) = color;
|
---|
40 | }
|
---|