minor change

This commit is contained in:
faiface 2017-05-21 18:23:20 +02:00
parent 0ac5371d7e
commit 3ae612a84d
1 changed files with 4 additions and 3 deletions

View File

@ -61,7 +61,7 @@ func (s *Sprite) Draw(t Target, matrix Matrix) {
s.DrawColorMask(t, matrix, nil) s.DrawColorMask(t, matrix, nil)
} }
// DrawColorMask draw the Sprite onto the provided Target. The Sprite will be transformed by the // DrawColorMask draws the Sprite onto the provided Target. The Sprite will be transformed by the
// given Matrix and all of it's color will be multiplied by the given mask. // given Matrix and all of it's color will be multiplied by the given mask.
// //
// If the mask is nil, a fully opaque white mask will be used, which causes no effect. // If the mask is nil, a fully opaque white mask will be used, which causes no effect.
@ -74,8 +74,9 @@ func (s *Sprite) DrawColorMask(t Target, matrix Matrix, mask color.Color) {
if mask == nil { if mask == nil {
mask = Alpha(1) mask = Alpha(1)
} }
if mask != s.mask { rgba := ToRGBA(mask)
s.mask = ToRGBA(mask) if rgba != s.mask {
s.mask = rgba
dirty = true dirty = true
} }