mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
graphics: Bug fix: ColorM.Scale worked wrongly
This commit is contained in:
parent
cd48e79355
commit
7bd2fb6ce2
@ -120,7 +120,7 @@ func TestColorTranslateAndScale(t *testing.T) {
|
||||
{1, 0, 0, 0, 0},
|
||||
{0, 1, 0, 0, 0},
|
||||
{0, 0, 1, 0, 0},
|
||||
{0, 0, 0, 0.5, 1},
|
||||
{0, 0, 0, 0.5, 0.5},
|
||||
}
|
||||
m := ColorM{}
|
||||
m.Translate(0, 0, 0, 1)
|
||||
|
@ -91,7 +91,7 @@ func (c *ColorM) Add(other ColorM) {
|
||||
|
||||
// Scale scales the matrix by (r, g, b, a).
|
||||
func (c *ColorM) Scale(r, g, b, a float64) {
|
||||
for i := 0; i < ColorMDim-1; i++ {
|
||||
for i := 0; i < ColorMDim; i++ {
|
||||
c.SetElement(0, i, c.Element(0, i)*r)
|
||||
c.SetElement(1, i, c.Element(1, i)*g)
|
||||
c.SetElement(2, i, c.Element(2, i)*b)
|
||||
|
Loading…
Reference in New Issue
Block a user