Commit 79814069 authored by Roger Peppe's avatar Roger Peppe Committed by Robert Griesemer

Fix Rectangle.Canon()

R=rsc, r, gri
CC=golang-dev
https://golang.org/cl/1239043
parent efda3aba
...@@ -59,10 +59,10 @@ func (r Rectangle) Sub(p Point) Rectangle { return Rectangle{r.Min.Sub(p), r.Max ...@@ -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. // has Min.X <= Max.X and Min.Y <= Max.Y.
func (r Rectangle) Canon() Rectangle { func (r Rectangle) Canon() Rectangle {
if r.Max.X < r.Min.X { 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 { 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 return r
} }
......
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