Commit d660d4a6 authored by Nigel Tao's avatar Nigel Tao

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
parent 66f676b8
......@@ -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 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment