diff --git a/axis.go b/axis.go index 451acce0..04590da5 100644 --- a/axis.go +++ b/axis.go @@ -566,17 +566,11 @@ func (DefaultTicks) Ticks(min, max float64) []Tick { } func minInt(a, b int) int { - if a < b { - return a - } - return b + return min(a, b) } func maxInt(a, b int) int { - if a > b { - return a - } - return b + return max(a, b) } // LogTicks is suitable for the Tick.Marker field of an Axis, diff --git a/plotter/image.go b/plotter/image.go index fb4bb8a2..7b0c7650 100644 --- a/plotter/image.go +++ b/plotter/image.go @@ -91,13 +91,13 @@ func (img *Image) transformFor(p *plot.Plot) image.Image { cTrans := int(p.X.Norm(img.x(c)) * float64(img.cols)) // Find the equivalent column of the previous image column after applying // axis transforms. - cPrevTrans := int(p.X.Norm(img.x(maxInt(c-1, 0))) * float64(img.cols)) + cPrevTrans := int(p.X.Norm(img.x(max(c-1, 0))) * float64(img.cols)) for r := range img.rows { // Find the equivalent image row after applying axis transforms. rTrans := int(p.Y.Norm(img.y(r)) * float64(img.rows)) // Find the equivalent row of the previous image row after applying // axis transforms. - rPrevTrans := int(p.Y.Norm(img.y(maxInt(r-1, 0))) * float64(img.rows)) + rPrevTrans := int(p.Y.Norm(img.y(max(r-1, 0))) * float64(img.rows)) crColor := img.img.At(c, img.rows-r-1) // Set all the pixels in the new image between (cPrevTrans, rPrevTrans) // and (cTrans, rTrans) to the color at (c,r) in the original image. @@ -112,13 +112,6 @@ func (img *Image) transformFor(p *plot.Plot) image.Image { return o } -func maxInt(a, b int) int { - if a > b { - return a - } - return b -} - func (img *Image) x(c int) float64 { if c >= img.cols || c < 0 { panic("plotter/image: illegal range") diff --git a/plotter/johnson.go b/plotter/johnson.go index b7c1fd23..52221150 100644 --- a/plotter/johnson.go +++ b/plotter/johnson.go @@ -114,13 +114,6 @@ func (j *johnson) unblock(u int) { } } -func min(a, b int) int { - if a < b { - return a - } - return b -} - // tarjan implements Tarjan's strongly connected component finding // algorithm. The implementation is from the pseudocode at // diff --git a/vg/vgimg/vgimg_test.go b/vg/vgimg/vgimg_test.go index 337346f9..3f9fa3d9 100644 --- a/vg/vgimg/vgimg_test.go +++ b/vg/vgimg/vgimg_test.go @@ -150,13 +150,6 @@ func TestIssue540(t *testing.T) { } func TestIssue687(t *testing.T) { - min := func(a, b int) int { - if a < b { - return a - } - return b - } - const ( fname = "testdata/issue687.png" size = 500