Remove unused code from clipping mask and move conditional in canvas