mirror of
https://github.com/golang/go
synced 2024-11-21 21:44:40 -07:00
exp/draw: fix double-counting of pt.Min for the src and mask points.
The min is typically zero, which is why this hasn't bitten us yet. R=r CC=golang-dev https://golang.org/cl/2119048
This commit is contained in:
parent
66f676b8ef
commit
d660d4a6d0
@ -44,14 +44,14 @@ func Draw(dst Image, r image.Rectangle, src image.Image, sp image.Point) {
|
||||
// TODO(nigeltao): Optimize this.
|
||||
func DrawMask(dst Image, r image.Rectangle, src image.Image, sp image.Point, mask image.Image, mp image.Point, op Op) {
|
||||
sb := src.Bounds()
|
||||
dx, dy := sb.Dx()-sp.X, sb.Dy()-sp.Y
|
||||
dx, dy := sb.Max.X-sp.X, sb.Max.Y-sp.Y
|
||||
if mask != nil {
|
||||
mb := mask.Bounds()
|
||||
if dx > mb.Dx()-mp.X {
|
||||
dx = mb.Dx() - mp.X
|
||||
if dx > mb.Max.X-mp.X {
|
||||
dx = mb.Max.X - mp.X
|
||||
}
|
||||
if dy > mb.Dy()-mp.Y {
|
||||
dy = mb.Dy() - mp.Y
|
||||
if dy > mb.Max.Y-mp.Y {
|
||||
dy = mb.Max.Y - mp.Y
|
||||
}
|
||||
}
|
||||
if r.Dx() > dx {
|
||||
|
Loading…
Reference in New Issue
Block a user