From 26358f3e633b1e81c6f0dbb7c1f63e121702a607 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 17 Jan 2015 23:33:57 +0900 Subject: [PATCH] Revert lines' vetices (float64 -> int) --- image.go | 2 +- internal/graphics/framebuffer.go | 2 +- internal/graphics/internal/shader/draw.go | 2 +- shapes.go | 13 ++++++------- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/image.go b/image.go index df6c5d693..9e8eb9bf5 100644 --- a/image.go +++ b/image.go @@ -96,7 +96,7 @@ func (i *Image) DrawImage(image *Image, options *DrawImageOptions) (err error) { } // DrawLine draws a line. -func (i *Image) DrawLine(x0, y0, x1, y1 float64, clr color.Color) error { +func (i *Image) DrawLine(x0, y0, x1, y1 int, clr color.Color) error { return i.DrawLines(&line{x0, y0, x1, y1, clr}) } diff --git a/internal/graphics/framebuffer.go b/internal/graphics/framebuffer.go index 1872aa1b4..b61da912b 100644 --- a/internal/graphics/framebuffer.go +++ b/internal/graphics/framebuffer.go @@ -116,7 +116,7 @@ func (f *Framebuffer) DrawTexture(c *opengl.Context, t *Texture, quads TextureQu type Lines interface { Len() int - Points(i int) (x0, y0, x1, y1 float64) + Points(i int) (x0, y0, x1, y1 int) Color(i int) color.Color } diff --git a/internal/graphics/internal/shader/draw.go b/internal/graphics/internal/shader/draw.go index 27a37fda2..bf2e2c984 100644 --- a/internal/graphics/internal/shader/draw.go +++ b/internal/graphics/internal/shader/draw.go @@ -91,7 +91,7 @@ func DrawTexture(c *opengl.Context, texture opengl.Texture, projectionMatrix *[4 type Lines interface { Len() int - Points(i int) (x0, y0, x1, y1 float64) + Points(i int) (x0, y0, x1, y1 int) Color(i int) color.Color } diff --git a/shapes.go b/shapes.go index fa4e34009..162338fff 100644 --- a/shapes.go +++ b/shapes.go @@ -21,13 +21,13 @@ import ( // A Lines represents the set of lines. type Lines interface { Len() int - Points(i int) (x0, y0, x1, y1 float64) + Points(i int) (x0, y0, x1, y1 int) Color(i int) color.Color } type line struct { - x0, y0 float64 - x1, y1 float64 + x0, y0 int + x1, y1 int color color.Color } @@ -35,7 +35,7 @@ func (l *line) Len() int { return 1 } -func (l *line) Points(i int) (x0, y0, x1, y1 float64) { +func (l *line) Points(i int) (x0, y0, x1, y1 int) { return l.x0, l.y0, l.x1, l.y1 } @@ -51,9 +51,8 @@ func (r *rectsAsLines) Len() int { return r.Rects.Len() * 4 } -func (r *rectsAsLines) Points(i int) (x0, y0, x1, y1 float64) { - ix, iy, iw, ih := r.Rects.Rect(i / 4) - x, y, w, h := float64(ix), float64(iy), float64(iw), float64(ih) +func (r *rectsAsLines) Points(i int) (x0, y0, x1, y1 int) { + x, y, w, h := r.Rects.Rect(i / 4) switch i % 4 { case 0: return x, y, x + w, y