freetype: Fix panic when drawing a span to the right of the

bounding rect.

This does for Alpha{Over,Src}Painter what revision 7329234544
did for RGBAPainter.

R=r
CC=golang-dev
http://codereview.appspot.com/2210041
This commit is contained in:
Nigel Tao 2010-09-15 16:05:32 +10:00
parent eda48ef1c3
commit ad78f67dc2

View file

@ -55,6 +55,9 @@ func (r AlphaOverPainter) Paint(ss []Span, done bool) {
if s.X1 > b.Max.X {
s.X1 = b.Max.X
}
if s.X0 >= s.X1 {
continue
}
base := s.Y * r.Image.Stride
p := r.Image.Pix[base+s.X0 : base+s.X1]
a := int(s.A >> 24)
@ -88,6 +91,9 @@ func (r AlphaSrcPainter) Paint(ss []Span, done bool) {
if s.X1 > b.Max.X {
s.X1 = b.Max.X
}
if s.X0 >= s.X1 {
continue
}
base := s.Y * r.Image.Stride
p := r.Image.Pix[base+s.X0 : base+s.X1]
color := image.AlphaColor{uint8(s.A >> 24)}