Add dirty check for clearRect

For some reason, clearRect on an empty canvas in Chrome is slow