mirror of
https://github.com/golang/go
synced 2024-11-20 04:14:49 -07:00
Fix Rectangle.Canon()
R=rsc, r, gri CC=golang-dev https://golang.org/cl/1239043
This commit is contained in:
parent
efda3aba10
commit
798140693e
@ -59,10 +59,10 @@ func (r Rectangle) Sub(p Point) Rectangle { return Rectangle{r.Min.Sub(p), r.Max
|
||||
// has Min.X <= Max.X and Min.Y <= Max.Y.
|
||||
func (r Rectangle) Canon() Rectangle {
|
||||
if r.Max.X < r.Min.X {
|
||||
r.Max.X = r.Min.X
|
||||
r.Min.X, r.Max.X = r.Max.X, r.Min.X
|
||||
}
|
||||
if r.Max.Y < r.Min.Y {
|
||||
r.Max.Y = r.Min.Y
|
||||
r.Min.Y, r.Max.Y = r.Max.Y, r.Min.Y
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user