mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
affine: Implement ColorM.Add for backward compatibility: Don't use this anyway
This commit is contained in:
parent
f5a283effd
commit
929dfa1cfb
@ -173,7 +173,28 @@ func (c *ColorM) Concat(other *ColorM) {
|
|||||||
|
|
||||||
// Add is deprecated.
|
// Add is deprecated.
|
||||||
func (c *ColorM) Add(other ColorM) {
|
func (c *ColorM) Add(other ColorM) {
|
||||||
// Do nothing.
|
// Implementation is just for backward compatibility.
|
||||||
|
if c.body == nil {
|
||||||
|
c.body = colorMIdentityBody
|
||||||
|
c.translate = colorMIdentityTranslate
|
||||||
|
}
|
||||||
|
if other.body == nil {
|
||||||
|
other.body = colorMIdentityBody
|
||||||
|
other.translate = colorMIdentityTranslate
|
||||||
|
}
|
||||||
|
|
||||||
|
body := make([]float64, len(c.body))
|
||||||
|
for i := range c.body {
|
||||||
|
body[i] = c.body[i] + other.body[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
translate := make([]float64, len(c.translate))
|
||||||
|
for i := range c.translate {
|
||||||
|
translate[i] = c.translate[i] + other.translate[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
c.body = body
|
||||||
|
c.translate = translate
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scale scales the matrix by (r, g, b, a).
|
// Scale scales the matrix by (r, g, b, a).
|
||||||
|
Loading…
Reference in New Issue
Block a user