minor optimization in Sprite
This commit is contained in:
parent
b2819732fc
commit
0bfc4cd068
|
@ -58,9 +58,11 @@ func (s *Sprite) Frame() Rect {
|
|||
// Note, that this has nothing to do with BasicTarget's SetMatrix method. This only affects this
|
||||
// Sprite and is usable with any Target.
|
||||
func (s *Sprite) SetMatrix(matrix Matrix) {
|
||||
if s.matrix != matrix {
|
||||
s.matrix = matrix
|
||||
s.calcData()
|
||||
}
|
||||
}
|
||||
|
||||
// Matrix returns the currently set Matrix.
|
||||
func (s *Sprite) Matrix() Matrix {
|
||||
|
@ -73,9 +75,12 @@ func (s *Sprite) Matrix() Matrix {
|
|||
// Note, that this has nothing to do with BasicTarget's SetColorMask method. This only affects this
|
||||
// Sprite and is usable with any Target.
|
||||
func (s *Sprite) SetColorMask(mask color.Color) {
|
||||
rgba := ToRGBA(mask)
|
||||
if s.mask != rgba {
|
||||
s.mask = ToRGBA(mask)
|
||||
s.calcData()
|
||||
}
|
||||
}
|
||||
|
||||
// ColorMask returns the currently set color mask.
|
||||
func (s *Sprite) ColorMask() RGBA {
|
||||
|
|
Loading…
Reference in New Issue