graphics: Simplify the size of pixels

This commit is contained in:
Hajime Hoshi 2016-05-16 12:23:26 +09:00
parent 46cbd0c4a0
commit fbd07b1865
2 changed files with 1 additions and 3 deletions

View File

@ -214,8 +214,7 @@ func (i *Image) At(x, y int) color.Color {
panic(err)
}
}
w := int(graphics.NextPowerOf2Int32(int32(i.width)))
idx := 4*x + 4*y*w
idx := 4*x + 4*y*i.width
r, g, b, a := i.pixels[idx], i.pixels[idx+1], i.pixels[idx+2], i.pixels[idx+3]
return color.RGBA{r, g, b, a}
}

View File

@ -122,7 +122,6 @@ func (f *Framebuffer) DrawTexture(c *opengl.Context, t *Texture, vertices []int1
func (f *Framebuffer) Pixels(c *opengl.Context) ([]uint8, error) {
w, h := f.Size()
w, h = int(NextPowerOf2Int32(int32(w))), int(NextPowerOf2Int32(int32(h)))
return c.FramebufferPixels(f.native, w, h)
}