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:
parent
eda48ef1c3
commit
ad78f67dc2
1 changed files with 6 additions and 0 deletions
|
@ -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)}
|
||||
|
|
Loading…
Reference in a new issue