Change receiver ColorM.Element and GeoM.Element to pointers (performance issue)

This commit is contained in:
Hajime Hoshi 2015-01-03 01:54:12 +09:00
parent 091cc215fb
commit 449bc7931d
3 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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 {