mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
graphics: Simplify the size of pixels
This commit is contained in:
parent
46cbd0c4a0
commit
fbd07b1865
3
image.go
3
image.go
@ -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}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user