affine: Add ColorM.Equals

This commit is contained in:
Hajime Hoshi 2016-11-01 00:28:07 +09:00
parent d02c67a996
commit 4915531450
2 changed files with 12 additions and 6 deletions

View File

@ -75,6 +75,16 @@ func (c *ColorM) dim() int {
return ColorMDim
}
func (c *ColorM) Equals(other *ColorM) bool {
if c.values == "" {
c.values = colorMIdentityValue
}
if other.values == "" {
other.values = colorMIdentityValue
}
return c.values == other.values
}
// Concat multiplies a color matrix with the other color matrix.
// This is same as muptiplying the matrix other and the matrix c in this order.
func (c *ColorM) Concat(other ColorM) {

View File

@ -235,13 +235,9 @@ func (c *drawImageCommand) isMergeable(other *drawImageCommand) bool {
if c.src != other.src {
return false
}
for i := 0; i < 4; i++ {
for j := 0; j < 5; j++ {
if c.color.Element(i, j) != other.color.Element(i, j) {
if !c.color.Equals(&other.color) {
return false
}
}
}
if c.mode != other.mode {
return false
}