Fix rounding up for 26.6 fixed point, not 24.8.

This commit is contained in:
Nigel Tao 2015-08-21 14:00:51 +10:00
parent 071d96ed47
commit 7166253831
1 changed files with 2 additions and 2 deletions

View File

@ -167,8 +167,8 @@ func (c *Context) rasterize(glyph truetype.Index, fx, fy fixed.Int26_6) (
// Calculate the integer-pixel bounds for the glyph.
xmin := int(fx+fixed.Int26_6(c.glyphBuf.B.XMin)) >> 6
ymin := int(fy-fixed.Int26_6(c.glyphBuf.B.YMax)) >> 6
xmax := int(fx+fixed.Int26_6(c.glyphBuf.B.XMax)+0xff) >> 6
ymax := int(fy-fixed.Int26_6(c.glyphBuf.B.YMin)+0xff) >> 6
xmax := int(fx+fixed.Int26_6(c.glyphBuf.B.XMax)+0x3f) >> 6
ymax := int(fy-fixed.Int26_6(c.glyphBuf.B.YMin)+0x3f) >> 6
if xmin > xmax || ymin > ymax {
return 0, nil, image.Point{}, errors.New("freetype: negative sized glyph")
}