Commits

Russ Cox  committed c5bd722

fontsrv: work around a few crashes

Probably not the right fix, but gets us going.

R=rsc
http://codereview.appspot.com/6782113

  • Participants
  • Parent commits bc4d5e9

Comments (0)

Files changed (1)

File src/cmd/fontsrv/osx.c

 	x = (int)(bbox.size.width * size / unit + 0.99999999);
 	y = bbox.size.height * size/unit + 0.99999999;
 	y0 = (int)(-bbox.origin.y * size/unit + 0.99999999);
-	m = allocmemimage(Rect(0, 0, x*(hi+1-lo), y), GREY8);
+	m = allocmemimage(Rect(0, 0, x*(hi+1-lo)+1, y+1), GREY8);
 	if(m == nil)
 		return nil;
-	mc = allocmemimage(Rect(0, 0, x, y), GREY8);
+	mc = allocmemimage(Rect(0, 0, x+1, y+1), GREY8);
 	if(mc == nil)
 		return nil;
 	memfillcolor(m, DBlack);
 	// round up to 32-bit boundary
 	// so that in-memory data is same
 	// layout as in-file data.
+	if(x == 0)
+		x = 1;
+	if(y == 0)
+		y = 1;
 	if(antialias)
 		x += -x & 3;
 	else