Revert lines' vetices (float64 -> int)

This commit is contained in:
Hajime Hoshi 2015-01-17 23:33:57 +09:00
parent f0d40b4e1f
commit 26358f3e63
4 changed files with 9 additions and 10 deletions

View File

@ -96,7 +96,7 @@ func (i *Image) DrawImage(image *Image, options *DrawImageOptions) (err error) {
} }
// DrawLine draws a line. // 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}) return i.DrawLines(&line{x0, y0, x1, y1, clr})
} }

View File

@ -116,7 +116,7 @@ func (f *Framebuffer) DrawTexture(c *opengl.Context, t *Texture, quads TextureQu
type Lines interface { type Lines interface {
Len() int Len() int
Points(i int) (x0, y0, x1, y1 float64) Points(i int) (x0, y0, x1, y1 int)
Color(i int) color.Color Color(i int) color.Color
} }

View File

@ -91,7 +91,7 @@ func DrawTexture(c *opengl.Context, texture opengl.Texture, projectionMatrix *[4
type Lines interface { type Lines interface {
Len() int Len() int
Points(i int) (x0, y0, x1, y1 float64) Points(i int) (x0, y0, x1, y1 int)
Color(i int) color.Color Color(i int) color.Color
} }

View File

@ -21,13 +21,13 @@ import (
// A Lines represents the set of lines. // A Lines represents the set of lines.
type Lines interface { type Lines interface {
Len() int Len() int
Points(i int) (x0, y0, x1, y1 float64) Points(i int) (x0, y0, x1, y1 int)
Color(i int) color.Color Color(i int) color.Color
} }
type line struct { type line struct {
x0, y0 float64 x0, y0 int
x1, y1 float64 x1, y1 int
color color.Color color color.Color
} }
@ -35,7 +35,7 @@ func (l *line) Len() int {
return 1 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 return l.x0, l.y0, l.x1, l.y1
} }
@ -51,9 +51,8 @@ func (r *rectsAsLines) Len() int {
return r.Rects.Len() * 4 return r.Rects.Len() * 4
} }
func (r *rectsAsLines) Points(i int) (x0, y0, x1, y1 float64) { func (r *rectsAsLines) Points(i int) (x0, y0, x1, y1 int) {
ix, iy, iw, ih := r.Rects.Rect(i / 4) x, y, w, h := r.Rects.Rect(i / 4)
x, y, w, h := float64(ix), float64(iy), float64(iw), float64(ih)
switch i % 4 { switch i % 4 {
case 0: case 0:
return x, y, x + w, y return x, y, x + w, y