summaryrefslogtreecommitdiffstats
path: root/src/glut/fbdev/cursor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glut/fbdev/cursor.c')
-rw-r--r--src/glut/fbdev/cursor.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/glut/fbdev/cursor.c b/src/glut/fbdev/cursor.c
index b753a5c9ff5..06ae2d6f54e 100644
--- a/src/glut/fbdev/cursor.c
+++ b/src/glut/fbdev/cursor.c
@@ -44,7 +44,7 @@ static unsigned char *MouseBuffer;
void InitializeCursor(void)
{
- if((MouseBuffer = malloc(CURSOR_WIDTH * CURSOR_HEIGHT
+ if(!MouseBuffer && (MouseBuffer = malloc(CURSOR_WIDTH * CURSOR_HEIGHT
* VarInfo.bits_per_pixel / 8)) == NULL) {
sprintf(exiterror, "malloc failure\n");
exit(0);
@@ -216,10 +216,10 @@ void SwapCursor(void)
if(miny < 0)
miny = 0;
- if(minx + sizex > VarInfo.xres)
- sizex = VarInfo.xres - minx;
- if(miny + sizey > VarInfo.yres)
- sizey = VarInfo.yres - miny;
+ if(minx + sizex > VarInfo.xres - CURSOR_WIDTH)
+ sizex = VarInfo.xres - CURSOR_WIDTH - minx;
+ if(miny + sizey > VarInfo.yres - CURSOR_HEIGHT)
+ sizey = VarInfo.yres - CURSOR_HEIGHT - miny;
off = FixedInfo.line_length * miny
+ minx * VarInfo.bits_per_pixel / 8;
stride = (sizex + CURSOR_WIDTH) * VarInfo.bits_per_pixel / 8;