Fixes broken masking in Canvas renderer

Fixes issue #1051