mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
Bug fix: Scale and Translate
This commit is contained in:
parent
ab2b884c49
commit
c53695eb56
10
colorm.go
10
colorm.go
@ -83,10 +83,12 @@ func (c *ColorM) Scale(r, g, b, a float64) {
|
|||||||
if !c.initialized {
|
if !c.initialized {
|
||||||
*c = colorMI
|
*c = colorMI
|
||||||
}
|
}
|
||||||
c.es[0][0] *= r
|
for i := 0; i < ColorMDim; i++ {
|
||||||
c.es[1][1] *= g
|
c.es[0][i] *= r
|
||||||
c.es[2][2] *= b
|
c.es[1][i] *= g
|
||||||
c.es[3][3] *= a
|
c.es[2][i] *= b
|
||||||
|
c.es[3][i] *= a
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ColorM) Translate(r, g, b, a float64) {
|
func (c *ColorM) Translate(r, g, b, a float64) {
|
||||||
|
6
geom.go
6
geom.go
@ -76,8 +76,10 @@ func (g *GeoM) Scale(x, y float64) {
|
|||||||
if !g.initialized {
|
if !g.initialized {
|
||||||
*g = geoMI
|
*g = geoMI
|
||||||
}
|
}
|
||||||
g.es[0][0] *= x
|
for i := 0; i < GeoMDim; i++ {
|
||||||
g.es[1][1] *= y
|
g.es[0][i] *= x
|
||||||
|
g.es[1][i] *= y
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GeoM) Translate(tx, ty float64) {
|
func (g *GeoM) Translate(tx, ty float64) {
|
||||||
|
Loading…
Reference in New Issue
Block a user