mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
Change receiver ColorM.Element and GeoM.Element to pointers (performance issue)
This commit is contained in:
parent
091cc215fb
commit
449bc7931d
@ -44,12 +44,12 @@ type ColorM struct {
|
||||
es [ColorMDim - 1][ColorMDim]float64
|
||||
}
|
||||
|
||||
func (c ColorM) dim() int {
|
||||
func (c *ColorM) dim() int {
|
||||
return ColorMDim
|
||||
}
|
||||
|
||||
// Element returns a value of a matrix at (i, j).
|
||||
func (c ColorM) Element(i, j int) float64 {
|
||||
func (c *ColorM) Element(i, j int) float64 {
|
||||
if !c.initialized {
|
||||
if i == j {
|
||||
return 1
|
||||
|
4
geom.go
4
geom.go
@ -37,12 +37,12 @@ type GeoM struct {
|
||||
es [GeoMDim - 1][GeoMDim]float64
|
||||
}
|
||||
|
||||
func (g GeoM) dim() int {
|
||||
func (g *GeoM) dim() int {
|
||||
return GeoMDim
|
||||
}
|
||||
|
||||
// Element returns a value of a matrix at (i, j).
|
||||
func (g GeoM) Element(i, j int) float64 {
|
||||
func (g *GeoM) Element(i, j int) float64 {
|
||||
if !g.initialized {
|
||||
if i == j {
|
||||
return 1
|
||||
|
2
image.go
2
image.go
@ -67,7 +67,7 @@ func (i *innerImage) drawImage(c *opengl.Context, img *innerImage, options *Draw
|
||||
clr := options.ColorM
|
||||
w, h := img.size()
|
||||
quads := &textureQuads{parts, w, h}
|
||||
return i.framebuffer.DrawTexture(c, img.texture, quads, geo, clr)
|
||||
return i.framebuffer.DrawTexture(c, img.texture, quads, &geo, &clr)
|
||||
}
|
||||
|
||||
func u(x float64, width int) float32 {
|
||||
|
Loading…
Reference in New Issue
Block a user